@wgalleti/primevue-components 0.9.6 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/WProgressFlow.vue_vue_type_script_setup_true_lang-C-167GXT.cjs +12 -0
- package/dist/WProgressFlow.vue_vue_type_script_setup_true_lang-C-167GXT.cjs.map +1 -0
- package/dist/WProgressFlow.vue_vue_type_script_setup_true_lang-D9HgZsV9.js +3886 -0
- package/dist/WProgressFlow.vue_vue_type_script_setup_true_lang-D9HgZsV9.js.map +1 -0
- package/dist/components/form/WTreeSelect.vue.d.ts +124 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components.cjs +1 -1
- package/dist/components.js +7 -6
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +53 -52
- package/dist/index.js.map +1 -1
- package/dist/primevue-components.css +1 -1
- package/dist/utils/treeSelect.d.ts +76 -0
- package/package.json +3 -1
- package/skill/references/components.md +7 -0
- package/dist/WProgressFlow.vue_vue_type_script_setup_true_lang-Cc0DJRIy.cjs +0 -12
- package/dist/WProgressFlow.vue_vue_type_script_setup_true_lang-Cc0DJRIy.cjs.map +0 -1
- package/dist/WProgressFlow.vue_vue_type_script_setup_true_lang-DVjJq8Bs.js +0 -3632
- package/dist/WProgressFlow.vue_vue_type_script_setup_true_lang-DVjJq8Bs.js.map +0 -1
|
@@ -0,0 +1,3886 @@
|
|
|
1
|
+
import { defineComponent as se, openBlock as n, createElementBlock as m, createBlock as S, unref as u, toDisplayString as A, inject as Et, ref as T, computed as D, onMounted as yt, nextTick as ut, watch as Ve, reactive as Ae, resolveDirective as Ft, Fragment as te, createElementVNode as f, mergeProps as Xt, createVNode as P, createSlots as Je, withCtx as H, withDirectives as ue, createCommentVNode as k, renderList as ie, normalizeStyle as ye, createTextVNode as Fe, normalizeClass as le, onBeforeUnmount as Zt, renderSlot as B, isRef as Qt, withModifiers as _t, normalizeProps as ft, guardReactiveProps as vt, useSlots as el, createStaticVNode as tl } from "vue";
|
|
2
|
+
import Pt from "primevue/datatable";
|
|
3
|
+
import Oe from "primevue/column";
|
|
4
|
+
import O from "primevue/button";
|
|
5
|
+
import de from "primevue/inputtext";
|
|
6
|
+
import ot from "primevue/inputnumber";
|
|
7
|
+
import pt from "primevue/select";
|
|
8
|
+
import Mt from "primevue/popover";
|
|
9
|
+
import ll from "primevue/checkbox";
|
|
10
|
+
import ze from "primevue/iconfield";
|
|
11
|
+
import We from "primevue/inputicon";
|
|
12
|
+
import al from "primevue/paginator";
|
|
13
|
+
import ol from "primevue/contextmenu";
|
|
14
|
+
import nt from "primevue/dialog";
|
|
15
|
+
import It from "primevue/tag";
|
|
16
|
+
import { f as gt, b as nl, a as il, e as kt, c as sl, d as rl } from "./useFormKeyboardNav-D4Irq5RE.js";
|
|
17
|
+
import ul from "primevue/textarea";
|
|
18
|
+
import Rt from "primevue/autocomplete";
|
|
19
|
+
import dl from "primevue/toggleswitch";
|
|
20
|
+
import cl from "primevue/colorpicker";
|
|
21
|
+
import ml from "primevue/password";
|
|
22
|
+
import wt from "primevue/chip";
|
|
23
|
+
import { W as fl } from "./plugin-BKa0eSEM.js";
|
|
24
|
+
import At from "primevue/datepicker";
|
|
25
|
+
import vl from "primevue/inputgroup";
|
|
26
|
+
import $t from "primevue/inputgroupaddon";
|
|
27
|
+
import pl from "primevue/slider";
|
|
28
|
+
import hl from "primevue/tree";
|
|
29
|
+
import et from "primevue/skeleton";
|
|
30
|
+
const yl = {
|
|
31
|
+
key: 0,
|
|
32
|
+
class: "text-muted-color text-xs"
|
|
33
|
+
}, gl = ["src", "alt"], bl = {
|
|
34
|
+
key: 3,
|
|
35
|
+
class: "text-muted-color tabular-nums text-[0.8125rem]"
|
|
36
|
+
}, kl = {
|
|
37
|
+
key: 4,
|
|
38
|
+
class: "text-muted-color tabular-nums text-[0.8125rem]"
|
|
39
|
+
}, wl = {
|
|
40
|
+
key: 5,
|
|
41
|
+
class: "font-semibold tabular-nums text-[0.8125rem]"
|
|
42
|
+
}, $l = {
|
|
43
|
+
key: 6,
|
|
44
|
+
class: "font-semibold tabular-nums text-[0.8125rem]"
|
|
45
|
+
}, xl = {
|
|
46
|
+
key: 7,
|
|
47
|
+
class: "text-[0.8125rem]"
|
|
48
|
+
}, ht = /* @__PURE__ */ se({
|
|
49
|
+
__name: "WCrudColumnRenderer",
|
|
50
|
+
props: {
|
|
51
|
+
column: {},
|
|
52
|
+
value: {},
|
|
53
|
+
rowData: {}
|
|
54
|
+
},
|
|
55
|
+
setup(e) {
|
|
56
|
+
const { formatDate: a, formatDateTime: t, formatCurrency: o, formatNumber: i } = gt();
|
|
57
|
+
return (d, h) => e.value == null ? (n(), m("span", yl, "—")) : e.column.type === "image" ? (n(), m("img", {
|
|
58
|
+
key: 1,
|
|
59
|
+
src: String(e.value),
|
|
60
|
+
alt: e.column.header,
|
|
61
|
+
class: "size-9 rounded-lg object-cover ring-1 ring-surface-200 dark:ring-surface-700"
|
|
62
|
+
}, null, 8, gl)) : e.column.type === "boolean" ? (n(), S(u(It), {
|
|
63
|
+
key: 2,
|
|
64
|
+
value: e.column.tagValue ? e.column.tagValue(e.value, e.rowData) : e.value ? "Ativo" : "Inativo",
|
|
65
|
+
severity: e.column.tagSeverity ? e.column.tagSeverity(e.value, e.rowData) : e.value ? "success" : "danger",
|
|
66
|
+
class: "text-xs"
|
|
67
|
+
}, null, 8, ["value", "severity"])) : e.column.type === "date" ? (n(), m("span", bl, A(u(a)(e.value)), 1)) : e.column.type === "datetime" ? (n(), m("span", kl, A(u(t)(e.value)), 1)) : e.column.type === "currency" ? (n(), m("span", wl, A(u(o)(e.value)), 1)) : e.column.type === "number" ? (n(), m("span", $l, A(e.column.format ? e.column.format(e.value, e.rowData) : u(i)(e.value, e.column.decimals ?? 0)), 1)) : (n(), m("span", xl, A(e.column.format ? e.column.format(e.value, e.rowData) : e.value), 1));
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
var Cl = Object.defineProperty, Vl = (e, a, t) => a in e ? Cl(e, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[a] = t, Xe = (e, a, t) => Vl(e, typeof a != "symbol" ? a + "" : a, t);
|
|
71
|
+
const xt = {
|
|
72
|
+
"#": { pattern: /[0-9]/ },
|
|
73
|
+
"@": { pattern: /[a-zA-Z]/ },
|
|
74
|
+
"*": { pattern: /[a-zA-Z0-9]/ }
|
|
75
|
+
}, Ct = (e, a, t) => e.replaceAll(a, "").replace(t, ".").replace("..", ".").replace(/[^.\d]/g, ""), Vt = (e, a, t) => {
|
|
76
|
+
var o;
|
|
77
|
+
return new Intl.NumberFormat(((o = t.number) == null ? void 0 : o.locale) ?? "en", {
|
|
78
|
+
minimumFractionDigits: e,
|
|
79
|
+
maximumFractionDigits: a,
|
|
80
|
+
roundingMode: "trunc"
|
|
81
|
+
});
|
|
82
|
+
}, Sl = (e, a = !0, t) => {
|
|
83
|
+
var o, i, d, h;
|
|
84
|
+
const V = ((o = t.number) == null ? void 0 : o.unsigned) !== !0 && e.startsWith("-") ? "-" : "", x = ((i = t.number) == null ? void 0 : i.fraction) ?? 0;
|
|
85
|
+
let w = Vt(0, x, t);
|
|
86
|
+
const I = w.formatToParts(1000.12), $ = ((d = I.find((R) => R.type === "group")) == null ? void 0 : d.value) ?? " ", z = ((h = I.find((R) => R.type === "decimal")) == null ? void 0 : h.value) ?? ".", G = Ct(e, $, z);
|
|
87
|
+
if (Number.isNaN(parseFloat(G))) return V;
|
|
88
|
+
const Y = G.split(".");
|
|
89
|
+
if (Y[1] != null && Y[1].length >= 1) {
|
|
90
|
+
const R = Y[1].length <= x ? Y[1].length : x;
|
|
91
|
+
w = Vt(R, x, t);
|
|
92
|
+
}
|
|
93
|
+
let X = w.format(parseFloat(G));
|
|
94
|
+
return a ? x > 0 && G.endsWith(".") && !G.slice(0, -1).includes(".") && (X += z) : X = Ct(X, $, z), V + X;
|
|
95
|
+
}, Bt = (e) => JSON.parse(e.replaceAll("'", '"')), Dl = (e, a = {}) => {
|
|
96
|
+
const t = { ...a };
|
|
97
|
+
e.dataset.maska != null && e.dataset.maska !== "" && (t.mask = El(e.dataset.maska)), e.dataset.maskaEager != null && (t.eager = tt(e.dataset.maskaEager)), e.dataset.maskaReversed != null && (t.reversed = tt(e.dataset.maskaReversed)), e.dataset.maskaTokensReplace != null && (t.tokensReplace = tt(e.dataset.maskaTokensReplace)), e.dataset.maskaTokens != null && (t.tokens = Fl(e.dataset.maskaTokens));
|
|
98
|
+
const o = {};
|
|
99
|
+
return e.dataset.maskaNumberLocale != null && (o.locale = e.dataset.maskaNumberLocale), e.dataset.maskaNumberFraction != null && (o.fraction = parseInt(e.dataset.maskaNumberFraction)), e.dataset.maskaNumberUnsigned != null && (o.unsigned = tt(e.dataset.maskaNumberUnsigned)), (e.dataset.maskaNumber != null || Object.values(o).length > 0) && (t.number = o), t;
|
|
100
|
+
}, tt = (e) => e !== "" ? !!JSON.parse(e) : !0, El = (e) => e.startsWith("[") && e.endsWith("]") ? Bt(e) : e, Fl = (e) => {
|
|
101
|
+
if (e.startsWith("{") && e.endsWith("}"))
|
|
102
|
+
return Bt(e);
|
|
103
|
+
const a = {};
|
|
104
|
+
return e.split("|").forEach((t) => {
|
|
105
|
+
const o = t.split(":");
|
|
106
|
+
a[o[0]] = {
|
|
107
|
+
pattern: Ut() ? new RegExp(o[1], "u") : new RegExp(o[1]),
|
|
108
|
+
optional: o[2] === "optional",
|
|
109
|
+
multiple: o[2] === "multiple",
|
|
110
|
+
repeated: o[2] === "repeated"
|
|
111
|
+
};
|
|
112
|
+
}), a;
|
|
113
|
+
}, Ut = () => {
|
|
114
|
+
try {
|
|
115
|
+
return new RegExp("\\p{L}", "u"), !0;
|
|
116
|
+
} catch {
|
|
117
|
+
return !1;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
class Pl {
|
|
121
|
+
constructor(a = {}) {
|
|
122
|
+
Xe(this, "opts", {}), Xe(this, "memo", /* @__PURE__ */ new Map());
|
|
123
|
+
const t = { ...a };
|
|
124
|
+
if (t.tokens != null) {
|
|
125
|
+
t.tokens = t.tokensReplace ? { ...t.tokens } : { ...xt, ...t.tokens };
|
|
126
|
+
for (const o of Object.values(t.tokens))
|
|
127
|
+
typeof o.pattern == "string" && (o.pattern = Ut() ? new RegExp(o.pattern, "u") : new RegExp(o.pattern));
|
|
128
|
+
} else
|
|
129
|
+
t.tokens = xt;
|
|
130
|
+
Array.isArray(t.mask) && (t.mask.length > 1 ? t.mask = [...t.mask].sort((o, i) => o.length - i.length) : t.mask = t.mask[0] ?? ""), t.mask === "" && (t.mask = null), this.opts = t;
|
|
131
|
+
}
|
|
132
|
+
masked(a) {
|
|
133
|
+
return this.process(String(a), this.findMask(String(a)));
|
|
134
|
+
}
|
|
135
|
+
unmasked(a) {
|
|
136
|
+
return this.process(String(a), this.findMask(String(a)), !1);
|
|
137
|
+
}
|
|
138
|
+
isEager() {
|
|
139
|
+
return this.opts.eager === !0;
|
|
140
|
+
}
|
|
141
|
+
isReversed() {
|
|
142
|
+
return this.opts.reversed === !0;
|
|
143
|
+
}
|
|
144
|
+
completed(a) {
|
|
145
|
+
const t = this.findMask(String(a));
|
|
146
|
+
if (this.opts.mask == null || t == null) return !1;
|
|
147
|
+
const o = this.process(String(a), t).length;
|
|
148
|
+
return typeof this.opts.mask == "string" ? o >= this.opts.mask.length : o >= t.length;
|
|
149
|
+
}
|
|
150
|
+
findMask(a) {
|
|
151
|
+
const t = this.opts.mask;
|
|
152
|
+
if (t == null)
|
|
153
|
+
return null;
|
|
154
|
+
if (typeof t == "string")
|
|
155
|
+
return t;
|
|
156
|
+
if (typeof t == "function")
|
|
157
|
+
return t(a);
|
|
158
|
+
const o = this.process(a, t.slice(-1).pop() ?? "", !1);
|
|
159
|
+
return t.find((i) => this.process(a, i, !1).length >= o.length) ?? "";
|
|
160
|
+
}
|
|
161
|
+
escapeMask(a) {
|
|
162
|
+
const t = [], o = [];
|
|
163
|
+
return a.split("").forEach((i, d) => {
|
|
164
|
+
i === "!" && a[d - 1] !== "!" ? o.push(d - o.length) : t.push(i);
|
|
165
|
+
}), { mask: t.join(""), escaped: o };
|
|
166
|
+
}
|
|
167
|
+
process(a, t, o = !0) {
|
|
168
|
+
if (this.opts.number != null) return Sl(a, o, this.opts);
|
|
169
|
+
if (t == null) return a;
|
|
170
|
+
const i = `v=${a},mr=${t},m=${o ? 1 : 0}`;
|
|
171
|
+
if (this.memo.has(i)) return this.memo.get(i);
|
|
172
|
+
const { mask: d, escaped: h } = this.escapeMask(t), V = [], x = this.opts.tokens != null ? this.opts.tokens : {}, w = this.isReversed() ? -1 : 1, I = this.isReversed() ? "unshift" : "push", $ = this.isReversed() ? 0 : d.length - 1, z = this.isReversed() ? () => R > -1 && L > -1 : () => R < d.length && L < a.length, G = (F) => !this.isReversed() && F <= $ || this.isReversed() && F >= $;
|
|
173
|
+
let Y, X = -1, R = this.isReversed() ? d.length - 1 : 0, L = this.isReversed() ? a.length - 1 : 0, W = !1;
|
|
174
|
+
for (; z(); ) {
|
|
175
|
+
const F = d.charAt(R), j = x[F], K = (j == null ? void 0 : j.transform) != null ? j.transform(a.charAt(L)) : a.charAt(L);
|
|
176
|
+
if (!h.includes(R) && j != null ? (K.match(j.pattern) != null ? (V[I](K), j.repeated ? (X === -1 ? X = R : R === $ && R !== X && (R = X - w), $ === X && (R -= w)) : j.multiple && (W = !0, R -= w), R += w) : j.multiple ? W && (R += w, L -= w, W = !1) : K === Y ? Y = void 0 : j.optional && (R += w, L -= w), L += w) : (o && !this.isEager() && V[I](F), K === F && !this.isEager() ? L += w : Y = F, this.isEager() || (R += w)), this.isEager())
|
|
177
|
+
for (; G(R) && (x[d.charAt(R)] == null || h.includes(R)); ) {
|
|
178
|
+
if (o) {
|
|
179
|
+
if (V[I](d.charAt(R)), a.charAt(L) === d.charAt(R)) {
|
|
180
|
+
R += w, L += w;
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
} else d.charAt(R) === a.charAt(L) && (L += w);
|
|
184
|
+
R += w;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return this.memo.set(i, V.join("")), this.memo.get(i);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
class Ml {
|
|
191
|
+
constructor(a, t = {}) {
|
|
192
|
+
Xe(this, "items", /* @__PURE__ */ new Map()), Xe(this, "eventAbortController"), Xe(this, "onInput", (o) => {
|
|
193
|
+
if (o instanceof CustomEvent && o.type === "input" && !o.isTrusted && !o.bubbles)
|
|
194
|
+
return;
|
|
195
|
+
const i = o.target, d = this.items.get(i);
|
|
196
|
+
if (d === void 0) return;
|
|
197
|
+
const h = "inputType" in o && o.inputType.startsWith("delete"), V = d.isEager(), x = h && V && d.unmasked(i.value) === "" ? "" : i.value;
|
|
198
|
+
this.fixCursor(i, h, () => this.setValue(i, x));
|
|
199
|
+
}), this.options = t, this.eventAbortController = new AbortController(), this.init(this.getInputs(a));
|
|
200
|
+
}
|
|
201
|
+
update(a = {}) {
|
|
202
|
+
this.options = { ...a }, this.init(Array.from(this.items.keys()));
|
|
203
|
+
}
|
|
204
|
+
updateValue(a) {
|
|
205
|
+
var t;
|
|
206
|
+
a.value !== "" && a.value !== ((t = this.processInput(a)) == null ? void 0 : t.masked) && this.setValue(a, a.value);
|
|
207
|
+
}
|
|
208
|
+
destroy() {
|
|
209
|
+
this.eventAbortController.abort(), this.items.clear();
|
|
210
|
+
}
|
|
211
|
+
init(a) {
|
|
212
|
+
const t = this.getOptions(this.options);
|
|
213
|
+
for (const o of a) {
|
|
214
|
+
if (!this.items.has(o)) {
|
|
215
|
+
const { signal: d } = this.eventAbortController;
|
|
216
|
+
o.addEventListener("input", this.onInput, { capture: !0, signal: d });
|
|
217
|
+
}
|
|
218
|
+
const i = new Pl(Dl(o, t));
|
|
219
|
+
this.items.set(o, i), queueMicrotask(() => this.updateValue(o)), o.selectionStart === null && i.isEager() && console.warn("Maska: input of `%s` type is not supported", o.type);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
getInputs(a) {
|
|
223
|
+
return typeof a == "string" ? Array.from(document.querySelectorAll(a)) : "length" in a ? Array.from(a) : [a];
|
|
224
|
+
}
|
|
225
|
+
getOptions(a) {
|
|
226
|
+
const { onMaska: t, preProcess: o, postProcess: i, ...d } = a;
|
|
227
|
+
return d;
|
|
228
|
+
}
|
|
229
|
+
fixCursor(a, t, o) {
|
|
230
|
+
var i, d;
|
|
231
|
+
const h = a.selectionStart, V = a.value;
|
|
232
|
+
if (o(), h === null || h === V.length && !t) return;
|
|
233
|
+
const x = a.value, w = V.slice(0, h), I = x.slice(0, h), $ = (i = this.processInput(a, w)) == null ? void 0 : i.unmasked, z = (d = this.processInput(a, I)) == null ? void 0 : d.unmasked;
|
|
234
|
+
if ($ === void 0 || z === void 0) return;
|
|
235
|
+
let G = h;
|
|
236
|
+
w !== I && (G += t ? x.length - V.length : $.length - z.length), a.setSelectionRange(G, G);
|
|
237
|
+
}
|
|
238
|
+
setValue(a, t) {
|
|
239
|
+
const o = this.processInput(a, t);
|
|
240
|
+
o !== void 0 && (a.value = o.masked, this.options.onMaska != null && (Array.isArray(this.options.onMaska) ? this.options.onMaska.forEach((i) => i(o)) : this.options.onMaska(o)), a.dispatchEvent(new CustomEvent("maska", { detail: o })), a.dispatchEvent(new CustomEvent("input", { detail: o.masked })));
|
|
241
|
+
}
|
|
242
|
+
processInput(a, t) {
|
|
243
|
+
const o = this.items.get(a);
|
|
244
|
+
if (o === void 0) return;
|
|
245
|
+
let i = t ?? a.value;
|
|
246
|
+
this.options.preProcess != null && (i = this.options.preProcess(i));
|
|
247
|
+
let d = o.masked(i);
|
|
248
|
+
return this.options.postProcess != null && (d = this.options.postProcess(d)), {
|
|
249
|
+
masked: d,
|
|
250
|
+
unmasked: o.unmasked(i),
|
|
251
|
+
completed: o.completed(i)
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
const dt = /* @__PURE__ */ new WeakMap(), Il = (e, a) => {
|
|
256
|
+
if (e.arg == null || e.instance == null) return;
|
|
257
|
+
const t = "setup" in e.instance.$.type;
|
|
258
|
+
e.arg in e.instance ? e.instance[e.arg] = a : t && console.warn("Maska: please expose `%s` using defineExpose", e.arg);
|
|
259
|
+
}, at = (e, a) => {
|
|
260
|
+
var t;
|
|
261
|
+
const o = e instanceof HTMLInputElement ? e : e.querySelector("input");
|
|
262
|
+
if (o == null || (o == null ? void 0 : o.type) === "file") return;
|
|
263
|
+
let i = {};
|
|
264
|
+
if (a.value != null && (i = typeof a.value == "string" ? { mask: a.value } : { ...a.value }), a.arg != null) {
|
|
265
|
+
const d = (h) => {
|
|
266
|
+
const V = a.modifiers.unmasked ? h.unmasked : a.modifiers.completed ? h.completed : h.masked;
|
|
267
|
+
Il(a, V);
|
|
268
|
+
};
|
|
269
|
+
i.onMaska = i.onMaska == null ? d : Array.isArray(i.onMaska) ? [...i.onMaska, d] : [i.onMaska, d];
|
|
270
|
+
}
|
|
271
|
+
dt.has(o) ? (t = dt.get(o)) == null || t.update(i) : dt.set(o, new Ml(o, i));
|
|
272
|
+
}, Rl = {
|
|
273
|
+
string: "text",
|
|
274
|
+
integer: "number",
|
|
275
|
+
decimal: "number",
|
|
276
|
+
float: "number",
|
|
277
|
+
boolean: "switch",
|
|
278
|
+
choice: "select",
|
|
279
|
+
fk: "fk",
|
|
280
|
+
date: "date",
|
|
281
|
+
datetime: "datetime",
|
|
282
|
+
email: "email",
|
|
283
|
+
url: "text",
|
|
284
|
+
slug: "text",
|
|
285
|
+
text: "textarea"
|
|
286
|
+
};
|
|
287
|
+
function Al(e) {
|
|
288
|
+
var o;
|
|
289
|
+
const a = Rl[e.type] ?? "text", t = {
|
|
290
|
+
field: e.name,
|
|
291
|
+
label: e.label,
|
|
292
|
+
type: a,
|
|
293
|
+
required: e.required ?? !1
|
|
294
|
+
};
|
|
295
|
+
return (e.type === "decimal" || e.type === "float") && (t.minFractionDigits = 2, t.maxFractionDigits = 2), e.type === "boolean" && (t.defaultValue = !1), e.type === "choice" && ((o = e.choices) != null && o.length) && (t.options = e.choices.map((i) => ({
|
|
296
|
+
label: i.label,
|
|
297
|
+
value: i.value
|
|
298
|
+
}))), e.type === "fk" && (t.endpoint = e.endpoint, e.option_label && (t.optionLabel = e.option_label), e.option_value && (t.optionValue = e.option_value)), t;
|
|
299
|
+
}
|
|
300
|
+
function Bl(e) {
|
|
301
|
+
return e.filter((a) => !a.read_only && a.name !== "id").map(Al);
|
|
302
|
+
}
|
|
303
|
+
const Ul = {
|
|
304
|
+
boolean: "boolean",
|
|
305
|
+
date: "date",
|
|
306
|
+
datetime: "datetime",
|
|
307
|
+
decimal: "number",
|
|
308
|
+
float: "number",
|
|
309
|
+
integer: "number"
|
|
310
|
+
};
|
|
311
|
+
function Tl(e) {
|
|
312
|
+
return {
|
|
313
|
+
field: e.type === "fk" ? `${e.name}_nome` : e.name,
|
|
314
|
+
header: e.label,
|
|
315
|
+
type: Ul[e.type],
|
|
316
|
+
sortable: !0
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
function Ll(e, a = 6) {
|
|
320
|
+
return e.filter((t) => !t.read_only && t.name !== "id").slice(0, a).map(Tl);
|
|
321
|
+
}
|
|
322
|
+
const Nl = {
|
|
323
|
+
key: 2,
|
|
324
|
+
class: "w-autocompletefk-chip-hidden"
|
|
325
|
+
}, Ol = ["disabled"], zl = { class: "w-autocompletefk-toolbar" }, Wl = { class: "w-autocompletefk-toolbar-actions" }, jl = { class: "flex items-center justify-end gap-1" }, ql = { class: "w-autocompletefk-footer" }, Kl = /* @__PURE__ */ se({
|
|
326
|
+
inheritAttrs: !1,
|
|
327
|
+
__name: "WAutoCompleteFK",
|
|
328
|
+
props: {
|
|
329
|
+
modelValue: {},
|
|
330
|
+
endpoint: {},
|
|
331
|
+
endpointParams: {},
|
|
332
|
+
drilldown: {},
|
|
333
|
+
multiple: { type: Boolean, default: !1 },
|
|
334
|
+
maxChips: { default: 0 },
|
|
335
|
+
optionLabel: { default: "nome" },
|
|
336
|
+
optionValue: { default: "id" },
|
|
337
|
+
placeholder: { default: "Buscar..." },
|
|
338
|
+
blockedPlaceholder: {},
|
|
339
|
+
disabled: { type: Boolean, default: !1 },
|
|
340
|
+
showClear: { type: Boolean, default: !0 },
|
|
341
|
+
forceSelection: { type: Boolean, default: !0 },
|
|
342
|
+
columns: {},
|
|
343
|
+
minLength: { default: 0 },
|
|
344
|
+
dialogHeader: {},
|
|
345
|
+
canCreate: { type: Boolean, default: void 0 },
|
|
346
|
+
canEdit: { type: Boolean, default: void 0 },
|
|
347
|
+
canDelete: { type: Boolean, default: void 0 },
|
|
348
|
+
crudFields: {},
|
|
349
|
+
crudColumns: {},
|
|
350
|
+
dialogWidth: { default: "480px" },
|
|
351
|
+
autofocus: { type: Boolean, default: !1 }
|
|
352
|
+
},
|
|
353
|
+
emits: ["update:modelValue"],
|
|
354
|
+
setup(e, { emit: a }) {
|
|
355
|
+
const t = e, o = a, i = Et(fl);
|
|
356
|
+
if (!i)
|
|
357
|
+
throw new Error("[wPrimeVueComponents] dataProvider não encontrado. Registre o WPrimeVuePlugin.");
|
|
358
|
+
const d = i, h = nl(), { confirmDelete: V } = il(), x = T(null), w = T([]), I = T([]), $ = T(!1), z = D(() => t.multiple ? w.value : x.value);
|
|
359
|
+
function G(s) {
|
|
360
|
+
return s && typeof s == "object" ? s[t.optionValue] : s;
|
|
361
|
+
}
|
|
362
|
+
function Y(s) {
|
|
363
|
+
const b = /* @__PURE__ */ new Set(), E = [];
|
|
364
|
+
for (const M of s) {
|
|
365
|
+
const U = G(M);
|
|
366
|
+
b.has(U) || (b.add(U), E.push(M));
|
|
367
|
+
}
|
|
368
|
+
return E;
|
|
369
|
+
}
|
|
370
|
+
function X() {
|
|
371
|
+
o("update:modelValue", t.multiple ? [...w.value] : x.value);
|
|
372
|
+
}
|
|
373
|
+
function R(s) {
|
|
374
|
+
const b = s == null ? void 0 : s[t.optionLabel];
|
|
375
|
+
return b == null ? "" : String(b);
|
|
376
|
+
}
|
|
377
|
+
const L = D(
|
|
378
|
+
() => t.maxChips > 0 ? Math.max(0, w.value.length - t.maxChips) : 0
|
|
379
|
+
), W = D(
|
|
380
|
+
() => w.value.slice(t.maxChips).map(R).join(", ")
|
|
381
|
+
);
|
|
382
|
+
function F(s, b) {
|
|
383
|
+
var E;
|
|
384
|
+
(E = s == null ? void 0 : s.stopPropagation) == null || E.call(s), b(s);
|
|
385
|
+
}
|
|
386
|
+
function j() {
|
|
387
|
+
if (!t.disabled) {
|
|
388
|
+
if (t.multiple) {
|
|
389
|
+
if (!w.value.length) return;
|
|
390
|
+
w.value = [];
|
|
391
|
+
} else {
|
|
392
|
+
if (!x.value) return;
|
|
393
|
+
x.value = null;
|
|
394
|
+
}
|
|
395
|
+
X();
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
const K = D(
|
|
399
|
+
() => t.multiple && t.maxChips > 0 ? { "--w-fk-chip-max": `max(6rem, calc((100% - 6rem) / ${t.maxChips}))` } : void 0
|
|
400
|
+
), Z = D(() => !t.showClear || t.disabled ? !1 : t.multiple ? w.value.length > 0 : x.value !== null);
|
|
401
|
+
let J = null;
|
|
402
|
+
const ce = T(null);
|
|
403
|
+
yt(() => {
|
|
404
|
+
t.autofocus && ut(() => {
|
|
405
|
+
var b, E, M, U;
|
|
406
|
+
const s = (M = (E = (b = ce.value) == null ? void 0 : b.$el) == null ? void 0 : E.querySelector) == null ? void 0 : M.call(E, "input");
|
|
407
|
+
s && (s.setAttribute("autofocus", ""), s.focus(), (U = s.select) == null || U.call(s));
|
|
408
|
+
});
|
|
409
|
+
});
|
|
410
|
+
function ke(s) {
|
|
411
|
+
return s == null || s === "";
|
|
412
|
+
}
|
|
413
|
+
function Se(s) {
|
|
414
|
+
if (s && typeof s == "object") {
|
|
415
|
+
const b = s;
|
|
416
|
+
return b.id ?? b.value ?? b;
|
|
417
|
+
}
|
|
418
|
+
return s;
|
|
419
|
+
}
|
|
420
|
+
const me = D(() => {
|
|
421
|
+
const s = t.drilldown;
|
|
422
|
+
return s ? Array.isArray(s) ? s : [s] : [];
|
|
423
|
+
}), De = D(
|
|
424
|
+
() => me.value.some(
|
|
425
|
+
(s) => (s.required ?? !0) && ke(Se(s.value))
|
|
426
|
+
)
|
|
427
|
+
);
|
|
428
|
+
function ve() {
|
|
429
|
+
const s = {};
|
|
430
|
+
for (const b of me.value) {
|
|
431
|
+
const E = Se(b.value);
|
|
432
|
+
ke(E) || (s[b.field] = E);
|
|
433
|
+
}
|
|
434
|
+
return s;
|
|
435
|
+
}
|
|
436
|
+
const fe = D(
|
|
437
|
+
() => De.value && t.blockedPlaceholder ? t.blockedPlaceholder : t.placeholder
|
|
438
|
+
), pe = D(
|
|
439
|
+
() => t.multiple && w.value.length ? void 0 : fe.value
|
|
440
|
+
);
|
|
441
|
+
async function ge(s) {
|
|
442
|
+
try {
|
|
443
|
+
return (await d.get(t.endpoint, s)).data;
|
|
444
|
+
} catch {
|
|
445
|
+
return null;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
async function we(s) {
|
|
449
|
+
x.value = await ge(s);
|
|
450
|
+
}
|
|
451
|
+
async function be(s) {
|
|
452
|
+
return (await Promise.all(
|
|
453
|
+
s.map(async (E) => {
|
|
454
|
+
if (E && typeof E == "object") {
|
|
455
|
+
const U = E;
|
|
456
|
+
if (t.optionLabel in U) return U;
|
|
457
|
+
const Ce = U[t.optionValue];
|
|
458
|
+
return Ce != null ? await ge(Ce) : null;
|
|
459
|
+
}
|
|
460
|
+
return w.value.find((U) => U[t.optionValue] === E) ?? await ge(E);
|
|
461
|
+
})
|
|
462
|
+
)).filter((E) => E !== null);
|
|
463
|
+
}
|
|
464
|
+
async function Ee(s) {
|
|
465
|
+
if (De.value) {
|
|
466
|
+
I.value = [];
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
$.value = !0;
|
|
470
|
+
try {
|
|
471
|
+
const b = {
|
|
472
|
+
page_size: 20,
|
|
473
|
+
...t.endpointParams,
|
|
474
|
+
...ve()
|
|
475
|
+
};
|
|
476
|
+
s && (b.search = s);
|
|
477
|
+
const E = await d.list(t.endpoint, b);
|
|
478
|
+
I.value = E.data;
|
|
479
|
+
} catch {
|
|
480
|
+
I.value = [];
|
|
481
|
+
} finally {
|
|
482
|
+
$.value = !1;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
function p(s) {
|
|
486
|
+
const b = s.query || "";
|
|
487
|
+
if (b.length < t.minLength) {
|
|
488
|
+
I.value = [];
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
J && clearTimeout(J), J = setTimeout(() => Ee(b), 300);
|
|
492
|
+
}
|
|
493
|
+
function g(s) {
|
|
494
|
+
t.multiple || (x.value = s.value, o("update:modelValue", s.value));
|
|
495
|
+
}
|
|
496
|
+
function y(s) {
|
|
497
|
+
t.multiple && (w.value = Y(
|
|
498
|
+
Array.isArray(s) ? s : []
|
|
499
|
+
), X());
|
|
500
|
+
}
|
|
501
|
+
function l() {
|
|
502
|
+
t.multiple || (x.value = null, X());
|
|
503
|
+
}
|
|
504
|
+
Ve(
|
|
505
|
+
() => t.modelValue,
|
|
506
|
+
async (s) => {
|
|
507
|
+
if (t.multiple) {
|
|
508
|
+
const b = s == null ? [] : Array.isArray(s) ? s : [s], E = b.map(G), M = w.value.map((U) => U[t.optionValue]);
|
|
509
|
+
if (E.length === M.length && E.every((U, Ce) => U === M[Ce])) return;
|
|
510
|
+
w.value = await be(b);
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
if (s != null) {
|
|
514
|
+
if (typeof s == "object" && s !== null && t.optionLabel in s) {
|
|
515
|
+
x.value = s;
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
(!x.value || x.value[t.optionValue] !== s) && await we(s);
|
|
519
|
+
} else
|
|
520
|
+
x.value = null;
|
|
521
|
+
},
|
|
522
|
+
{ immediate: !0 }
|
|
523
|
+
);
|
|
524
|
+
const C = T(!1), ae = T([]), ee = T(!1), oe = T(""), _ = T(1), ne = T(15), $e = T(0), re = T(null), he = D(() => {
|
|
525
|
+
const s = re.value;
|
|
526
|
+
return s ? Array.isArray(s) ? s : [s] : [];
|
|
527
|
+
}), Re = T(null), Pe = T(0);
|
|
528
|
+
let Be = null;
|
|
529
|
+
const Ue = T([]), je = D(() => {
|
|
530
|
+
var s;
|
|
531
|
+
return (s = t.crudFields) != null && s.length ? !0 : Ue.value.length > 0;
|
|
532
|
+
}), it = D(() => t.canCreate ?? je.value), Ze = D(() => t.canEdit ?? je.value), Me = D(() => t.canDelete ?? je.value), qe = D(() => Ze.value || Me.value), c = D(() => {
|
|
533
|
+
var s;
|
|
534
|
+
return (s = t.crudFields) != null && s.length ? t.crudFields : Bl(Ue.value);
|
|
535
|
+
}), v = D(() => {
|
|
536
|
+
var s, b;
|
|
537
|
+
return (s = t.crudColumns) != null && s.length ? t.crudColumns : (b = t.columns) != null && b.length ? t.columns.map((E) => ({
|
|
538
|
+
field: E.field,
|
|
539
|
+
header: E.header,
|
|
540
|
+
sortable: !0
|
|
541
|
+
})) : Ue.value.length ? Ll(Ue.value) : [{ field: t.optionLabel, header: t.optionLabel, sortable: !0 }];
|
|
542
|
+
});
|
|
543
|
+
async function q() {
|
|
544
|
+
var s, b, E;
|
|
545
|
+
if (De.value) {
|
|
546
|
+
ae.value = [], $e.value = 0;
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
ee.value = !0;
|
|
550
|
+
try {
|
|
551
|
+
const M = {
|
|
552
|
+
page: _.value,
|
|
553
|
+
page_size: ne.value,
|
|
554
|
+
...t.endpointParams,
|
|
555
|
+
...ve()
|
|
556
|
+
};
|
|
557
|
+
oe.value && (M.search = oe.value), Re.value && Pe.value !== 0 && (M.ordering = Pe.value === -1 ? `-${Re.value}` : Re.value);
|
|
558
|
+
const U = await d.list(t.endpoint, M);
|
|
559
|
+
ae.value = U.data, $e.value = U.rows, (s = U.extras) != null && s.fields && !((b = t.columns) != null && b.length) && !((E = t.crudFields) != null && E.length) && (Ue.value = U.extras.fields);
|
|
560
|
+
} catch {
|
|
561
|
+
ae.value = [], $e.value = 0;
|
|
562
|
+
} finally {
|
|
563
|
+
ee.value = !1;
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
function r(s) {
|
|
567
|
+
s.key === "F2" && !t.disabled && (s.preventDefault(), N());
|
|
568
|
+
}
|
|
569
|
+
function N() {
|
|
570
|
+
t.disabled || (oe.value = "", _.value = 1, Re.value = null, Pe.value = 0, re.value = t.multiple ? [...w.value] : null, C.value = !0, q());
|
|
571
|
+
}
|
|
572
|
+
function Q(s) {
|
|
573
|
+
_.value = s.page + 1, ne.value = s.rows, q();
|
|
574
|
+
}
|
|
575
|
+
function xe(s) {
|
|
576
|
+
Re.value = s.sortField ?? null, Pe.value = s.sortOrder ?? 0, _.value = 1, q();
|
|
577
|
+
}
|
|
578
|
+
function Ke() {
|
|
579
|
+
if (t.multiple) {
|
|
580
|
+
w.value = Y(he.value), X(), C.value = !1;
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
const s = he.value[0];
|
|
584
|
+
s && (x.value = s, o("update:modelValue", s), C.value = !1);
|
|
585
|
+
}
|
|
586
|
+
function Qe(s) {
|
|
587
|
+
if (t.multiple) {
|
|
588
|
+
re.value = Y([...he.value, s.data]);
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
x.value = s.data, o("update:modelValue", s.data), C.value = !1;
|
|
592
|
+
}
|
|
593
|
+
const He = T(null), Ge = T(null);
|
|
594
|
+
let Te = "";
|
|
595
|
+
function _e() {
|
|
596
|
+
Te = "", ut(() => {
|
|
597
|
+
var b, E, M;
|
|
598
|
+
const s = (b = He.value) == null ? void 0 : b.$el;
|
|
599
|
+
(E = s == null ? void 0 : s.focus) == null || E.call(s), (M = s == null ? void 0 : s.select) == null || M.call(s);
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
function Ie() {
|
|
603
|
+
ut(() => {
|
|
604
|
+
var b;
|
|
605
|
+
const s = (b = Ge.value) == null ? void 0 : b.querySelector(".p-datatable-tbody > tr");
|
|
606
|
+
s == null || s.focus();
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
function Nt(s) {
|
|
610
|
+
if (s.key !== "Enter" || s.isComposing) return;
|
|
611
|
+
s.preventDefault();
|
|
612
|
+
const b = oe.value.trim();
|
|
613
|
+
if (b === "" || b === Te) {
|
|
614
|
+
Ie();
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
Be && clearTimeout(Be), Te = b, _.value = 1, q();
|
|
618
|
+
}
|
|
619
|
+
function Ot(s) {
|
|
620
|
+
s.key === "Enter" && (s.preventDefault(), s.stopPropagation(), (t.multiple || he.value.length) && Ke());
|
|
621
|
+
}
|
|
622
|
+
Ve(oe, () => {
|
|
623
|
+
Be && clearTimeout(Be), Be = setTimeout(() => {
|
|
624
|
+
_.value = 1, Te = oe.value.trim(), q();
|
|
625
|
+
}, 300);
|
|
626
|
+
}), Ve(
|
|
627
|
+
() => me.value.map((s) => Se(s.value)),
|
|
628
|
+
(s, b) => {
|
|
629
|
+
if (C.value && (_.value = 1, q()), !b) return;
|
|
630
|
+
const E = s.some((U, Ce) => U !== b[Ce]), M = b.some((U) => !ke(U));
|
|
631
|
+
if (!(!E || !M)) {
|
|
632
|
+
if (t.multiple) {
|
|
633
|
+
if (!w.value.length) return;
|
|
634
|
+
w.value = [], X();
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
x.value && (x.value = null, o("update:modelValue", null));
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
);
|
|
641
|
+
const Ye = T(!1), st = T(!1), Le = T(null), Ne = Ae({}), rt = D(() => Le.value !== null), zt = D(() => rt.value ? "Editar Registro" : "Novo Registro");
|
|
642
|
+
function Wt() {
|
|
643
|
+
const s = {};
|
|
644
|
+
for (const b of c.value)
|
|
645
|
+
s[b.field] = b.defaultValue !== void 0 ? typeof b.defaultValue == "function" ? b.defaultValue() : b.defaultValue : null;
|
|
646
|
+
return s;
|
|
647
|
+
}
|
|
648
|
+
function jt() {
|
|
649
|
+
const s = Wt();
|
|
650
|
+
for (const b of Object.keys(Ne))
|
|
651
|
+
delete Ne[b];
|
|
652
|
+
for (const [b, E] of Object.entries(s))
|
|
653
|
+
Ne[b] = E;
|
|
654
|
+
}
|
|
655
|
+
function qt() {
|
|
656
|
+
Le.value = null, jt(), Ye.value = !0;
|
|
657
|
+
}
|
|
658
|
+
function Kt(s) {
|
|
659
|
+
Le.value = s;
|
|
660
|
+
for (const b of c.value)
|
|
661
|
+
Ne[b.field] = s[b.field] !== void 0 ? s[b.field] : null;
|
|
662
|
+
Ye.value = !0;
|
|
663
|
+
}
|
|
664
|
+
function Ht(s, b) {
|
|
665
|
+
Ne[s] = b;
|
|
666
|
+
}
|
|
667
|
+
async function Gt() {
|
|
668
|
+
st.value = !0;
|
|
669
|
+
try {
|
|
670
|
+
const s = { ...Ne };
|
|
671
|
+
for (const E of c.value) {
|
|
672
|
+
const M = s[E.field];
|
|
673
|
+
if (E.type === "fk" && M !== null && typeof M == "object") {
|
|
674
|
+
const U = E.optionValue || "id";
|
|
675
|
+
s[E.field] = M[U] ?? M;
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
let b;
|
|
679
|
+
if (rt.value && Le.value) {
|
|
680
|
+
const E = Le.value[t.optionValue];
|
|
681
|
+
b = await d.update(t.endpoint, E, s);
|
|
682
|
+
const M = ae.value.findIndex((U) => U[t.optionValue] === E);
|
|
683
|
+
M !== -1 && (ae.value[M] = b.data), h.success("Registro atualizado com sucesso");
|
|
684
|
+
} else {
|
|
685
|
+
const E = ve();
|
|
686
|
+
for (const [M, U] of Object.entries(E)) {
|
|
687
|
+
const Ce = s[M];
|
|
688
|
+
(Ce == null || Ce === "") && (s[M] = U);
|
|
689
|
+
}
|
|
690
|
+
b = await d.create(t.endpoint, s), ae.value.unshift(b.data), $e.value++, h.success("Registro criado com sucesso");
|
|
691
|
+
}
|
|
692
|
+
Ye.value = !1, Le.value = null, re.value = t.multiple ? Y([...he.value, b.data]) : b.data;
|
|
693
|
+
} catch (s) {
|
|
694
|
+
h.error(kt(s, "Erro ao salvar registro"));
|
|
695
|
+
} finally {
|
|
696
|
+
st.value = !1;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
function Yt(s) {
|
|
700
|
+
V(async () => {
|
|
701
|
+
var b;
|
|
702
|
+
try {
|
|
703
|
+
const E = s[t.optionValue];
|
|
704
|
+
await d.delete(t.endpoint, E);
|
|
705
|
+
const M = ae.value.findIndex((U) => U[t.optionValue] === E);
|
|
706
|
+
M !== -1 && (ae.value.splice(M, 1), $e.value--), t.multiple ? (w.value.some((U) => U[t.optionValue] === E) && (w.value = w.value.filter((U) => U[t.optionValue] !== E), X()), re.value = he.value.filter((U) => U[t.optionValue] !== E)) : (x.value && x.value[t.optionValue] === E && (x.value = null, o("update:modelValue", null)), ((b = he.value[0]) == null ? void 0 : b[t.optionValue]) === E && (re.value = null)), h.success("Registro excluído com sucesso");
|
|
707
|
+
} catch (E) {
|
|
708
|
+
h.error(kt(E, "Erro ao excluir registro"));
|
|
709
|
+
}
|
|
710
|
+
});
|
|
711
|
+
}
|
|
712
|
+
return (s, b) => {
|
|
713
|
+
const E = Ft("tooltip");
|
|
714
|
+
return n(), m(te, null, [
|
|
715
|
+
f("div", Xt({
|
|
716
|
+
class: ["w-autocompletefk", { "w-autocompletefk-has-clear": Z.value }],
|
|
717
|
+
style: K.value
|
|
718
|
+
}, s.$attrs), [
|
|
719
|
+
P(u(Rt), {
|
|
720
|
+
ref_key: "acRef",
|
|
721
|
+
ref: ce,
|
|
722
|
+
"model-value": z.value,
|
|
723
|
+
suggestions: I.value,
|
|
724
|
+
multiple: e.multiple,
|
|
725
|
+
"option-label": e.optionLabel,
|
|
726
|
+
placeholder: pe.value,
|
|
727
|
+
disabled: e.disabled,
|
|
728
|
+
"force-selection": e.forceSelection,
|
|
729
|
+
loading: $.value,
|
|
730
|
+
"show-clear": !1,
|
|
731
|
+
fluid: "",
|
|
732
|
+
onComplete: p,
|
|
733
|
+
onItemSelect: g,
|
|
734
|
+
"onUpdate:modelValue": y,
|
|
735
|
+
onClear: l,
|
|
736
|
+
onKeydown: r
|
|
737
|
+
}, Je({ _: 2 }, [
|
|
738
|
+
e.multiple ? {
|
|
739
|
+
name: "chip",
|
|
740
|
+
fn: H(({ value: M, index: U, removeCallback: Ce }) => [
|
|
741
|
+
!e.maxChips || U < e.maxChips ? ue((n(), S(u(wt), {
|
|
742
|
+
key: 0,
|
|
743
|
+
class: "p-autocomplete-chip w-autocompletefk-chip",
|
|
744
|
+
label: R(M),
|
|
745
|
+
removable: "",
|
|
746
|
+
onClick: N,
|
|
747
|
+
onRemove: (Jt) => F(Jt, Ce)
|
|
748
|
+
}, null, 8, ["label", "onRemove"])), [
|
|
749
|
+
[
|
|
750
|
+
E,
|
|
751
|
+
R(M),
|
|
752
|
+
void 0,
|
|
753
|
+
{ top: !0 }
|
|
754
|
+
]
|
|
755
|
+
]) : U === e.maxChips ? ue((n(), S(u(wt), {
|
|
756
|
+
key: 1,
|
|
757
|
+
class: "p-autocomplete-chip w-autocompletefk-chip w-autocompletefk-chip-more",
|
|
758
|
+
label: `+${L.value}`,
|
|
759
|
+
onClick: N
|
|
760
|
+
}, null, 8, ["label"])), [
|
|
761
|
+
[
|
|
762
|
+
E,
|
|
763
|
+
W.value,
|
|
764
|
+
void 0,
|
|
765
|
+
{ top: !0 }
|
|
766
|
+
]
|
|
767
|
+
]) : (n(), m("span", Nl))
|
|
768
|
+
]),
|
|
769
|
+
key: "0"
|
|
770
|
+
} : void 0
|
|
771
|
+
]), 1032, ["model-value", "suggestions", "multiple", "option-label", "placeholder", "disabled", "force-selection", "loading"]),
|
|
772
|
+
Z.value ? ue((n(), m("button", {
|
|
773
|
+
key: 0,
|
|
774
|
+
type: "button",
|
|
775
|
+
"data-kbd-skip": "",
|
|
776
|
+
tabindex: "-1",
|
|
777
|
+
class: "w-autocompletefk-clear",
|
|
778
|
+
onClick: j
|
|
779
|
+
}, [...b[6] || (b[6] = [
|
|
780
|
+
f("i", { class: "pi pi-times" }, null, -1)
|
|
781
|
+
])])), [
|
|
782
|
+
[
|
|
783
|
+
E,
|
|
784
|
+
"Limpar",
|
|
785
|
+
void 0,
|
|
786
|
+
{ top: !0 }
|
|
787
|
+
]
|
|
788
|
+
]) : k("", !0),
|
|
789
|
+
ue((n(), m("button", {
|
|
790
|
+
type: "button",
|
|
791
|
+
disabled: e.disabled,
|
|
792
|
+
"data-kbd-skip": "",
|
|
793
|
+
tabindex: "-1",
|
|
794
|
+
class: "w-autocompletefk-trigger",
|
|
795
|
+
onClick: N
|
|
796
|
+
}, [...b[7] || (b[7] = [
|
|
797
|
+
f("i", { class: "pi pi-search" }, null, -1)
|
|
798
|
+
])], 8, Ol)), [
|
|
799
|
+
[
|
|
800
|
+
E,
|
|
801
|
+
"Pesquisar (F2)",
|
|
802
|
+
void 0,
|
|
803
|
+
{ top: !0 }
|
|
804
|
+
]
|
|
805
|
+
])
|
|
806
|
+
], 16),
|
|
807
|
+
P(u(nt), {
|
|
808
|
+
visible: C.value,
|
|
809
|
+
"onUpdate:visible": b[4] || (b[4] = (M) => C.value = M),
|
|
810
|
+
header: e.dialogHeader || "Pesquisar",
|
|
811
|
+
style: { width: "80vw" },
|
|
812
|
+
modal: "",
|
|
813
|
+
draggable: !1,
|
|
814
|
+
class: "w-autocompletefk-dialog",
|
|
815
|
+
onShow: _e
|
|
816
|
+
}, {
|
|
817
|
+
footer: H(() => [
|
|
818
|
+
f("div", ql, [
|
|
819
|
+
P(u(O), {
|
|
820
|
+
label: "Cancelar",
|
|
821
|
+
severity: "secondary",
|
|
822
|
+
text: "",
|
|
823
|
+
onClick: b[3] || (b[3] = (M) => C.value = !1)
|
|
824
|
+
}),
|
|
825
|
+
P(u(O), {
|
|
826
|
+
label: e.multiple && he.value.length ? `Selecionar (${he.value.length})` : "Selecionar",
|
|
827
|
+
icon: "pi pi-check",
|
|
828
|
+
disabled: !e.multiple && !he.value.length,
|
|
829
|
+
onClick: Ke
|
|
830
|
+
}, null, 8, ["label", "disabled"])
|
|
831
|
+
])
|
|
832
|
+
]),
|
|
833
|
+
default: H(() => [
|
|
834
|
+
f("div", zl, [
|
|
835
|
+
P(u(ze), { class: "w-autocompletefk-toolbar-search" }, {
|
|
836
|
+
default: H(() => [
|
|
837
|
+
P(u(We), { class: "pi pi-search" }),
|
|
838
|
+
P(u(de), {
|
|
839
|
+
ref_key: "modalSearchInput",
|
|
840
|
+
ref: He,
|
|
841
|
+
modelValue: oe.value,
|
|
842
|
+
"onUpdate:modelValue": b[0] || (b[0] = (M) => oe.value = M),
|
|
843
|
+
placeholder: "Pesquisar...",
|
|
844
|
+
class: "w-full",
|
|
845
|
+
autofocus: "",
|
|
846
|
+
onKeydown: Nt
|
|
847
|
+
}, null, 8, ["modelValue"])
|
|
848
|
+
]),
|
|
849
|
+
_: 1
|
|
850
|
+
}),
|
|
851
|
+
f("div", Wl, [
|
|
852
|
+
it.value ? (n(), S(u(O), {
|
|
853
|
+
key: 0,
|
|
854
|
+
label: "Novo",
|
|
855
|
+
icon: "pi pi-plus",
|
|
856
|
+
size: "small",
|
|
857
|
+
onClick: qt
|
|
858
|
+
})) : k("", !0)
|
|
859
|
+
])
|
|
860
|
+
]),
|
|
861
|
+
f("div", {
|
|
862
|
+
ref_key: "modalTableWrap",
|
|
863
|
+
ref: Ge,
|
|
864
|
+
onKeydownCapture: Ot
|
|
865
|
+
}, [
|
|
866
|
+
P(u(Pt), {
|
|
867
|
+
selection: re.value,
|
|
868
|
+
"onUpdate:selection": b[1] || (b[1] = (M) => re.value = M),
|
|
869
|
+
"meta-key-selection": !1,
|
|
870
|
+
value: ae.value,
|
|
871
|
+
loading: ee.value,
|
|
872
|
+
paginator: "",
|
|
873
|
+
lazy: "",
|
|
874
|
+
"striped-rows": "",
|
|
875
|
+
"removable-sort": "",
|
|
876
|
+
size: "small",
|
|
877
|
+
rows: ne.value,
|
|
878
|
+
"total-records": $e.value,
|
|
879
|
+
"sort-field": Re.value ?? void 0,
|
|
880
|
+
"sort-order": Pe.value,
|
|
881
|
+
"selection-mode": e.multiple ? "multiple" : "single",
|
|
882
|
+
"data-key": e.optionValue,
|
|
883
|
+
onPage: Q,
|
|
884
|
+
onSort: b[2] || (b[2] = (M) => xe({ sortField: M.sortField, sortOrder: M.sortOrder })),
|
|
885
|
+
onRowDblclick: Qe
|
|
886
|
+
}, {
|
|
887
|
+
empty: H(() => [...b[8] || (b[8] = [
|
|
888
|
+
f("div", { class: "w-autocompletefk-empty" }, "Nenhum registro encontrado", -1)
|
|
889
|
+
])]),
|
|
890
|
+
default: H(() => [
|
|
891
|
+
P(u(Oe), {
|
|
892
|
+
"selection-mode": e.multiple ? "multiple" : "single",
|
|
893
|
+
"header-style": "width: 3rem"
|
|
894
|
+
}, null, 8, ["selection-mode"]),
|
|
895
|
+
(n(!0), m(te, null, ie(v.value, (M) => (n(), S(u(Oe), {
|
|
896
|
+
key: M.field,
|
|
897
|
+
field: M.field,
|
|
898
|
+
header: M.header,
|
|
899
|
+
sortable: M.sortable ?? !0,
|
|
900
|
+
style: ye(M.style)
|
|
901
|
+
}, {
|
|
902
|
+
body: H(({ data: U }) => [
|
|
903
|
+
M.type ? (n(), S(ht, {
|
|
904
|
+
key: 0,
|
|
905
|
+
column: M,
|
|
906
|
+
value: U[M.field],
|
|
907
|
+
"row-data": U
|
|
908
|
+
}, null, 8, ["column", "value", "row-data"])) : (n(), m(te, { key: 1 }, [
|
|
909
|
+
Fe(A(U[M.field]), 1)
|
|
910
|
+
], 64))
|
|
911
|
+
]),
|
|
912
|
+
_: 2
|
|
913
|
+
}, 1032, ["field", "header", "sortable", "style"]))), 128)),
|
|
914
|
+
qe.value ? (n(), S(u(Oe), {
|
|
915
|
+
key: 0,
|
|
916
|
+
header: "",
|
|
917
|
+
style: { width: "6rem" }
|
|
918
|
+
}, {
|
|
919
|
+
body: H(({ data: M }) => [
|
|
920
|
+
f("div", jl, [
|
|
921
|
+
Ze.value ? ue((n(), S(u(O), {
|
|
922
|
+
key: 0,
|
|
923
|
+
icon: "pi pi-pencil",
|
|
924
|
+
text: "",
|
|
925
|
+
rounded: "",
|
|
926
|
+
size: "small",
|
|
927
|
+
onClick: (U) => Kt(M)
|
|
928
|
+
}, null, 8, ["onClick"])), [
|
|
929
|
+
[
|
|
930
|
+
E,
|
|
931
|
+
"Editar",
|
|
932
|
+
void 0,
|
|
933
|
+
{ top: !0 }
|
|
934
|
+
]
|
|
935
|
+
]) : k("", !0),
|
|
936
|
+
Me.value ? ue((n(), S(u(O), {
|
|
937
|
+
key: 1,
|
|
938
|
+
icon: "pi pi-trash",
|
|
939
|
+
text: "",
|
|
940
|
+
rounded: "",
|
|
941
|
+
size: "small",
|
|
942
|
+
severity: "danger",
|
|
943
|
+
onClick: (U) => Yt(M)
|
|
944
|
+
}, null, 8, ["onClick"])), [
|
|
945
|
+
[
|
|
946
|
+
E,
|
|
947
|
+
"Excluir",
|
|
948
|
+
void 0,
|
|
949
|
+
{ top: !0 }
|
|
950
|
+
]
|
|
951
|
+
]) : k("", !0)
|
|
952
|
+
])
|
|
953
|
+
]),
|
|
954
|
+
_: 1
|
|
955
|
+
})) : k("", !0)
|
|
956
|
+
]),
|
|
957
|
+
_: 1
|
|
958
|
+
}, 8, ["selection", "value", "loading", "rows", "total-records", "sort-field", "sort-order", "selection-mode", "data-key"])
|
|
959
|
+
], 544)
|
|
960
|
+
]),
|
|
961
|
+
_: 1
|
|
962
|
+
}, 8, ["visible", "header"]),
|
|
963
|
+
je.value ? (n(), S(Tt, {
|
|
964
|
+
key: 0,
|
|
965
|
+
visible: Ye.value,
|
|
966
|
+
title: zt.value,
|
|
967
|
+
fields: c.value,
|
|
968
|
+
"form-data": Ne,
|
|
969
|
+
"is-editing": rt.value,
|
|
970
|
+
saving: st.value,
|
|
971
|
+
width: e.dialogWidth,
|
|
972
|
+
"onUpdate:visible": b[5] || (b[5] = (M) => {
|
|
973
|
+
Ye.value = M, M || (Le.value = null);
|
|
974
|
+
}),
|
|
975
|
+
"onUpdate:field": Ht,
|
|
976
|
+
onSave: Gt
|
|
977
|
+
}, null, 8, ["visible", "title", "fields", "form-data", "is-editing", "saving", "width"])) : k("", !0)
|
|
978
|
+
], 64);
|
|
979
|
+
};
|
|
980
|
+
}
|
|
981
|
+
}), Hl = { class: "w-datepicker" }, Gl = { class: "w-datepicker-panel" }, Yl = { class: "w-datepicker-actions" }, St = /* @__PURE__ */ se({
|
|
982
|
+
__name: "WDatePicker",
|
|
983
|
+
props: {
|
|
984
|
+
modelValue: { default: null },
|
|
985
|
+
valueFormat: { default: "iso" },
|
|
986
|
+
showTime: { type: Boolean, default: !1 },
|
|
987
|
+
autonow: { type: Boolean, default: !1 },
|
|
988
|
+
minDate: {},
|
|
989
|
+
maxDate: {},
|
|
990
|
+
disabled: { type: Boolean, default: !1 },
|
|
991
|
+
showClear: { type: Boolean, default: !0 },
|
|
992
|
+
placeholder: {},
|
|
993
|
+
invalid: { type: Boolean, default: !1 },
|
|
994
|
+
inputId: {}
|
|
995
|
+
},
|
|
996
|
+
emits: ["update:modelValue"],
|
|
997
|
+
setup(e, { emit: a }) {
|
|
998
|
+
const t = e, o = a, i = sl({
|
|
999
|
+
showTime: () => t.showTime,
|
|
1000
|
+
valueFormat: () => t.valueFormat
|
|
1001
|
+
}), d = T(""), h = T(null), V = T(null), x = D(() => ({ mask: i.mask() })), w = D(() => i.toDate(t.minDate) ?? void 0), I = D(() => i.toDate(t.maxDate) ?? void 0);
|
|
1002
|
+
Ve(
|
|
1003
|
+
() => t.modelValue,
|
|
1004
|
+
(F) => {
|
|
1005
|
+
const j = i.toDate(F);
|
|
1006
|
+
h.value = j, d.value = i.toDisplay(j);
|
|
1007
|
+
},
|
|
1008
|
+
{ immediate: !0 }
|
|
1009
|
+
);
|
|
1010
|
+
function $(F) {
|
|
1011
|
+
o("update:modelValue", i.toValue(F));
|
|
1012
|
+
}
|
|
1013
|
+
function z() {
|
|
1014
|
+
if (d.value === "") {
|
|
1015
|
+
$(null);
|
|
1016
|
+
return;
|
|
1017
|
+
}
|
|
1018
|
+
const F = i.fromDisplay(d.value);
|
|
1019
|
+
F && $(F);
|
|
1020
|
+
}
|
|
1021
|
+
function G() {
|
|
1022
|
+
d.value = i.toDisplay(i.toDate(t.modelValue));
|
|
1023
|
+
}
|
|
1024
|
+
function Y(F) {
|
|
1025
|
+
F.key === "F2" && !t.disabled && (F.preventDefault(), R());
|
|
1026
|
+
}
|
|
1027
|
+
function X(F) {
|
|
1028
|
+
var K;
|
|
1029
|
+
$(F ?? null), t.showTime || (K = V.value) == null || K.hide();
|
|
1030
|
+
}
|
|
1031
|
+
function R() {
|
|
1032
|
+
$(i.today());
|
|
1033
|
+
}
|
|
1034
|
+
function L() {
|
|
1035
|
+
var F;
|
|
1036
|
+
$(null), (F = V.value) == null || F.hide();
|
|
1037
|
+
}
|
|
1038
|
+
function W(F) {
|
|
1039
|
+
var j;
|
|
1040
|
+
t.disabled || (j = V.value) == null || j.toggle(F);
|
|
1041
|
+
}
|
|
1042
|
+
return yt(() => {
|
|
1043
|
+
t.autonow && t.modelValue == null && R();
|
|
1044
|
+
}), (F, j) => (n(), m("div", Hl, [
|
|
1045
|
+
P(u(ze), null, {
|
|
1046
|
+
default: H(() => [
|
|
1047
|
+
ue(P(u(de), {
|
|
1048
|
+
id: e.inputId,
|
|
1049
|
+
modelValue: d.value,
|
|
1050
|
+
"onUpdate:modelValue": j[0] || (j[0] = (K) => d.value = K),
|
|
1051
|
+
placeholder: e.placeholder ?? u(i).placeholder(),
|
|
1052
|
+
disabled: e.disabled,
|
|
1053
|
+
invalid: e.invalid,
|
|
1054
|
+
fluid: "",
|
|
1055
|
+
autocomplete: "off",
|
|
1056
|
+
inputmode: "numeric",
|
|
1057
|
+
onInput: z,
|
|
1058
|
+
onBlur: G,
|
|
1059
|
+
onKeydown: Y
|
|
1060
|
+
}, null, 8, ["id", "modelValue", "placeholder", "disabled", "invalid"]), [
|
|
1061
|
+
[u(at), x.value]
|
|
1062
|
+
]),
|
|
1063
|
+
P(u(We), {
|
|
1064
|
+
class: le(["pi pi-calendar w-datepicker-icon", { "w-datepicker-icon-disabled": e.disabled }]),
|
|
1065
|
+
role: "button",
|
|
1066
|
+
tabindex: "-1",
|
|
1067
|
+
"aria-label": "Abrir calendário",
|
|
1068
|
+
onClick: W
|
|
1069
|
+
}, null, 8, ["class"])
|
|
1070
|
+
]),
|
|
1071
|
+
_: 1
|
|
1072
|
+
}),
|
|
1073
|
+
P(u(Mt), {
|
|
1074
|
+
ref_key: "op",
|
|
1075
|
+
ref: V
|
|
1076
|
+
}, {
|
|
1077
|
+
default: H(() => [
|
|
1078
|
+
f("div", Gl, [
|
|
1079
|
+
P(u(At), {
|
|
1080
|
+
"model-value": h.value ?? void 0,
|
|
1081
|
+
inline: "",
|
|
1082
|
+
"show-time": e.showTime,
|
|
1083
|
+
"hour-format": "24",
|
|
1084
|
+
"min-date": w.value,
|
|
1085
|
+
"max-date": I.value,
|
|
1086
|
+
"onUpdate:modelValue": X
|
|
1087
|
+
}, null, 8, ["model-value", "show-time", "min-date", "max-date"]),
|
|
1088
|
+
f("div", Yl, [
|
|
1089
|
+
P(u(O), {
|
|
1090
|
+
label: "Hoje",
|
|
1091
|
+
text: "",
|
|
1092
|
+
size: "small",
|
|
1093
|
+
onClick: R
|
|
1094
|
+
}),
|
|
1095
|
+
e.showClear ? (n(), S(u(O), {
|
|
1096
|
+
key: 0,
|
|
1097
|
+
label: "Limpar",
|
|
1098
|
+
text: "",
|
|
1099
|
+
size: "small",
|
|
1100
|
+
severity: "secondary",
|
|
1101
|
+
onClick: L
|
|
1102
|
+
})) : k("", !0)
|
|
1103
|
+
])
|
|
1104
|
+
])
|
|
1105
|
+
]),
|
|
1106
|
+
_: 1
|
|
1107
|
+
}, 512)
|
|
1108
|
+
]));
|
|
1109
|
+
}
|
|
1110
|
+
}), Jl = /* @__PURE__ */ se({
|
|
1111
|
+
__name: "WMoneyInput",
|
|
1112
|
+
props: {
|
|
1113
|
+
modelValue: {},
|
|
1114
|
+
decimals: { default: 2 },
|
|
1115
|
+
currency: { type: Boolean, default: !1 },
|
|
1116
|
+
prefix: {},
|
|
1117
|
+
suffix: {},
|
|
1118
|
+
locale: { default: "pt-BR" },
|
|
1119
|
+
disabled: { type: Boolean, default: !1 },
|
|
1120
|
+
placeholder: {},
|
|
1121
|
+
invalid: { type: Boolean }
|
|
1122
|
+
},
|
|
1123
|
+
emits: ["update:modelValue"],
|
|
1124
|
+
setup(e, { emit: a }) {
|
|
1125
|
+
const t = e, o = a, i = D(() => t.prefix ?? (t.currency ? "R$" : void 0)), d = D(() => !!i.value || !!t.suffix), h = D(() => {
|
|
1126
|
+
const x = t.modelValue;
|
|
1127
|
+
return x == null || Number.isNaN(x) ? "" : new Intl.NumberFormat(t.locale, {
|
|
1128
|
+
minimumFractionDigits: t.decimals,
|
|
1129
|
+
maximumFractionDigits: t.decimals
|
|
1130
|
+
}).format(x);
|
|
1131
|
+
});
|
|
1132
|
+
function V(x) {
|
|
1133
|
+
const w = x.target.value.replace(/\D/g, "");
|
|
1134
|
+
if (!w) {
|
|
1135
|
+
o("update:modelValue", null);
|
|
1136
|
+
return;
|
|
1137
|
+
}
|
|
1138
|
+
const I = Number(w) / Math.pow(10, t.decimals);
|
|
1139
|
+
o("update:modelValue", I);
|
|
1140
|
+
}
|
|
1141
|
+
return (x, w) => d.value ? (n(), S(u(vl), {
|
|
1142
|
+
key: 0,
|
|
1143
|
+
class: "w-money-input"
|
|
1144
|
+
}, {
|
|
1145
|
+
default: H(() => [
|
|
1146
|
+
i.value ? (n(), S(u($t), { key: 0 }, {
|
|
1147
|
+
default: H(() => [
|
|
1148
|
+
Fe(A(i.value), 1)
|
|
1149
|
+
]),
|
|
1150
|
+
_: 1
|
|
1151
|
+
})) : k("", !0),
|
|
1152
|
+
P(u(de), {
|
|
1153
|
+
"model-value": h.value,
|
|
1154
|
+
inputmode: "numeric",
|
|
1155
|
+
class: "w-money-input__field",
|
|
1156
|
+
placeholder: e.placeholder,
|
|
1157
|
+
disabled: e.disabled,
|
|
1158
|
+
invalid: e.invalid,
|
|
1159
|
+
onInput: V
|
|
1160
|
+
}, null, 8, ["model-value", "placeholder", "disabled", "invalid"]),
|
|
1161
|
+
e.suffix ? (n(), S(u($t), { key: 1 }, {
|
|
1162
|
+
default: H(() => [
|
|
1163
|
+
Fe(A(e.suffix), 1)
|
|
1164
|
+
]),
|
|
1165
|
+
_: 1
|
|
1166
|
+
})) : k("", !0)
|
|
1167
|
+
]),
|
|
1168
|
+
_: 1
|
|
1169
|
+
})) : (n(), S(u(de), {
|
|
1170
|
+
key: 1,
|
|
1171
|
+
"model-value": h.value,
|
|
1172
|
+
inputmode: "numeric",
|
|
1173
|
+
fluid: "",
|
|
1174
|
+
class: "w-money-input__field",
|
|
1175
|
+
placeholder: e.placeholder,
|
|
1176
|
+
disabled: e.disabled,
|
|
1177
|
+
invalid: e.invalid,
|
|
1178
|
+
onInput: V
|
|
1179
|
+
}, null, 8, ["model-value", "placeholder", "disabled", "invalid"]));
|
|
1180
|
+
}
|
|
1181
|
+
}), Xl = { class: "w-imgcropper" }, Zl = ["src"], Ql = { class: "w-imgcropper-actions" }, _l = ["accept"], ea = { class: "w-imgcropper-stage" }, ta = ["src"], la = { class: "w-imgcropper-zoom" }, lt = 300, aa = /* @__PURE__ */ se({
|
|
1182
|
+
__name: "WImageCropper",
|
|
1183
|
+
props: {
|
|
1184
|
+
modelValue: { default: null },
|
|
1185
|
+
accept: { default: "image/*" },
|
|
1186
|
+
maxSize: { default: 5242880 },
|
|
1187
|
+
aspectRatio: { default: 1 },
|
|
1188
|
+
circular: { type: Boolean, default: !1 },
|
|
1189
|
+
width: { default: 200 },
|
|
1190
|
+
height: { default: 200 }
|
|
1191
|
+
},
|
|
1192
|
+
emits: ["update:modelValue", "error"],
|
|
1193
|
+
setup(e, { emit: a }) {
|
|
1194
|
+
const t = e, o = a, i = T(null);
|
|
1195
|
+
Ve(
|
|
1196
|
+
() => t.modelValue,
|
|
1197
|
+
(g) => {
|
|
1198
|
+
i.value && (URL.revokeObjectURL(i.value), i.value = null), g instanceof File && (i.value = URL.createObjectURL(g));
|
|
1199
|
+
},
|
|
1200
|
+
{ immediate: !0 }
|
|
1201
|
+
), Zt(() => {
|
|
1202
|
+
i.value && URL.revokeObjectURL(i.value);
|
|
1203
|
+
});
|
|
1204
|
+
const d = D(() => t.modelValue instanceof File ? i.value : typeof t.modelValue == "string" && t.modelValue ? t.modelValue : null), h = T(null);
|
|
1205
|
+
function V() {
|
|
1206
|
+
var g;
|
|
1207
|
+
(g = h.value) == null || g.click();
|
|
1208
|
+
}
|
|
1209
|
+
function x(g) {
|
|
1210
|
+
const y = (t.accept || "").trim();
|
|
1211
|
+
return !y || y === "*" || y.includes("image/*") ? g.type.startsWith("image/") : y.split(",").map((l) => l.trim()).filter(Boolean).some((l) => l.endsWith("/*") ? g.type.startsWith(l.slice(0, -1)) : l.startsWith(".") ? g.name.toLowerCase().endsWith(l.toLowerCase()) : g.type === l);
|
|
1212
|
+
}
|
|
1213
|
+
let w = "image.png", I = "image/png", $ = null;
|
|
1214
|
+
function z(g) {
|
|
1215
|
+
var ae;
|
|
1216
|
+
const y = g.target, l = (ae = y.files) == null ? void 0 : ae[0];
|
|
1217
|
+
if (y.value = "", !l) return;
|
|
1218
|
+
if (!x(l)) {
|
|
1219
|
+
o("error", "Tipo de arquivo não suportado.");
|
|
1220
|
+
return;
|
|
1221
|
+
}
|
|
1222
|
+
if (l.size > t.maxSize) {
|
|
1223
|
+
o("error", `Imagem acima do limite de ${(t.maxSize / 1048576).toFixed(1)}MB.`);
|
|
1224
|
+
return;
|
|
1225
|
+
}
|
|
1226
|
+
w = l.name, I = l.type || "image/png";
|
|
1227
|
+
const C = new FileReader();
|
|
1228
|
+
C.onload = () => {
|
|
1229
|
+
const ee = new Image();
|
|
1230
|
+
ee.onload = () => {
|
|
1231
|
+
$ = ee, R.value = ee.naturalWidth, L.value = ee.naturalHeight, W.value = 1, X.value = ee.src, F.x = (K.value - ke.value) / 2, F.y = (Z.value - Se.value) / 2, Y.value = !0;
|
|
1232
|
+
}, ee.onerror = () => o("error", "Não foi possível carregar a imagem."), ee.src = String(C.result);
|
|
1233
|
+
}, C.onerror = () => o("error", "Falha ao ler o arquivo."), C.readAsDataURL(l);
|
|
1234
|
+
}
|
|
1235
|
+
function G() {
|
|
1236
|
+
o("update:modelValue", null);
|
|
1237
|
+
}
|
|
1238
|
+
const Y = T(!1), X = T(""), R = T(0), L = T(0), W = T(1), F = Ae({ x: 0, y: 0 }), j = D(() => t.circular ? 1 : t.aspectRatio || 1), K = D(() => j.value >= 1 ? lt : Math.round(lt * j.value)), Z = D(() => j.value >= 1 ? Math.round(lt / j.value) : lt), J = D(
|
|
1239
|
+
() => R.value && L.value ? Math.max(K.value / R.value, Z.value / L.value) : 1
|
|
1240
|
+
), ce = D(() => J.value * W.value), ke = D(() => R.value * ce.value), Se = D(() => L.value * ce.value);
|
|
1241
|
+
function me() {
|
|
1242
|
+
F.x = Math.min(0, Math.max(K.value - ke.value, F.x)), F.y = Math.min(0, Math.max(Z.value - Se.value, F.y));
|
|
1243
|
+
}
|
|
1244
|
+
Ve(W, me);
|
|
1245
|
+
const De = D(() => ({
|
|
1246
|
+
width: `${ke.value}px`,
|
|
1247
|
+
height: `${Se.value}px`,
|
|
1248
|
+
transform: `translate(${F.x}px, ${F.y}px)`
|
|
1249
|
+
})), ve = T(!1);
|
|
1250
|
+
let fe = { x: 0, y: 0, ox: 0, oy: 0 };
|
|
1251
|
+
function pe(g) {
|
|
1252
|
+
var y, l;
|
|
1253
|
+
ve.value = !0, (l = (y = g.currentTarget).setPointerCapture) == null || l.call(y, g.pointerId), fe = { x: g.clientX, y: g.clientY, ox: F.x, oy: F.y };
|
|
1254
|
+
}
|
|
1255
|
+
function ge(g) {
|
|
1256
|
+
ve.value && (F.x = fe.ox + (g.clientX - fe.x), F.y = fe.oy + (g.clientY - fe.y), me());
|
|
1257
|
+
}
|
|
1258
|
+
function we() {
|
|
1259
|
+
ve.value = !1;
|
|
1260
|
+
}
|
|
1261
|
+
function be() {
|
|
1262
|
+
return t.circular ? "image/png" : I === "image/jpeg" || I === "image/png" || I === "image/webp" ? I : "image/png";
|
|
1263
|
+
}
|
|
1264
|
+
function Ee(g) {
|
|
1265
|
+
const y = g === "image/png" ? "png" : g === "image/webp" ? "webp" : "jpg";
|
|
1266
|
+
return `${w.replace(/\.[^.]+$/, "") || "image"}.${y}`;
|
|
1267
|
+
}
|
|
1268
|
+
function p() {
|
|
1269
|
+
if (!$) return;
|
|
1270
|
+
const g = ce.value, y = -F.x / g, l = -F.y / g, C = K.value / g, ae = Z.value / g, ee = document.createElement("canvas");
|
|
1271
|
+
ee.width = Math.max(1, Math.round(C)), ee.height = Math.max(1, Math.round(ae));
|
|
1272
|
+
const oe = ee.getContext("2d");
|
|
1273
|
+
if (!oe) {
|
|
1274
|
+
o("error", "Canvas indisponível neste ambiente.");
|
|
1275
|
+
return;
|
|
1276
|
+
}
|
|
1277
|
+
t.circular && (oe.beginPath(), oe.ellipse(
|
|
1278
|
+
ee.width / 2,
|
|
1279
|
+
ee.height / 2,
|
|
1280
|
+
ee.width / 2,
|
|
1281
|
+
ee.height / 2,
|
|
1282
|
+
0,
|
|
1283
|
+
0,
|
|
1284
|
+
Math.PI * 2
|
|
1285
|
+
), oe.clip()), oe.drawImage($, y, l, C, ae, 0, 0, ee.width, ee.height);
|
|
1286
|
+
const _ = be();
|
|
1287
|
+
ee.toBlob(
|
|
1288
|
+
(ne) => {
|
|
1289
|
+
if (!ne) {
|
|
1290
|
+
o("error", "Falha ao processar a imagem.");
|
|
1291
|
+
return;
|
|
1292
|
+
}
|
|
1293
|
+
o("update:modelValue", new File([ne], Ee(_), { type: _ })), Y.value = !1;
|
|
1294
|
+
},
|
|
1295
|
+
_,
|
|
1296
|
+
0.92
|
|
1297
|
+
);
|
|
1298
|
+
}
|
|
1299
|
+
return (g, y) => (n(), m("div", Xl, [
|
|
1300
|
+
f("div", {
|
|
1301
|
+
class: le(["w-imgcropper-preview", { "is-circular": e.circular, "is-empty": !d.value }]),
|
|
1302
|
+
style: ye({ width: `${e.width}px`, height: `${e.height}px` })
|
|
1303
|
+
}, [
|
|
1304
|
+
d.value ? (n(), m(te, { key: 0 }, [
|
|
1305
|
+
f("img", {
|
|
1306
|
+
src: d.value,
|
|
1307
|
+
alt: "",
|
|
1308
|
+
class: "w-imgcropper-img"
|
|
1309
|
+
}, null, 8, Zl),
|
|
1310
|
+
f("div", Ql, [
|
|
1311
|
+
P(u(O), {
|
|
1312
|
+
type: "button",
|
|
1313
|
+
icon: "pi pi-pencil",
|
|
1314
|
+
rounded: "",
|
|
1315
|
+
text: "",
|
|
1316
|
+
"aria-label": "Trocar imagem",
|
|
1317
|
+
onClick: V
|
|
1318
|
+
}),
|
|
1319
|
+
P(u(O), {
|
|
1320
|
+
type: "button",
|
|
1321
|
+
icon: "pi pi-trash",
|
|
1322
|
+
rounded: "",
|
|
1323
|
+
text: "",
|
|
1324
|
+
severity: "danger",
|
|
1325
|
+
"aria-label": "Remover imagem",
|
|
1326
|
+
onClick: G
|
|
1327
|
+
})
|
|
1328
|
+
])
|
|
1329
|
+
], 64)) : B(g.$slots, "placeholder", { open: V }, () => [
|
|
1330
|
+
f("button", {
|
|
1331
|
+
type: "button",
|
|
1332
|
+
class: "w-imgcropper-empty",
|
|
1333
|
+
onClick: V
|
|
1334
|
+
}, [...y[3] || (y[3] = [
|
|
1335
|
+
f("i", { class: "pi pi-image" }, null, -1),
|
|
1336
|
+
f("span", null, "Selecionar imagem", -1)
|
|
1337
|
+
])])
|
|
1338
|
+
], !0, 1)
|
|
1339
|
+
], 6),
|
|
1340
|
+
f("input", {
|
|
1341
|
+
ref_key: "fileInput",
|
|
1342
|
+
ref: h,
|
|
1343
|
+
type: "file",
|
|
1344
|
+
accept: e.accept,
|
|
1345
|
+
class: "w-imgcropper-file",
|
|
1346
|
+
onChange: z
|
|
1347
|
+
}, null, 40, _l),
|
|
1348
|
+
P(u(nt), {
|
|
1349
|
+
visible: Y.value,
|
|
1350
|
+
"onUpdate:visible": y[2] || (y[2] = (l) => Y.value = l),
|
|
1351
|
+
modal: "",
|
|
1352
|
+
header: "Ajustar imagem",
|
|
1353
|
+
"dismissable-mask": !1,
|
|
1354
|
+
style: { width: "auto" }
|
|
1355
|
+
}, {
|
|
1356
|
+
footer: H(() => [
|
|
1357
|
+
P(u(O), {
|
|
1358
|
+
type: "button",
|
|
1359
|
+
label: "Cancelar",
|
|
1360
|
+
text: "",
|
|
1361
|
+
onClick: y[1] || (y[1] = (l) => Y.value = !1)
|
|
1362
|
+
}),
|
|
1363
|
+
P(u(O), {
|
|
1364
|
+
type: "button",
|
|
1365
|
+
label: "Confirmar",
|
|
1366
|
+
onClick: p
|
|
1367
|
+
})
|
|
1368
|
+
]),
|
|
1369
|
+
default: H(() => [
|
|
1370
|
+
f("div", ea, [
|
|
1371
|
+
f("div", {
|
|
1372
|
+
class: le(["w-imgcropper-viewport", { "is-circular": e.circular }]),
|
|
1373
|
+
style: ye({ width: `${K.value}px`, height: `${Z.value}px` }),
|
|
1374
|
+
onPointerdown: pe,
|
|
1375
|
+
onPointermove: ge,
|
|
1376
|
+
onPointerup: we,
|
|
1377
|
+
onPointerleave: we
|
|
1378
|
+
}, [
|
|
1379
|
+
X.value ? (n(), m("img", {
|
|
1380
|
+
key: 0,
|
|
1381
|
+
src: X.value,
|
|
1382
|
+
alt: "",
|
|
1383
|
+
class: "w-imgcropper-cropimg",
|
|
1384
|
+
style: ye(De.value),
|
|
1385
|
+
draggable: "false"
|
|
1386
|
+
}, null, 12, ta)) : k("", !0),
|
|
1387
|
+
f("div", {
|
|
1388
|
+
class: le(["w-imgcropper-stencil", { "is-circular": e.circular }])
|
|
1389
|
+
}, null, 2)
|
|
1390
|
+
], 38),
|
|
1391
|
+
f("div", la, [
|
|
1392
|
+
y[4] || (y[4] = f("i", { class: "pi pi-search-minus" }, null, -1)),
|
|
1393
|
+
P(u(pl), {
|
|
1394
|
+
modelValue: W.value,
|
|
1395
|
+
"onUpdate:modelValue": y[0] || (y[0] = (l) => W.value = l),
|
|
1396
|
+
min: 1,
|
|
1397
|
+
max: 4,
|
|
1398
|
+
step: 0.01,
|
|
1399
|
+
class: "w-imgcropper-slider"
|
|
1400
|
+
}, null, 8, ["modelValue"]),
|
|
1401
|
+
y[5] || (y[5] = f("i", { class: "pi pi-search-plus" }, null, -1))
|
|
1402
|
+
])
|
|
1403
|
+
])
|
|
1404
|
+
]),
|
|
1405
|
+
_: 1
|
|
1406
|
+
}, 8, ["visible"])
|
|
1407
|
+
]));
|
|
1408
|
+
}
|
|
1409
|
+
}), oa = (e, a) => {
|
|
1410
|
+
const t = e.__vccOpts || e;
|
|
1411
|
+
for (const [o, i] of a)
|
|
1412
|
+
t[o] = i;
|
|
1413
|
+
return t;
|
|
1414
|
+
}, na = /* @__PURE__ */ oa(aa, [["__scopeId", "data-v-95684d2d"]]), ia = { class: "w-transfer__pane" }, sa = { class: "w-transfer__head" }, ra = { class: "w-transfer__count" }, ua = { class: "w-transfer__list" }, da = ["onClick"], ca = {
|
|
1415
|
+
key: 0,
|
|
1416
|
+
class: "w-transfer__empty"
|
|
1417
|
+
}, ma = { class: "w-transfer__controls" }, fa = { class: "w-transfer__pane" }, va = { class: "w-transfer__head" }, pa = { class: "w-transfer__count" }, ha = { class: "w-transfer__list" }, ya = ["onClick"], ga = {
|
|
1418
|
+
key: 0,
|
|
1419
|
+
class: "w-transfer__empty"
|
|
1420
|
+
}, ba = /* @__PURE__ */ se({
|
|
1421
|
+
__name: "WTransferList",
|
|
1422
|
+
props: {
|
|
1423
|
+
source: {},
|
|
1424
|
+
selected: { default: () => [] },
|
|
1425
|
+
trackBy: { default: "id" },
|
|
1426
|
+
optionLabel: { default: "nome" },
|
|
1427
|
+
searchFields: {},
|
|
1428
|
+
disabled: { type: Boolean }
|
|
1429
|
+
},
|
|
1430
|
+
emits: ["update:selected"],
|
|
1431
|
+
setup(e, { emit: a }) {
|
|
1432
|
+
const t = e, o = a, i = T(""), d = T(""), h = D(() => new Set(t.selected)), V = D(() => t.searchFields ?? [t.optionLabel]);
|
|
1433
|
+
function x(L) {
|
|
1434
|
+
return L[t.trackBy];
|
|
1435
|
+
}
|
|
1436
|
+
function w(L) {
|
|
1437
|
+
return String(L[t.optionLabel] ?? "");
|
|
1438
|
+
}
|
|
1439
|
+
function I(L, W) {
|
|
1440
|
+
if (!W) return !0;
|
|
1441
|
+
const F = W.toLowerCase();
|
|
1442
|
+
return V.value.some(
|
|
1443
|
+
(j) => String(L[j] ?? "").toLowerCase().includes(F)
|
|
1444
|
+
);
|
|
1445
|
+
}
|
|
1446
|
+
const $ = D(
|
|
1447
|
+
() => t.source.filter((L) => !h.value.has(x(L)) && I(L, i.value))
|
|
1448
|
+
), z = D(
|
|
1449
|
+
() => t.source.filter((L) => h.value.has(x(L)) && I(L, d.value))
|
|
1450
|
+
);
|
|
1451
|
+
function G(L) {
|
|
1452
|
+
t.disabled || o("update:selected", [...t.selected, x(L)]);
|
|
1453
|
+
}
|
|
1454
|
+
function Y(L) {
|
|
1455
|
+
if (t.disabled) return;
|
|
1456
|
+
const W = x(L);
|
|
1457
|
+
o(
|
|
1458
|
+
"update:selected",
|
|
1459
|
+
t.selected.filter((F) => F !== W)
|
|
1460
|
+
);
|
|
1461
|
+
}
|
|
1462
|
+
function X() {
|
|
1463
|
+
t.disabled || o("update:selected", t.source.map(x));
|
|
1464
|
+
}
|
|
1465
|
+
function R() {
|
|
1466
|
+
t.disabled || o("update:selected", []);
|
|
1467
|
+
}
|
|
1468
|
+
return (L, W) => (n(), m("div", {
|
|
1469
|
+
class: le(["w-transfer", { "w-transfer--disabled": e.disabled }])
|
|
1470
|
+
}, [
|
|
1471
|
+
f("div", ia, [
|
|
1472
|
+
f("div", sa, [
|
|
1473
|
+
W[2] || (W[2] = f("span", { class: "w-transfer__title" }, "Disponíveis", -1)),
|
|
1474
|
+
f("span", ra, A($.value.length), 1)
|
|
1475
|
+
]),
|
|
1476
|
+
P(u(ze), { class: "w-transfer__search" }, {
|
|
1477
|
+
default: H(() => [
|
|
1478
|
+
P(u(We), { class: "pi pi-search" }),
|
|
1479
|
+
P(u(de), {
|
|
1480
|
+
modelValue: i.value,
|
|
1481
|
+
"onUpdate:modelValue": W[0] || (W[0] = (F) => i.value = F),
|
|
1482
|
+
placeholder: "Buscar...",
|
|
1483
|
+
fluid: ""
|
|
1484
|
+
}, null, 8, ["modelValue"])
|
|
1485
|
+
]),
|
|
1486
|
+
_: 1
|
|
1487
|
+
}),
|
|
1488
|
+
f("ul", ua, [
|
|
1489
|
+
(n(!0), m(te, null, ie($.value, (F) => (n(), m("li", {
|
|
1490
|
+
key: `a-${x(F)}`,
|
|
1491
|
+
class: "w-transfer__item",
|
|
1492
|
+
onClick: (j) => G(F)
|
|
1493
|
+
}, [
|
|
1494
|
+
f("span", null, A(w(F)), 1),
|
|
1495
|
+
W[3] || (W[3] = f("i", { class: "pi pi-angle-right" }, null, -1))
|
|
1496
|
+
], 8, da))), 128)),
|
|
1497
|
+
$.value.length ? k("", !0) : (n(), m("li", ca, "Nenhum item"))
|
|
1498
|
+
])
|
|
1499
|
+
]),
|
|
1500
|
+
f("div", ma, [
|
|
1501
|
+
P(u(O), {
|
|
1502
|
+
type: "button",
|
|
1503
|
+
icon: "pi pi-angle-double-right",
|
|
1504
|
+
text: "",
|
|
1505
|
+
rounded: "",
|
|
1506
|
+
disabled: e.disabled || !$.value.length,
|
|
1507
|
+
onClick: X
|
|
1508
|
+
}, null, 8, ["disabled"]),
|
|
1509
|
+
P(u(O), {
|
|
1510
|
+
type: "button",
|
|
1511
|
+
icon: "pi pi-angle-double-left",
|
|
1512
|
+
text: "",
|
|
1513
|
+
rounded: "",
|
|
1514
|
+
disabled: e.disabled || !e.selected.length,
|
|
1515
|
+
onClick: R
|
|
1516
|
+
}, null, 8, ["disabled"])
|
|
1517
|
+
]),
|
|
1518
|
+
f("div", fa, [
|
|
1519
|
+
f("div", va, [
|
|
1520
|
+
W[4] || (W[4] = f("span", { class: "w-transfer__title" }, "Selecionados", -1)),
|
|
1521
|
+
f("span", pa, A(z.value.length), 1)
|
|
1522
|
+
]),
|
|
1523
|
+
P(u(ze), { class: "w-transfer__search" }, {
|
|
1524
|
+
default: H(() => [
|
|
1525
|
+
P(u(We), { class: "pi pi-search" }),
|
|
1526
|
+
P(u(de), {
|
|
1527
|
+
modelValue: d.value,
|
|
1528
|
+
"onUpdate:modelValue": W[1] || (W[1] = (F) => d.value = F),
|
|
1529
|
+
placeholder: "Buscar...",
|
|
1530
|
+
fluid: ""
|
|
1531
|
+
}, null, 8, ["modelValue"])
|
|
1532
|
+
]),
|
|
1533
|
+
_: 1
|
|
1534
|
+
}),
|
|
1535
|
+
f("ul", ha, [
|
|
1536
|
+
(n(!0), m(te, null, ie(z.value, (F) => (n(), m("li", {
|
|
1537
|
+
key: `s-${x(F)}`,
|
|
1538
|
+
class: "w-transfer__item",
|
|
1539
|
+
onClick: (j) => Y(F)
|
|
1540
|
+
}, [
|
|
1541
|
+
W[5] || (W[5] = f("i", { class: "pi pi-angle-left" }, null, -1)),
|
|
1542
|
+
f("span", null, A(w(F)), 1)
|
|
1543
|
+
], 8, ya))), 128)),
|
|
1544
|
+
z.value.length ? k("", !0) : (n(), m("li", ga, "Nenhum item"))
|
|
1545
|
+
])
|
|
1546
|
+
])
|
|
1547
|
+
], 2));
|
|
1548
|
+
}
|
|
1549
|
+
});
|
|
1550
|
+
async function ka(e) {
|
|
1551
|
+
const a = e.replace(/\D/g, "");
|
|
1552
|
+
if (a.length !== 8) return null;
|
|
1553
|
+
try {
|
|
1554
|
+
const t = await fetch(`https://viacep.com.br/ws/${a}/json/`);
|
|
1555
|
+
if (!t.ok) return null;
|
|
1556
|
+
const o = await t.json();
|
|
1557
|
+
return o.erro ? null : o;
|
|
1558
|
+
} catch {
|
|
1559
|
+
return null;
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
const wa = { class: "w-crud-form" }, $a = {
|
|
1563
|
+
key: 0,
|
|
1564
|
+
class: "w-crud-form-group-header"
|
|
1565
|
+
}, xa = { class: "w-crud-form-group-title" }, Ca = {
|
|
1566
|
+
key: 0,
|
|
1567
|
+
class: "w-crud-form-group-desc"
|
|
1568
|
+
}, Va = { class: "w-crud-form-switch-label" }, Sa = { class: "w-crud-form-label" }, Da = {
|
|
1569
|
+
key: 0,
|
|
1570
|
+
class: "w-crud-form-required"
|
|
1571
|
+
}, Ea = { class: "w-crud-form-color-row" }, Fa = { class: "w-crud-form-label" }, Pa = {
|
|
1572
|
+
key: 0,
|
|
1573
|
+
class: "w-crud-form-error"
|
|
1574
|
+
}, Ma = { class: "w-crud-form-label" }, Ia = {
|
|
1575
|
+
key: 0,
|
|
1576
|
+
class: "w-crud-form-required"
|
|
1577
|
+
}, Ra = { class: "w-crud-form-label" }, Aa = {
|
|
1578
|
+
key: 0,
|
|
1579
|
+
class: "w-crud-form-required"
|
|
1580
|
+
}, Ba = {
|
|
1581
|
+
key: 1,
|
|
1582
|
+
class: "pi pi-spin pi-spinner w-crud-form-cep-spinner"
|
|
1583
|
+
}, Ua = {
|
|
1584
|
+
key: 16,
|
|
1585
|
+
class: "w-crud-form-cep-error"
|
|
1586
|
+
}, Ta = {
|
|
1587
|
+
key: 17,
|
|
1588
|
+
class: "w-crud-form-error"
|
|
1589
|
+
}, La = /* @__PURE__ */ se({
|
|
1590
|
+
__name: "WFormRenderer",
|
|
1591
|
+
props: {
|
|
1592
|
+
fields: {},
|
|
1593
|
+
formData: {},
|
|
1594
|
+
isEditing: { type: Boolean },
|
|
1595
|
+
disabled: { type: Boolean, default: !1 },
|
|
1596
|
+
columns: { default: 2 }
|
|
1597
|
+
},
|
|
1598
|
+
emits: ["update:field"],
|
|
1599
|
+
setup(e, { expose: a, emit: t }) {
|
|
1600
|
+
const o = e, i = t, d = Ae({}), h = Ae({}), V = Ae({}), x = Ae({});
|
|
1601
|
+
function w(p, g) {
|
|
1602
|
+
const y = g.target.value, l = y.replace(/\D/g, "");
|
|
1603
|
+
i("update:field", p.field, y), V[p.field] = null, x[p.field] && (clearTimeout(x[p.field]), x[p.field] = null), l.length === 8 && (x[p.field] = setTimeout(async () => {
|
|
1604
|
+
h[p.field] = !0, V[p.field] = null;
|
|
1605
|
+
try {
|
|
1606
|
+
const C = await ka(l);
|
|
1607
|
+
if (!C)
|
|
1608
|
+
V[p.field] = "CEP não encontrado. Preencha os campos manualmente.";
|
|
1609
|
+
else {
|
|
1610
|
+
const ae = p.cepFields || {}, ee = Object.keys(ae);
|
|
1611
|
+
for (const oe of ee) {
|
|
1612
|
+
const _ = ae[oe];
|
|
1613
|
+
if (!_) continue;
|
|
1614
|
+
const ne = o.formData[_];
|
|
1615
|
+
(ne == null || ne === "") && i("update:field", _, C[oe] ?? "");
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
} finally {
|
|
1619
|
+
h[p.field] = !1;
|
|
1620
|
+
}
|
|
1621
|
+
}, 400));
|
|
1622
|
+
}
|
|
1623
|
+
const I = D(
|
|
1624
|
+
() => o.fields.filter((p) => p.visible === void 0 || p.visible === !0 ? !0 : typeof p.visible == "function" ? p.visible(o.formData, o.isEditing) : p.visible)
|
|
1625
|
+
);
|
|
1626
|
+
function $(p) {
|
|
1627
|
+
return o.disabled || p.readonly || p.computed || p.disabledOnEdit && o.isEditing ? !0 : typeof p.disabled == "function" ? p.disabled(o.formData, o.isEditing) : !!p.disabled;
|
|
1628
|
+
}
|
|
1629
|
+
function z(p) {
|
|
1630
|
+
const g = p.endpointParams;
|
|
1631
|
+
return typeof g == "function" ? g() : g;
|
|
1632
|
+
}
|
|
1633
|
+
const G = D(
|
|
1634
|
+
() => o.fields.filter((p) => typeof p.calculate == "function")
|
|
1635
|
+
);
|
|
1636
|
+
Ve(
|
|
1637
|
+
() => G.value.map((p) => p.calculate(o.formData, o.isEditing)),
|
|
1638
|
+
(p) => {
|
|
1639
|
+
G.value.forEach((g, y) => {
|
|
1640
|
+
o.formData[g.field] !== p[y] && i("update:field", g.field, p[y]);
|
|
1641
|
+
});
|
|
1642
|
+
},
|
|
1643
|
+
{ immediate: !0 }
|
|
1644
|
+
);
|
|
1645
|
+
function Y(p) {
|
|
1646
|
+
return Qt(p) ? p.value : p;
|
|
1647
|
+
}
|
|
1648
|
+
const X = D(() => {
|
|
1649
|
+
const p = o.isEditing ? "edit" : "create", g = o.fields.find((l) => l.autofocus === !0 || l.autofocus === p);
|
|
1650
|
+
if (g) return g.field;
|
|
1651
|
+
const y = I.value.find((l) => !(l.type === "switch" || l.type === "fk" || l.type === "select" || l.type === "image" || l.disabled === !0 || l.disabledOnEdit && o.isEditing));
|
|
1652
|
+
return (y == null ? void 0 : y.field) ?? null;
|
|
1653
|
+
});
|
|
1654
|
+
function R(p) {
|
|
1655
|
+
return p.field === X.value;
|
|
1656
|
+
}
|
|
1657
|
+
function L(p) {
|
|
1658
|
+
if (p)
|
|
1659
|
+
return p.replace(/9/g, "#").replace(/a/g, "S").replace(/\*/g, "X");
|
|
1660
|
+
}
|
|
1661
|
+
function W(p) {
|
|
1662
|
+
if (!p) return "";
|
|
1663
|
+
const g = String(p).replace(/\D/g, "").slice(0, 14);
|
|
1664
|
+
return g.length <= 11 ? g.replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d{1,2})$/, "$1-$2") : g.replace(/(\d{2})(\d)/, "$1.$2").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d)/, "$1/$2").replace(/(\d{4})(\d{1,2})$/, "$1-$2");
|
|
1665
|
+
}
|
|
1666
|
+
function F(p, g) {
|
|
1667
|
+
const y = g.target.value.replace(/\D/g, "").slice(0, 14);
|
|
1668
|
+
i("update:field", p, y);
|
|
1669
|
+
}
|
|
1670
|
+
const j = Ae({});
|
|
1671
|
+
function K(p) {
|
|
1672
|
+
const g = o.formData[p.field];
|
|
1673
|
+
if (g == null) return null;
|
|
1674
|
+
const y = p.optionValue || "value";
|
|
1675
|
+
return (Y(p.options) || []).find((C) => C[y] === g) ?? null;
|
|
1676
|
+
}
|
|
1677
|
+
function Z(p) {
|
|
1678
|
+
return j[p.field] || [];
|
|
1679
|
+
}
|
|
1680
|
+
function J(p, g) {
|
|
1681
|
+
const y = (g.query || "").toLowerCase(), l = Y(p.options) || [], C = p.optionLabel || "label";
|
|
1682
|
+
j[p.field] = l.filter(
|
|
1683
|
+
(ae) => String(ae[C] || "").toLowerCase().includes(y)
|
|
1684
|
+
);
|
|
1685
|
+
}
|
|
1686
|
+
function ce(p, g) {
|
|
1687
|
+
const y = p.optionValue || "value";
|
|
1688
|
+
i("update:field", p.field, g.value[y]);
|
|
1689
|
+
}
|
|
1690
|
+
function ke(p) {
|
|
1691
|
+
const g = o.formData[p.field];
|
|
1692
|
+
return g ? String(g).replace("#", "") : "FFFFFF";
|
|
1693
|
+
}
|
|
1694
|
+
function Se(p, g) {
|
|
1695
|
+
i("update:field", p.field, `#${g}`);
|
|
1696
|
+
}
|
|
1697
|
+
function me(p) {
|
|
1698
|
+
const g = p.dependsOn;
|
|
1699
|
+
return g ? (Array.isArray(g) ? g : [g]).map((l) => ({
|
|
1700
|
+
field: l.param || l.field,
|
|
1701
|
+
value: o.formData[l.field],
|
|
1702
|
+
required: l.required
|
|
1703
|
+
})) : void 0;
|
|
1704
|
+
}
|
|
1705
|
+
function De(p) {
|
|
1706
|
+
if (typeof p.validate == "function") {
|
|
1707
|
+
const g = p.validate(o.formData[p.field]);
|
|
1708
|
+
d[p.field] = g || null;
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
function ve() {
|
|
1712
|
+
const p = [];
|
|
1713
|
+
for (const g of o.fields)
|
|
1714
|
+
if (typeof g.validate == "function") {
|
|
1715
|
+
const y = g.validate(o.formData[g.field]);
|
|
1716
|
+
d[g.field] = y || null, y && p.push(y);
|
|
1717
|
+
}
|
|
1718
|
+
return p;
|
|
1719
|
+
}
|
|
1720
|
+
function fe() {
|
|
1721
|
+
Object.keys(d).forEach((p) => delete d[p]);
|
|
1722
|
+
}
|
|
1723
|
+
function pe(p) {
|
|
1724
|
+
return Math.max(1, Math.floor(p.columns ?? o.columns));
|
|
1725
|
+
}
|
|
1726
|
+
function ge(p, g) {
|
|
1727
|
+
const y = p.colSpan;
|
|
1728
|
+
return y == null || y === "full" ? g : y === 0.5 ? Math.max(1, Math.round(g / 2)) : Math.min(Math.max(1, Math.floor(y)), g);
|
|
1729
|
+
}
|
|
1730
|
+
function we(p, g) {
|
|
1731
|
+
return { "--w-col-span": ge(p, pe(g)) };
|
|
1732
|
+
}
|
|
1733
|
+
function be(p, g) {
|
|
1734
|
+
return ge(p, pe(g)) === pe(g) ? "w-crud-form-col-full" : "w-crud-form-col-half";
|
|
1735
|
+
}
|
|
1736
|
+
const Ee = D(() => {
|
|
1737
|
+
var l, C, ae, ee, oe;
|
|
1738
|
+
const p = /* @__PURE__ */ new Map(), g = [], y = /* @__PURE__ */ new Map();
|
|
1739
|
+
for (const _ of I.value) {
|
|
1740
|
+
const ne = ((l = _.fieldGroup) == null ? void 0 : l.id) ?? "__default__";
|
|
1741
|
+
p.has(ne) || (p.set(ne, {
|
|
1742
|
+
id: ne,
|
|
1743
|
+
title: (C = _.fieldGroup) == null ? void 0 : C.title,
|
|
1744
|
+
description: (ae = _.fieldGroup) == null ? void 0 : ae.description,
|
|
1745
|
+
columns: (ee = _.fieldGroup) == null ? void 0 : ee.columns,
|
|
1746
|
+
fields: []
|
|
1747
|
+
}), g.push(ne), ((oe = _.fieldGroup) == null ? void 0 : oe.order) != null && y.set(ne, _.fieldGroup.order)), p.get(ne).fields.push(_);
|
|
1748
|
+
}
|
|
1749
|
+
return g.slice().sort((_, ne) => {
|
|
1750
|
+
const $e = y.get(_), re = y.get(ne);
|
|
1751
|
+
return $e != null && re != null ? $e - re : $e != null ? -1 : re != null ? 1 : g.indexOf(_) - g.indexOf(ne);
|
|
1752
|
+
}).map((_) => p.get(_));
|
|
1753
|
+
});
|
|
1754
|
+
return a({ validateAll: ve, clearErrors: fe }), (p, g) => (n(), m("div", wa, [
|
|
1755
|
+
(n(!0), m(te, null, ie(Ee.value, (y) => (n(), m("div", {
|
|
1756
|
+
key: y.id,
|
|
1757
|
+
class: "w-crud-form-group"
|
|
1758
|
+
}, [
|
|
1759
|
+
y.title ? (n(), m("div", $a, [
|
|
1760
|
+
f("h3", xa, A(y.title), 1),
|
|
1761
|
+
y.description ? (n(), m("p", Ca, A(y.description), 1)) : k("", !0)
|
|
1762
|
+
])) : k("", !0),
|
|
1763
|
+
f("div", {
|
|
1764
|
+
class: "w-crud-form-fields",
|
|
1765
|
+
style: ye({ "--w-form-cols": pe(y) })
|
|
1766
|
+
}, [
|
|
1767
|
+
(n(!0), m(te, null, ie(y.fields, (l) => B(p.$slots, `field-${l.field}`, {
|
|
1768
|
+
field: l,
|
|
1769
|
+
formData: e.formData,
|
|
1770
|
+
isEditing: e.isEditing,
|
|
1771
|
+
setFormField: (C, ae) => i("update:field", C, ae)
|
|
1772
|
+
}, () => [
|
|
1773
|
+
l.type === "switch" ? (n(), m("div", {
|
|
1774
|
+
key: 0,
|
|
1775
|
+
class: "w-crud-form-switch",
|
|
1776
|
+
style: ye(we(l, y))
|
|
1777
|
+
}, [
|
|
1778
|
+
P(u(dl), {
|
|
1779
|
+
"model-value": e.formData[l.field],
|
|
1780
|
+
disabled: $(l),
|
|
1781
|
+
"onUpdate:modelValue": (C) => i("update:field", l.field, C)
|
|
1782
|
+
}, null, 8, ["model-value", "disabled", "onUpdate:modelValue"]),
|
|
1783
|
+
f("label", Va, A(l.switchLabel || l.label), 1)
|
|
1784
|
+
], 4)) : l.type === "color" ? (n(), m("div", {
|
|
1785
|
+
key: 1,
|
|
1786
|
+
class: le(be(l, y)),
|
|
1787
|
+
style: ye(we(l, y))
|
|
1788
|
+
}, [
|
|
1789
|
+
f("label", Sa, [
|
|
1790
|
+
Fe(A(l.label) + " ", 1),
|
|
1791
|
+
l.required ? (n(), m("span", Da, "*")) : k("", !0)
|
|
1792
|
+
]),
|
|
1793
|
+
f("div", Ea, [
|
|
1794
|
+
P(u(cl), {
|
|
1795
|
+
"model-value": ke(l),
|
|
1796
|
+
disabled: $(l),
|
|
1797
|
+
"onUpdate:modelValue": (C) => Se(l, C)
|
|
1798
|
+
}, null, 8, ["model-value", "disabled", "onUpdate:modelValue"]),
|
|
1799
|
+
P(u(de), {
|
|
1800
|
+
"model-value": e.formData[l.field],
|
|
1801
|
+
class: "w-28",
|
|
1802
|
+
maxlength: "7",
|
|
1803
|
+
placeholder: "#000000",
|
|
1804
|
+
disabled: $(l),
|
|
1805
|
+
"onUpdate:modelValue": (C) => i("update:field", l.field, C)
|
|
1806
|
+
}, null, 8, ["model-value", "disabled", "onUpdate:modelValue"])
|
|
1807
|
+
])
|
|
1808
|
+
], 6)) : l.type === "image" ? (n(), m("div", {
|
|
1809
|
+
key: 2,
|
|
1810
|
+
class: le(be(l, y)),
|
|
1811
|
+
style: ye(we(l, y))
|
|
1812
|
+
}, [
|
|
1813
|
+
f("label", Fa, A(l.label), 1),
|
|
1814
|
+
B(p.$slots, `image-${l.field}`, {
|
|
1815
|
+
field: l,
|
|
1816
|
+
formData: e.formData
|
|
1817
|
+
}, () => [
|
|
1818
|
+
P(na, {
|
|
1819
|
+
"model-value": e.formData[l.field],
|
|
1820
|
+
accept: l.accept || "image/*",
|
|
1821
|
+
"onUpdate:modelValue": (C) => i("update:field", l.field, C),
|
|
1822
|
+
onError: (C) => {
|
|
1823
|
+
d[l.field] = C;
|
|
1824
|
+
}
|
|
1825
|
+
}, null, 8, ["model-value", "accept", "onUpdate:modelValue", "onError"])
|
|
1826
|
+
]),
|
|
1827
|
+
d[l.field] ? (n(), m("small", Pa, A(d[l.field]), 1)) : k("", !0)
|
|
1828
|
+
], 6)) : l.type === "transfer" ? (n(), m("div", {
|
|
1829
|
+
key: 3,
|
|
1830
|
+
class: le(be(l, y)),
|
|
1831
|
+
style: ye(we(l, y))
|
|
1832
|
+
}, [
|
|
1833
|
+
f("label", Ma, [
|
|
1834
|
+
Fe(A(l.label) + " ", 1),
|
|
1835
|
+
l.required ? (n(), m("span", Ia, "*")) : k("", !0)
|
|
1836
|
+
]),
|
|
1837
|
+
P(ba, {
|
|
1838
|
+
source: Y(l.options) || [],
|
|
1839
|
+
selected: e.formData[l.field] || [],
|
|
1840
|
+
"track-by": l.optionValue || "id",
|
|
1841
|
+
"option-label": l.optionLabel || "nome",
|
|
1842
|
+
"search-fields": l.searchFields,
|
|
1843
|
+
disabled: $(l),
|
|
1844
|
+
"onUpdate:selected": (C) => i("update:field", l.field, C)
|
|
1845
|
+
}, null, 8, ["source", "selected", "track-by", "option-label", "search-fields", "disabled", "onUpdate:selected"])
|
|
1846
|
+
], 6)) : (n(), m("div", {
|
|
1847
|
+
key: 4,
|
|
1848
|
+
class: le(be(l, y)),
|
|
1849
|
+
style: ye(we(l, y))
|
|
1850
|
+
}, [
|
|
1851
|
+
f("label", Ra, [
|
|
1852
|
+
Fe(A(l.label) + " ", 1),
|
|
1853
|
+
l.required ? (n(), m("span", Aa, "*")) : k("", !0),
|
|
1854
|
+
h[l.field] ? (n(), m("i", Ba)) : k("", !0)
|
|
1855
|
+
]),
|
|
1856
|
+
(!l.type || l.type === "text") && l.mask ? ue((n(), S(u(de), {
|
|
1857
|
+
key: 0,
|
|
1858
|
+
"model-value": e.formData[l.field],
|
|
1859
|
+
fluid: "",
|
|
1860
|
+
autofocus: R(l) || void 0,
|
|
1861
|
+
placeholder: l.placeholder,
|
|
1862
|
+
disabled: $(l),
|
|
1863
|
+
"onUpdate:modelValue": (C) => i("update:field", l.field, C)
|
|
1864
|
+
}, null, 8, ["model-value", "autofocus", "placeholder", "disabled", "onUpdate:modelValue"])), [
|
|
1865
|
+
[u(at), { mask: L(l.mask) }]
|
|
1866
|
+
]) : !l.type || l.type === "text" ? (n(), S(u(de), {
|
|
1867
|
+
key: 1,
|
|
1868
|
+
"model-value": e.formData[l.field],
|
|
1869
|
+
fluid: "",
|
|
1870
|
+
autofocus: R(l) || void 0,
|
|
1871
|
+
placeholder: l.placeholder,
|
|
1872
|
+
disabled: $(l),
|
|
1873
|
+
"onUpdate:modelValue": (C) => i("update:field", l.field, C)
|
|
1874
|
+
}, null, 8, ["model-value", "autofocus", "placeholder", "disabled", "onUpdate:modelValue"])) : l.type === "email" ? (n(), S(u(de), {
|
|
1875
|
+
key: 2,
|
|
1876
|
+
"model-value": e.formData[l.field],
|
|
1877
|
+
type: "email",
|
|
1878
|
+
fluid: "",
|
|
1879
|
+
autofocus: R(l) || void 0,
|
|
1880
|
+
placeholder: l.placeholder,
|
|
1881
|
+
disabled: $(l),
|
|
1882
|
+
"onUpdate:modelValue": (C) => i("update:field", l.field, C)
|
|
1883
|
+
}, null, 8, ["model-value", "autofocus", "placeholder", "disabled", "onUpdate:modelValue"])) : l.type === "password" ? (n(), S(u(ml), {
|
|
1884
|
+
key: 3,
|
|
1885
|
+
"model-value": e.formData[l.field],
|
|
1886
|
+
fluid: "",
|
|
1887
|
+
"toggle-mask": "",
|
|
1888
|
+
feedback: l.feedback !== !1,
|
|
1889
|
+
placeholder: l.placeholder,
|
|
1890
|
+
disabled: $(l),
|
|
1891
|
+
"onUpdate:modelValue": (C) => i("update:field", l.field, C)
|
|
1892
|
+
}, null, 8, ["model-value", "feedback", "placeholder", "disabled", "onUpdate:modelValue"])) : l.type === "number" ? (n(), S(u(ot), {
|
|
1893
|
+
key: 4,
|
|
1894
|
+
"model-value": e.formData[l.field],
|
|
1895
|
+
fluid: "",
|
|
1896
|
+
locale: "pt-BR",
|
|
1897
|
+
min: l.min,
|
|
1898
|
+
max: l.max,
|
|
1899
|
+
"min-fraction-digits": l.minFractionDigits,
|
|
1900
|
+
"max-fraction-digits": l.maxFractionDigits,
|
|
1901
|
+
suffix: l.suffix,
|
|
1902
|
+
prefix: l.prefix,
|
|
1903
|
+
placeholder: l.placeholder,
|
|
1904
|
+
disabled: $(l),
|
|
1905
|
+
"onUpdate:modelValue": (C) => i("update:field", l.field, C)
|
|
1906
|
+
}, null, 8, ["model-value", "min", "max", "min-fraction-digits", "max-fraction-digits", "suffix", "prefix", "placeholder", "disabled", "onUpdate:modelValue"])) : l.type === "currency" && l.fillFromRight ? (n(), S(Jl, {
|
|
1907
|
+
key: 5,
|
|
1908
|
+
"model-value": e.formData[l.field],
|
|
1909
|
+
decimals: l.decimals ?? 2,
|
|
1910
|
+
currency: "",
|
|
1911
|
+
prefix: l.prefix,
|
|
1912
|
+
suffix: l.suffix,
|
|
1913
|
+
placeholder: l.placeholder,
|
|
1914
|
+
disabled: $(l),
|
|
1915
|
+
"onUpdate:modelValue": (C) => i("update:field", l.field, C)
|
|
1916
|
+
}, null, 8, ["model-value", "decimals", "prefix", "suffix", "placeholder", "disabled", "onUpdate:modelValue"])) : l.type === "currency" ? (n(), S(u(ot), {
|
|
1917
|
+
key: 6,
|
|
1918
|
+
"model-value": e.formData[l.field],
|
|
1919
|
+
fluid: "",
|
|
1920
|
+
mode: "currency",
|
|
1921
|
+
currency: "BRL",
|
|
1922
|
+
locale: "pt-BR",
|
|
1923
|
+
min: l.min,
|
|
1924
|
+
max: l.max,
|
|
1925
|
+
placeholder: l.placeholder,
|
|
1926
|
+
disabled: $(l),
|
|
1927
|
+
"onUpdate:modelValue": (C) => i("update:field", l.field, C)
|
|
1928
|
+
}, null, 8, ["model-value", "min", "max", "placeholder", "disabled", "onUpdate:modelValue"])) : l.type === "select" ? (n(), S(u(pt), {
|
|
1929
|
+
key: 7,
|
|
1930
|
+
"model-value": e.formData[l.field],
|
|
1931
|
+
fluid: "",
|
|
1932
|
+
options: Y(l.options),
|
|
1933
|
+
"option-label": l.optionLabel || "label",
|
|
1934
|
+
"option-value": l.optionValue || "value",
|
|
1935
|
+
"show-clear": l.showClear !== !1,
|
|
1936
|
+
placeholder: l.placeholder,
|
|
1937
|
+
disabled: $(l),
|
|
1938
|
+
"onUpdate:modelValue": (C) => i("update:field", l.field, C)
|
|
1939
|
+
}, null, 8, ["model-value", "options", "option-label", "option-value", "show-clear", "placeholder", "disabled", "onUpdate:modelValue"])) : l.type === "autocomplete" ? (n(), S(u(Rt), {
|
|
1940
|
+
key: 8,
|
|
1941
|
+
"model-value": K(l),
|
|
1942
|
+
fluid: "",
|
|
1943
|
+
suggestions: Z(l),
|
|
1944
|
+
"option-label": l.optionLabel || "label",
|
|
1945
|
+
placeholder: l.placeholder,
|
|
1946
|
+
disabled: $(l),
|
|
1947
|
+
onComplete: (C) => J(l, C),
|
|
1948
|
+
onItemSelect: (C) => ce(l, C),
|
|
1949
|
+
onClear: (C) => i("update:field", l.field, null)
|
|
1950
|
+
}, null, 8, ["model-value", "suggestions", "option-label", "placeholder", "disabled", "onComplete", "onItemSelect", "onClear"])) : l.type === "fk" ? (n(), S(Kl, {
|
|
1951
|
+
key: 9,
|
|
1952
|
+
"model-value": e.formData[l.field],
|
|
1953
|
+
autofocus: R(l) || void 0,
|
|
1954
|
+
endpoint: l.endpoint,
|
|
1955
|
+
"endpoint-params": z(l),
|
|
1956
|
+
drilldown: me(l),
|
|
1957
|
+
"blocked-placeholder": l.blockedPlaceholder,
|
|
1958
|
+
"option-label": l.optionLabel || "nome",
|
|
1959
|
+
placeholder: l.placeholder,
|
|
1960
|
+
disabled: $(l),
|
|
1961
|
+
"show-clear": l.showClear !== !1,
|
|
1962
|
+
"dialog-header": l.label,
|
|
1963
|
+
"crud-fields": l.crudFields,
|
|
1964
|
+
"crud-columns": l.crudColumns,
|
|
1965
|
+
"can-create": l.canCreate,
|
|
1966
|
+
"can-edit": l.canEdit,
|
|
1967
|
+
"can-delete": l.canDelete,
|
|
1968
|
+
"onUpdate:modelValue": (C) => i("update:field", l.field, C)
|
|
1969
|
+
}, null, 8, ["model-value", "autofocus", "endpoint", "endpoint-params", "drilldown", "blocked-placeholder", "option-label", "placeholder", "disabled", "show-clear", "dialog-header", "crud-fields", "crud-columns", "can-create", "can-edit", "can-delete", "onUpdate:modelValue"])) : l.type === "date" ? (n(), S(St, {
|
|
1970
|
+
key: 10,
|
|
1971
|
+
"model-value": e.formData[l.field],
|
|
1972
|
+
"value-format": "date",
|
|
1973
|
+
autonow: l.autonow,
|
|
1974
|
+
"min-date": l.minDate,
|
|
1975
|
+
"max-date": l.maxDate,
|
|
1976
|
+
placeholder: l.placeholder,
|
|
1977
|
+
disabled: $(l),
|
|
1978
|
+
"onUpdate:modelValue": (C) => i("update:field", l.field, C)
|
|
1979
|
+
}, null, 8, ["model-value", "autonow", "min-date", "max-date", "placeholder", "disabled", "onUpdate:modelValue"])) : l.type === "datetime" ? (n(), S(St, {
|
|
1980
|
+
key: 11,
|
|
1981
|
+
"model-value": e.formData[l.field],
|
|
1982
|
+
"value-format": "date",
|
|
1983
|
+
"show-time": "",
|
|
1984
|
+
autonow: l.autonow,
|
|
1985
|
+
"min-date": l.minDate,
|
|
1986
|
+
"max-date": l.maxDate,
|
|
1987
|
+
placeholder: l.placeholder,
|
|
1988
|
+
disabled: $(l),
|
|
1989
|
+
"onUpdate:modelValue": (C) => i("update:field", l.field, C)
|
|
1990
|
+
}, null, 8, ["model-value", "autonow", "min-date", "max-date", "placeholder", "disabled", "onUpdate:modelValue"])) : l.type === "cpf_cnpj" ? (n(), S(u(de), {
|
|
1991
|
+
key: 12,
|
|
1992
|
+
"model-value": W(e.formData[l.field]),
|
|
1993
|
+
fluid: "",
|
|
1994
|
+
maxlength: "18",
|
|
1995
|
+
placeholder: l.placeholder || "000.000.000-00",
|
|
1996
|
+
disabled: $(l),
|
|
1997
|
+
invalid: !!d[l.field],
|
|
1998
|
+
onInput: (C) => F(l.field, C),
|
|
1999
|
+
onBlur: (C) => De(l)
|
|
2000
|
+
}, null, 8, ["model-value", "placeholder", "disabled", "invalid", "onInput", "onBlur"])) : l.type === "mask" ? ue((n(), S(u(de), {
|
|
2001
|
+
key: 13,
|
|
2002
|
+
"model-value": e.formData[l.field],
|
|
2003
|
+
fluid: "",
|
|
2004
|
+
placeholder: l.placeholder,
|
|
2005
|
+
disabled: $(l),
|
|
2006
|
+
invalid: !!d[l.field],
|
|
2007
|
+
"onUpdate:modelValue": (C) => i("update:field", l.field, C),
|
|
2008
|
+
onBlur: (C) => De(l)
|
|
2009
|
+
}, null, 8, ["model-value", "placeholder", "disabled", "invalid", "onUpdate:modelValue", "onBlur"])), [
|
|
2010
|
+
[u(at), { mask: L(l.mask) }]
|
|
2011
|
+
]) : l.type === "cep" ? ue((n(), S(u(de), {
|
|
2012
|
+
key: 14,
|
|
2013
|
+
"model-value": e.formData[l.field],
|
|
2014
|
+
fluid: "",
|
|
2015
|
+
placeholder: l.placeholder || "00000-000",
|
|
2016
|
+
disabled: $(l),
|
|
2017
|
+
invalid: !!V[l.field],
|
|
2018
|
+
onInput: (C) => w(l, C)
|
|
2019
|
+
}, null, 8, ["model-value", "placeholder", "disabled", "invalid", "onInput"])), [
|
|
2020
|
+
[u(at), { mask: "#####-###" }]
|
|
2021
|
+
]) : l.type === "textarea" ? (n(), S(u(ul), {
|
|
2022
|
+
key: 15,
|
|
2023
|
+
"model-value": e.formData[l.field],
|
|
2024
|
+
fluid: "",
|
|
2025
|
+
autofocus: R(l) || void 0,
|
|
2026
|
+
rows: l.rows || 3,
|
|
2027
|
+
placeholder: l.placeholder,
|
|
2028
|
+
disabled: $(l),
|
|
2029
|
+
"onUpdate:modelValue": (C) => i("update:field", l.field, C)
|
|
2030
|
+
}, null, 8, ["model-value", "autofocus", "rows", "placeholder", "disabled", "onUpdate:modelValue"])) : k("", !0),
|
|
2031
|
+
V[l.field] ? (n(), m("small", Ua, A(V[l.field]), 1)) : d[l.field] ? (n(), m("small", Ta, A(d[l.field]), 1)) : k("", !0)
|
|
2032
|
+
], 6))
|
|
2033
|
+
], void 0, l.field)), 128))
|
|
2034
|
+
], 4)
|
|
2035
|
+
]))), 128))
|
|
2036
|
+
]));
|
|
2037
|
+
}
|
|
2038
|
+
}), Na = { class: "w-crud-form-footer" }, Tt = /* @__PURE__ */ se({
|
|
2039
|
+
__name: "WCrudFormDialog",
|
|
2040
|
+
props: {
|
|
2041
|
+
visible: { type: Boolean },
|
|
2042
|
+
title: {},
|
|
2043
|
+
fields: {},
|
|
2044
|
+
formData: {},
|
|
2045
|
+
isEditing: { type: Boolean },
|
|
2046
|
+
saving: { type: Boolean },
|
|
2047
|
+
disabled: { type: Boolean, default: !1 },
|
|
2048
|
+
width: { default: "480px" },
|
|
2049
|
+
formColumns: { default: void 0 },
|
|
2050
|
+
keyboardNav: { type: Boolean }
|
|
2051
|
+
},
|
|
2052
|
+
emits: ["update:visible", "update:field", "save"],
|
|
2053
|
+
setup(e, { emit: a }) {
|
|
2054
|
+
const t = e, o = a, i = T(null), d = T(null);
|
|
2055
|
+
function h() {
|
|
2056
|
+
i.value ? i.value.validateAll().length === 0 && o("save") : o("save");
|
|
2057
|
+
}
|
|
2058
|
+
const { focusFirst: V, handleKeydown: x } = rl(d, {
|
|
2059
|
+
enabled: () => t.keyboardNav === !0,
|
|
2060
|
+
onSubmit: h
|
|
2061
|
+
});
|
|
2062
|
+
return Ve(
|
|
2063
|
+
() => t.visible,
|
|
2064
|
+
(w) => {
|
|
2065
|
+
w && i.value && i.value.clearErrors();
|
|
2066
|
+
}
|
|
2067
|
+
), (w, I) => (n(), S(u(nt), {
|
|
2068
|
+
visible: e.visible,
|
|
2069
|
+
header: e.title,
|
|
2070
|
+
style: ye({ width: e.width }),
|
|
2071
|
+
modal: "",
|
|
2072
|
+
draggable: !1,
|
|
2073
|
+
class: "w-crud-form-dialog",
|
|
2074
|
+
"onUpdate:visible": I[3] || (I[3] = ($) => o("update:visible", $)),
|
|
2075
|
+
onShow: u(V)
|
|
2076
|
+
}, {
|
|
2077
|
+
default: H(() => [
|
|
2078
|
+
f("form", {
|
|
2079
|
+
ref_key: "formRef",
|
|
2080
|
+
ref: d,
|
|
2081
|
+
class: "w-crud-form",
|
|
2082
|
+
onSubmit: _t(h, ["prevent"]),
|
|
2083
|
+
onKeydown: I[2] || (I[2] = //@ts-ignore
|
|
2084
|
+
(...$) => u(x) && u(x)(...$))
|
|
2085
|
+
}, [
|
|
2086
|
+
P(La, {
|
|
2087
|
+
ref_key: "rendererRef",
|
|
2088
|
+
ref: i,
|
|
2089
|
+
fields: e.fields,
|
|
2090
|
+
"form-data": e.formData,
|
|
2091
|
+
"is-editing": e.isEditing,
|
|
2092
|
+
disabled: e.disabled,
|
|
2093
|
+
columns: e.formColumns,
|
|
2094
|
+
"onUpdate:field": I[0] || (I[0] = ($, z) => o("update:field", $, z))
|
|
2095
|
+
}, Je({ _: 2 }, [
|
|
2096
|
+
ie(e.fields, ($) => ({
|
|
2097
|
+
name: `field-${$.field}`,
|
|
2098
|
+
fn: H((z) => [
|
|
2099
|
+
B(w.$slots, `field-${$.field}`, ft(vt(z)))
|
|
2100
|
+
])
|
|
2101
|
+
})),
|
|
2102
|
+
ie(e.fields.filter(($) => $.type === "image"), ($) => ({
|
|
2103
|
+
name: `image-${$.field}`,
|
|
2104
|
+
fn: H((z) => [
|
|
2105
|
+
B(w.$slots, `image-${$.field}`, ft(vt(z)))
|
|
2106
|
+
])
|
|
2107
|
+
}))
|
|
2108
|
+
]), 1032, ["fields", "form-data", "is-editing", "disabled", "columns"]),
|
|
2109
|
+
f("div", Na, [
|
|
2110
|
+
B(w.$slots, "footer", {
|
|
2111
|
+
saving: e.saving,
|
|
2112
|
+
disabled: e.disabled
|
|
2113
|
+
}, () => [
|
|
2114
|
+
P(u(O), {
|
|
2115
|
+
type: "button",
|
|
2116
|
+
label: e.disabled ? "Fechar" : "Cancelar",
|
|
2117
|
+
severity: "secondary",
|
|
2118
|
+
text: "",
|
|
2119
|
+
disabled: e.saving,
|
|
2120
|
+
"data-kbd-skip": "",
|
|
2121
|
+
onClick: I[1] || (I[1] = ($) => o("update:visible", !1))
|
|
2122
|
+
}, null, 8, ["label", "disabled"]),
|
|
2123
|
+
e.disabled ? k("", !0) : (n(), S(u(O), {
|
|
2124
|
+
key: 0,
|
|
2125
|
+
type: "submit",
|
|
2126
|
+
label: e.isEditing ? "Atualizar" : "Salvar",
|
|
2127
|
+
icon: "pi pi-check",
|
|
2128
|
+
loading: e.saving
|
|
2129
|
+
}, null, 8, ["label", "loading"]))
|
|
2130
|
+
])
|
|
2131
|
+
])
|
|
2132
|
+
], 544)
|
|
2133
|
+
]),
|
|
2134
|
+
_: 3
|
|
2135
|
+
}, 8, ["visible", "header", "style", "onShow"]));
|
|
2136
|
+
}
|
|
2137
|
+
});
|
|
2138
|
+
function Oa(e, a) {
|
|
2139
|
+
const t = a[e.field];
|
|
2140
|
+
return e.format ? e.format(t, a) : t == null ? "" : typeof t == "boolean" ? t ? "Sim" : "Não" : String(t);
|
|
2141
|
+
}
|
|
2142
|
+
function Dt(e, a) {
|
|
2143
|
+
return e.includes('"') || e.includes(a) || e.includes(`
|
|
2144
|
+
`) || e.includes("\r") ? `"${e.replace(/"/g, '""')}"` : e;
|
|
2145
|
+
}
|
|
2146
|
+
function za(e, a, t = {}) {
|
|
2147
|
+
const o = t.separator ?? ";", i = a.map((h) => Dt(h.header, o)).join(o), d = e.map((h) => a.map((V) => Dt(Oa(V, h), o)).join(o));
|
|
2148
|
+
return "\uFEFF" + [i, ...d].join(`\r
|
|
2149
|
+
`);
|
|
2150
|
+
}
|
|
2151
|
+
function Wa(e, a = "export.csv") {
|
|
2152
|
+
const t = new Blob([e], { type: "text/csv;charset=utf-8;" }), o = URL.createObjectURL(t), i = document.createElement("a");
|
|
2153
|
+
i.href = o, i.download = a, document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(o);
|
|
2154
|
+
}
|
|
2155
|
+
const ja = { class: "w-crud" }, qa = {
|
|
2156
|
+
key: 0,
|
|
2157
|
+
class: "w-crud-header"
|
|
2158
|
+
}, Ka = { class: "w-crud-header-content" }, Ha = { class: "w-crud-title" }, Ga = {
|
|
2159
|
+
key: 0,
|
|
2160
|
+
class: "w-crud-subtitle"
|
|
2161
|
+
}, Ya = { class: "w-crud-header-actions" }, Ja = {
|
|
2162
|
+
key: 0,
|
|
2163
|
+
class: "w-crud-kpis"
|
|
2164
|
+
}, Xa = { class: "w-crud-kpi-content" }, Za = { class: "w-crud-kpi-label" }, Qa = { class: "w-crud-kpi-value" }, _a = { class: "w-crud-content-main" }, eo = {
|
|
2165
|
+
key: 0,
|
|
2166
|
+
class: "w-crud-filters",
|
|
2167
|
+
style: { display: "flex", "flex-wrap": "wrap", gap: "0.5rem", "align-items": "center", "margin-bottom": "0.75rem" }
|
|
2168
|
+
}, to = {
|
|
2169
|
+
key: 1,
|
|
2170
|
+
class: "w-crud-table"
|
|
2171
|
+
}, lo = {
|
|
2172
|
+
key: 0,
|
|
2173
|
+
class: "w-crud-bulkbar",
|
|
2174
|
+
style: { display: "flex", "align-items": "center", gap: "0.5rem", "margin-bottom": "0.5rem", padding: "0.5rem 0.75rem", "border-radius": "8px", background: "var(--p-primary-50, #eef2ff)", color: "var(--p-primary-700, #3730a3)" }
|
|
2175
|
+
}, ao = { style: { "font-weight": "600", "font-size": "0.85rem", "margin-right": "auto" } }, oo = { class: "w-crud-toolbar" }, no = { class: "w-crud-toolbar-start" }, io = { class: "w-crud-toolbar-end" }, so = { style: { display: "flex", "flex-direction": "column", gap: "0.35rem", "min-width": "180px" } }, ro = ["for"], uo = {
|
|
2176
|
+
key: 2,
|
|
2177
|
+
class: "w-crud-view-toggle"
|
|
2178
|
+
}, co = { class: "w-crud-actions" }, mo = {
|
|
2179
|
+
key: 2,
|
|
2180
|
+
class: "w-crud-cards-wrap"
|
|
2181
|
+
}, fo = { class: "w-crud-toolbar w-crud-toolbar--standalone" }, vo = { class: "w-crud-toolbar-start" }, po = { class: "w-crud-toolbar-end" }, ho = {
|
|
2182
|
+
key: 1,
|
|
2183
|
+
class: "w-crud-view-toggle"
|
|
2184
|
+
}, yo = {
|
|
2185
|
+
key: 0,
|
|
2186
|
+
class: "w-crud-cards-loading"
|
|
2187
|
+
}, go = ["onClick", "onDblclick", "onContextmenu"], bo = { class: "w-crud-card-body" }, ko = {
|
|
2188
|
+
key: 0,
|
|
2189
|
+
class: "w-crud-card-label"
|
|
2190
|
+
}, wo = { class: "w-crud-card-value" }, $o = {
|
|
2191
|
+
key: 0,
|
|
2192
|
+
class: "w-crud-card-actions"
|
|
2193
|
+
}, xo = {
|
|
2194
|
+
key: 0,
|
|
2195
|
+
class: "w-crud-rail"
|
|
2196
|
+
}, Co = {
|
|
2197
|
+
key: 1,
|
|
2198
|
+
class: "w-crud-rail-sep"
|
|
2199
|
+
}, Vo = {
|
|
2200
|
+
key: 2,
|
|
2201
|
+
class: "w-crud-rail-sep"
|
|
2202
|
+
}, fi = /* @__PURE__ */ se({
|
|
2203
|
+
__name: "WCrudView",
|
|
2204
|
+
props: {
|
|
2205
|
+
crud: {},
|
|
2206
|
+
title: {},
|
|
2207
|
+
subtitle: {},
|
|
2208
|
+
showSearch: { type: Boolean, default: !0 },
|
|
2209
|
+
showHeader: { type: Boolean, default: !0 },
|
|
2210
|
+
dialogWidth: { default: "480px" },
|
|
2211
|
+
formColumns: {},
|
|
2212
|
+
autoInit: { type: Boolean, default: !0 },
|
|
2213
|
+
showKpi: { type: Boolean, default: !1 },
|
|
2214
|
+
kpiIcon: { default: "pi pi-list" },
|
|
2215
|
+
kpiLabel: { default: "Total de Registros" },
|
|
2216
|
+
extraKpis: { default: () => [] },
|
|
2217
|
+
expandable: { type: Boolean, default: !1 },
|
|
2218
|
+
viewToggle: { type: Boolean, default: !0 },
|
|
2219
|
+
defaultView: { default: "table" },
|
|
2220
|
+
cardFields: { default: 4 },
|
|
2221
|
+
cardBare: { type: Boolean },
|
|
2222
|
+
actionRail: { type: Boolean, default: !0 },
|
|
2223
|
+
contextMenu: { type: Boolean, default: !0 },
|
|
2224
|
+
showPrint: { type: Boolean, default: !1 },
|
|
2225
|
+
exportCsv: { type: Boolean, default: !0 },
|
|
2226
|
+
csvFilename: { default: "export.csv" },
|
|
2227
|
+
csvScope: { default: "all" },
|
|
2228
|
+
csvPageSize: { default: 200 },
|
|
2229
|
+
persistState: {}
|
|
2230
|
+
},
|
|
2231
|
+
emits: ["row-expand", "row-collapse", "print"],
|
|
2232
|
+
setup(e, { emit: a }) {
|
|
2233
|
+
const t = e, o = a, i = el(), { formatNumber: d } = gt(), h = T({});
|
|
2234
|
+
function V() {
|
|
2235
|
+
return t.persistState ? `wcrud:view:${t.persistState}` : null;
|
|
2236
|
+
}
|
|
2237
|
+
function x() {
|
|
2238
|
+
const c = V();
|
|
2239
|
+
if (c) {
|
|
2240
|
+
const v = localStorage.getItem(c);
|
|
2241
|
+
if (v === "table" || v === "cards") return v;
|
|
2242
|
+
}
|
|
2243
|
+
return t.defaultView;
|
|
2244
|
+
}
|
|
2245
|
+
const w = T(x());
|
|
2246
|
+
function I(c) {
|
|
2247
|
+
return w.value === c;
|
|
2248
|
+
}
|
|
2249
|
+
function $(c) {
|
|
2250
|
+
w.value = c;
|
|
2251
|
+
const v = V();
|
|
2252
|
+
v && localStorage.setItem(v, c);
|
|
2253
|
+
}
|
|
2254
|
+
const z = D(
|
|
2255
|
+
() => (t.crud.pagination.page - 1) * t.crud.pagination.pageSize
|
|
2256
|
+
), G = Ae({ hidden: [] }), Y = T(null);
|
|
2257
|
+
function X() {
|
|
2258
|
+
return t.persistState ? `wcrud:cols:${t.persistState}` : null;
|
|
2259
|
+
}
|
|
2260
|
+
function R() {
|
|
2261
|
+
const c = X();
|
|
2262
|
+
if (c)
|
|
2263
|
+
try {
|
|
2264
|
+
const v = JSON.parse(localStorage.getItem(c) || "{}");
|
|
2265
|
+
Array.isArray(v.hidden) && (G.hidden = v.hidden);
|
|
2266
|
+
} catch {
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
function L() {
|
|
2270
|
+
const c = X();
|
|
2271
|
+
c && localStorage.setItem(c, JSON.stringify({ hidden: G.hidden }));
|
|
2272
|
+
}
|
|
2273
|
+
function W() {
|
|
2274
|
+
return t.persistState ? `wcrud:filters:${t.persistState}` : null;
|
|
2275
|
+
}
|
|
2276
|
+
function F() {
|
|
2277
|
+
const c = W();
|
|
2278
|
+
if (c)
|
|
2279
|
+
try {
|
|
2280
|
+
const v = JSON.parse(localStorage.getItem(c) || "{}");
|
|
2281
|
+
if (v && typeof v.columnFilters == "object" && v.columnFilters)
|
|
2282
|
+
for (const [q, r] of Object.entries(v.columnFilters))
|
|
2283
|
+
r != null && r !== "" && (t.crud.columnFilters[q] = r);
|
|
2284
|
+
typeof v.search == "string" && v.search && (t.crud.search.value = v.search);
|
|
2285
|
+
} catch {
|
|
2286
|
+
}
|
|
2287
|
+
}
|
|
2288
|
+
function j() {
|
|
2289
|
+
const c = W();
|
|
2290
|
+
c && localStorage.setItem(
|
|
2291
|
+
c,
|
|
2292
|
+
JSON.stringify({
|
|
2293
|
+
columnFilters: { ...t.crud.columnFilters },
|
|
2294
|
+
search: t.crud.search.value
|
|
2295
|
+
})
|
|
2296
|
+
);
|
|
2297
|
+
}
|
|
2298
|
+
Ve(t.crud.columnFilters, j, { deep: !0 }), Ve(t.crud.search, j);
|
|
2299
|
+
const K = D(() => t.crud.config.columns.filter((c) => c.visible !== !1));
|
|
2300
|
+
function Z(c, v) {
|
|
2301
|
+
G.hidden = v ? G.hidden.filter((q) => q !== c) : [.../* @__PURE__ */ new Set([...G.hidden, c])], L();
|
|
2302
|
+
}
|
|
2303
|
+
const J = D(
|
|
2304
|
+
() => t.crud.config.columns.filter((c) => c.visible !== !1 && !G.hidden.includes(c.field)).map((c) => c.type === "number" && !c.align ? { ...c, align: "right" } : c.type === "currency" && !c.align ? { ...c, align: "right" } : c)
|
|
2305
|
+
);
|
|
2306
|
+
function ce(c) {
|
|
2307
|
+
if (c.align === "right") return "text-right";
|
|
2308
|
+
if (c.align === "center") return "text-center";
|
|
2309
|
+
}
|
|
2310
|
+
const ke = D(() => J.value.slice(0, t.cardFields)), Se = D(() => {
|
|
2311
|
+
const c = [];
|
|
2312
|
+
return t.crud.config.canEdit !== !1 && c.push({ action: "edit", icon: "pi pi-pencil", tooltip: "Editar" }), t.crud.config.canCreate !== !1 && c.push({
|
|
2313
|
+
action: "duplicate",
|
|
2314
|
+
icon: "pi pi-copy",
|
|
2315
|
+
tooltip: "Duplicar",
|
|
2316
|
+
severity: "info"
|
|
2317
|
+
}), t.crud.config.canDelete !== !1 && c.push({
|
|
2318
|
+
action: "delete",
|
|
2319
|
+
icon: "pi pi-trash",
|
|
2320
|
+
tooltip: "Excluir",
|
|
2321
|
+
severity: "danger"
|
|
2322
|
+
}), c;
|
|
2323
|
+
}), me = D(
|
|
2324
|
+
() => t.crud.config.rowActions ?? Se.value
|
|
2325
|
+
), De = D(
|
|
2326
|
+
() => me.value.length > 0 || !!i["row-actions"]
|
|
2327
|
+
);
|
|
2328
|
+
function ve(c, v) {
|
|
2329
|
+
if (c.handler) {
|
|
2330
|
+
c.handler(v);
|
|
2331
|
+
return;
|
|
2332
|
+
}
|
|
2333
|
+
c.action === "edit" ? t.crud.openEditDialog(v) : c.action === "view" ? t.crud.openViewDialog(v) : c.action === "duplicate" ? t.crud.openDuplicateDialog(v) : c.action === "delete" && (i["delete-message"] ? (fe.value = v, pe.value = !0) : t.crud.confirmDelete(v));
|
|
2334
|
+
}
|
|
2335
|
+
const fe = T(null), pe = T(!1), ge = T(!1);
|
|
2336
|
+
async function we() {
|
|
2337
|
+
if (fe.value) {
|
|
2338
|
+
ge.value = !0;
|
|
2339
|
+
try {
|
|
2340
|
+
await t.crud.performDelete(fe.value), pe.value = !1, fe.value = null;
|
|
2341
|
+
} finally {
|
|
2342
|
+
ge.value = !1;
|
|
2343
|
+
}
|
|
2344
|
+
}
|
|
2345
|
+
}
|
|
2346
|
+
function be(c, v) {
|
|
2347
|
+
return c.visible ? c.visible(v) : !0;
|
|
2348
|
+
}
|
|
2349
|
+
function Ee(c, v) {
|
|
2350
|
+
return c.disabled ? c.disabled(v) : !1;
|
|
2351
|
+
}
|
|
2352
|
+
const p = D(() => {
|
|
2353
|
+
const c = [];
|
|
2354
|
+
return t.showKpi && c.push({
|
|
2355
|
+
icon: t.kpiIcon,
|
|
2356
|
+
label: t.kpiLabel,
|
|
2357
|
+
value: d(t.crud.pagination.rows, 0)
|
|
2358
|
+
}), c.push(...t.extraKpis), c;
|
|
2359
|
+
}), g = D(() => t.crud.config.canCreate !== !1), y = T(null), l = D(() => t.crud.config.selectionMode === "multiple"), C = D(() => t.crud.config.editMode === "cell"), ae = D(() => new Map(t.crud.config.form.map((c) => [c.field, c]))), ee = ["text", "email", "number", "currency"];
|
|
2360
|
+
function oe(c) {
|
|
2361
|
+
const v = ae.value.get(c);
|
|
2362
|
+
return v && ee.includes(v.type || "text") ? v : void 0;
|
|
2363
|
+
}
|
|
2364
|
+
function _(c) {
|
|
2365
|
+
c.newValue !== (c.value ?? c.data[c.field]) && t.crud.updateField(c.data, c.field, c.newValue);
|
|
2366
|
+
}
|
|
2367
|
+
const ne = D(
|
|
2368
|
+
() => t.crud.config.columns.filter((c) => c.filter)
|
|
2369
|
+
), $e = [
|
|
2370
|
+
{ label: "Sim", value: !0 },
|
|
2371
|
+
{ label: "Não", value: !1 }
|
|
2372
|
+
];
|
|
2373
|
+
function re(c) {
|
|
2374
|
+
var v;
|
|
2375
|
+
return ((v = c.filter) == null ? void 0 : v.param) || c.field;
|
|
2376
|
+
}
|
|
2377
|
+
const he = {};
|
|
2378
|
+
function Re(c, v) {
|
|
2379
|
+
const q = re(c);
|
|
2380
|
+
he[q] && clearTimeout(he[q]), he[q] = setTimeout(() => t.crud.setColumnFilter(q, v || null), 300);
|
|
2381
|
+
}
|
|
2382
|
+
const Pe = T(null);
|
|
2383
|
+
function Be(c) {
|
|
2384
|
+
y.value = c;
|
|
2385
|
+
}
|
|
2386
|
+
function Ue(c) {
|
|
2387
|
+
var v;
|
|
2388
|
+
t.contextMenu && (y.value = c.data, (v = Pe.value) == null || v.show(c.originalEvent));
|
|
2389
|
+
}
|
|
2390
|
+
function je(c, v) {
|
|
2391
|
+
var q;
|
|
2392
|
+
t.contextMenu && (c.preventDefault(), y.value = v, (q = Pe.value) == null || q.show(c));
|
|
2393
|
+
}
|
|
2394
|
+
const it = D(() => {
|
|
2395
|
+
const c = y.value;
|
|
2396
|
+
if (!c) return [];
|
|
2397
|
+
const v = [
|
|
2398
|
+
{
|
|
2399
|
+
label: "Ver detalhes",
|
|
2400
|
+
icon: "pi pi-eye",
|
|
2401
|
+
command: () => t.crud.openViewDialog(c)
|
|
2402
|
+
}
|
|
2403
|
+
];
|
|
2404
|
+
for (const q of me.value)
|
|
2405
|
+
be(q, c) && v.push({
|
|
2406
|
+
label: q.tooltip ?? q.action,
|
|
2407
|
+
icon: q.icon,
|
|
2408
|
+
class: q.severity === "danger" ? "w-crud-ctx-danger" : void 0,
|
|
2409
|
+
disabled: Ee(q, c),
|
|
2410
|
+
command: () => ve(q, c)
|
|
2411
|
+
});
|
|
2412
|
+
return t.showPrint && v.push({
|
|
2413
|
+
label: "Imprimir",
|
|
2414
|
+
icon: "pi pi-print",
|
|
2415
|
+
command: () => o("print", c)
|
|
2416
|
+
}), t.exportCsv && (v.push({ separator: !0 }), v.push({
|
|
2417
|
+
label: t.csvScope === "all" ? "Exportar tudo (CSV)" : "Exportar página (CSV)",
|
|
2418
|
+
icon: "pi pi-download",
|
|
2419
|
+
command: () => qe()
|
|
2420
|
+
})), v;
|
|
2421
|
+
});
|
|
2422
|
+
function Ze() {
|
|
2423
|
+
y.value && o("print", y.value);
|
|
2424
|
+
}
|
|
2425
|
+
const Me = T(!1);
|
|
2426
|
+
async function qe() {
|
|
2427
|
+
if (!Me.value) {
|
|
2428
|
+
Me.value = !0;
|
|
2429
|
+
try {
|
|
2430
|
+
const c = t.csvScope === "page" ? t.crud.items.value : await t.crud.fetchAll(t.csvPageSize), v = za(c, J.value);
|
|
2431
|
+
Wa(v, t.csvFilename);
|
|
2432
|
+
} finally {
|
|
2433
|
+
Me.value = !1;
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
}
|
|
2437
|
+
return yt(() => {
|
|
2438
|
+
R(), F(), t.autoInit && t.crud.init();
|
|
2439
|
+
}), (c, v) => {
|
|
2440
|
+
const q = Ft("tooltip");
|
|
2441
|
+
return n(), m("div", ja, [
|
|
2442
|
+
e.showHeader ? (n(), m("div", qa, [
|
|
2443
|
+
f("div", Ka, [
|
|
2444
|
+
f("h1", Ha, A(e.title), 1),
|
|
2445
|
+
e.subtitle ? (n(), m("p", Ga, A(e.subtitle), 1)) : k("", !0)
|
|
2446
|
+
]),
|
|
2447
|
+
f("div", Ya, [
|
|
2448
|
+
B(c.$slots, "header-actions"),
|
|
2449
|
+
g.value && !e.actionRail ? (n(), S(u(O), {
|
|
2450
|
+
key: 0,
|
|
2451
|
+
label: "Novo",
|
|
2452
|
+
icon: "pi pi-plus",
|
|
2453
|
+
onClick: v[0] || (v[0] = (r) => e.crud.openCreateDialog())
|
|
2454
|
+
})) : k("", !0)
|
|
2455
|
+
])
|
|
2456
|
+
])) : k("", !0),
|
|
2457
|
+
B(c.$slots, "before-table", {}, () => [
|
|
2458
|
+
p.value.length ? (n(), m("div", Ja, [
|
|
2459
|
+
(n(!0), m(te, null, ie(p.value, (r, N) => (n(), m("div", {
|
|
2460
|
+
key: N,
|
|
2461
|
+
class: "w-crud-kpi"
|
|
2462
|
+
}, [
|
|
2463
|
+
f("div", {
|
|
2464
|
+
class: le(["w-crud-kpi-icon", r.severity ? `w-crud-kpi-icon--${r.severity}` : ""])
|
|
2465
|
+
}, [
|
|
2466
|
+
f("i", {
|
|
2467
|
+
class: le([r.icon]),
|
|
2468
|
+
style: ye(r.color ? `color: ${r.color}` : "")
|
|
2469
|
+
}, null, 6)
|
|
2470
|
+
], 2),
|
|
2471
|
+
f("div", Xa, [
|
|
2472
|
+
f("div", Za, A(r.label), 1),
|
|
2473
|
+
f("div", Qa, A(r.value), 1)
|
|
2474
|
+
])
|
|
2475
|
+
]))), 128))
|
|
2476
|
+
])) : k("", !0)
|
|
2477
|
+
]),
|
|
2478
|
+
f("div", {
|
|
2479
|
+
class: le(["w-crud-content", { "w-crud-content--rail": e.actionRail }])
|
|
2480
|
+
}, [
|
|
2481
|
+
f("div", _a, [
|
|
2482
|
+
ne.value.length ? (n(), m("div", eo, [
|
|
2483
|
+
(n(!0), m(te, null, ie(ne.value, (r) => {
|
|
2484
|
+
var N, Q, xe, Ke, Qe, He, Ge, Te, _e;
|
|
2485
|
+
return n(), m(te, {
|
|
2486
|
+
key: r.field
|
|
2487
|
+
}, [
|
|
2488
|
+
(((N = r.filter) == null ? void 0 : N.type) || "text") === "text" ? (n(), S(u(de), {
|
|
2489
|
+
key: 0,
|
|
2490
|
+
"model-value": e.crud.columnFilters[re(r)] ?? "",
|
|
2491
|
+
placeholder: ((Q = r.filter) == null ? void 0 : Q.placeholder) || r.header,
|
|
2492
|
+
size: "small",
|
|
2493
|
+
onInput: (Ie) => Re(r, Ie.target.value)
|
|
2494
|
+
}, null, 8, ["model-value", "placeholder", "onInput"])) : ((xe = r.filter) == null ? void 0 : xe.type) === "select" ? (n(), S(u(pt), {
|
|
2495
|
+
key: 1,
|
|
2496
|
+
"model-value": e.crud.columnFilters[re(r)],
|
|
2497
|
+
options: (Ke = r.filter) == null ? void 0 : Ke.options,
|
|
2498
|
+
"option-label": "label",
|
|
2499
|
+
"option-value": "value",
|
|
2500
|
+
placeholder: ((Qe = r.filter) == null ? void 0 : Qe.placeholder) || r.header,
|
|
2501
|
+
"show-clear": "",
|
|
2502
|
+
size: "small",
|
|
2503
|
+
"onUpdate:modelValue": (Ie) => e.crud.setColumnFilter(re(r), Ie)
|
|
2504
|
+
}, null, 8, ["model-value", "options", "placeholder", "onUpdate:modelValue"])) : ((He = r.filter) == null ? void 0 : He.type) === "boolean" ? (n(), S(u(pt), {
|
|
2505
|
+
key: 2,
|
|
2506
|
+
"model-value": e.crud.columnFilters[re(r)],
|
|
2507
|
+
options: $e,
|
|
2508
|
+
"option-label": "label",
|
|
2509
|
+
"option-value": "value",
|
|
2510
|
+
placeholder: ((Ge = r.filter) == null ? void 0 : Ge.placeholder) || r.header,
|
|
2511
|
+
"show-clear": "",
|
|
2512
|
+
size: "small",
|
|
2513
|
+
"onUpdate:modelValue": (Ie) => e.crud.setColumnFilter(re(r), Ie)
|
|
2514
|
+
}, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"])) : ((Te = r.filter) == null ? void 0 : Te.type) === "numeric" ? (n(), S(u(ot), {
|
|
2515
|
+
key: 3,
|
|
2516
|
+
"model-value": e.crud.columnFilters[re(r)] ?? null,
|
|
2517
|
+
placeholder: ((_e = r.filter) == null ? void 0 : _e.placeholder) || r.header,
|
|
2518
|
+
size: "small",
|
|
2519
|
+
"onUpdate:modelValue": (Ie) => e.crud.setColumnFilter(re(r), Ie)
|
|
2520
|
+
}, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"])) : k("", !0)
|
|
2521
|
+
], 64);
|
|
2522
|
+
}), 128)),
|
|
2523
|
+
Object.keys(e.crud.columnFilters).length ? (n(), S(u(O), {
|
|
2524
|
+
key: 0,
|
|
2525
|
+
label: "Limpar filtros",
|
|
2526
|
+
icon: "pi pi-filter-slash",
|
|
2527
|
+
text: "",
|
|
2528
|
+
size: "small",
|
|
2529
|
+
onClick: v[1] || (v[1] = (r) => e.crud.clearColumnFilters())
|
|
2530
|
+
})) : k("", !0)
|
|
2531
|
+
])) : k("", !0),
|
|
2532
|
+
w.value === "table" ? (n(), m("div", to, [
|
|
2533
|
+
l.value && e.crud.selectedItems.value.length ? (n(), m("div", lo, [
|
|
2534
|
+
f("span", ao, A(e.crud.selectedItems.value.length) + " selecionado(s) ", 1),
|
|
2535
|
+
B(c.$slots, "bulk-actions", {
|
|
2536
|
+
selected: e.crud.selectedItems.value,
|
|
2537
|
+
crud: e.crud
|
|
2538
|
+
}, () => [
|
|
2539
|
+
(n(!0), m(te, null, ie(e.crud.config.bulkActions || [], (r) => (n(), S(u(O), {
|
|
2540
|
+
key: r.action,
|
|
2541
|
+
label: r.label,
|
|
2542
|
+
icon: r.icon,
|
|
2543
|
+
severity: r.severity,
|
|
2544
|
+
size: "small",
|
|
2545
|
+
disabled: r.disabled ? r.disabled(e.crud.selectedItems.value) : !1,
|
|
2546
|
+
onClick: (N) => r.handler(e.crud.selectedItems.value)
|
|
2547
|
+
}, null, 8, ["label", "icon", "severity", "disabled", "onClick"]))), 128))
|
|
2548
|
+
]),
|
|
2549
|
+
ue(P(u(O), {
|
|
2550
|
+
icon: "pi pi-times",
|
|
2551
|
+
text: "",
|
|
2552
|
+
rounded: "",
|
|
2553
|
+
size: "small",
|
|
2554
|
+
onClick: v[2] || (v[2] = (r) => e.crud.clearSelection())
|
|
2555
|
+
}, null, 512), [
|
|
2556
|
+
[
|
|
2557
|
+
q,
|
|
2558
|
+
"Limpar seleção",
|
|
2559
|
+
void 0,
|
|
2560
|
+
{ top: !0 }
|
|
2561
|
+
]
|
|
2562
|
+
])
|
|
2563
|
+
])) : k("", !0),
|
|
2564
|
+
P(u(Pt), {
|
|
2565
|
+
"expanded-rows": h.value,
|
|
2566
|
+
"onUpdate:expandedRows": v[7] || (v[7] = (r) => h.value = r),
|
|
2567
|
+
value: e.crud.items.value,
|
|
2568
|
+
loading: e.crud.loading.value,
|
|
2569
|
+
paginator: "",
|
|
2570
|
+
rows: e.crud.pagination.pageSize,
|
|
2571
|
+
"total-records": e.crud.pagination.rows,
|
|
2572
|
+
"rows-per-page-options": [10, 20, 50],
|
|
2573
|
+
"paginator-template": "CurrentPageReport PrevPageLink NextPageLink",
|
|
2574
|
+
"current-page-report-template": "Página {currentPage} de {totalPages}",
|
|
2575
|
+
pt: { pcPaginator: { root: { class: "w-crud-paginator" } } },
|
|
2576
|
+
lazy: "",
|
|
2577
|
+
"striped-rows": "",
|
|
2578
|
+
"removable-sort": "",
|
|
2579
|
+
size: "small",
|
|
2580
|
+
"sort-field": e.crud.sort.field ?? void 0,
|
|
2581
|
+
"sort-order": e.crud.sort.order,
|
|
2582
|
+
"data-key": e.crud.config.pk || "id",
|
|
2583
|
+
"edit-mode": C.value ? "cell" : void 0,
|
|
2584
|
+
selection: l.value ? e.crud.selectedItems.value : e.actionRail || e.contextMenu ? y.value : void 0,
|
|
2585
|
+
"selection-mode": l.value ? void 0 : e.actionRail || e.contextMenu ? "single" : void 0,
|
|
2586
|
+
"context-menu": e.contextMenu,
|
|
2587
|
+
"context-menu-selection": e.contextMenu ? y.value : void 0,
|
|
2588
|
+
"onUpdate:selection": v[8] || (v[8] = (r) => l.value ? e.crud.selectedItems.value = r : y.value = r),
|
|
2589
|
+
"onUpdate:contextMenuSelection": v[9] || (v[9] = (r) => y.value = r),
|
|
2590
|
+
onRowContextmenu: Ue,
|
|
2591
|
+
onPage: e.crud.onPage,
|
|
2592
|
+
onSort: v[10] || (v[10] = (r) => e.crud.onSort({ sortField: r.sortField, sortOrder: r.sortOrder })),
|
|
2593
|
+
onRowExpand: v[11] || (v[11] = (r) => o("row-expand", r.data)),
|
|
2594
|
+
onRowCollapse: v[12] || (v[12] = (r) => o("row-collapse", r.data)),
|
|
2595
|
+
onCellEditComplete: _
|
|
2596
|
+
}, Je({
|
|
2597
|
+
header: H(() => [
|
|
2598
|
+
f("div", oo, [
|
|
2599
|
+
f("div", no, [
|
|
2600
|
+
e.showSearch ? (n(), S(u(ze), { key: 0 }, {
|
|
2601
|
+
default: H(() => [
|
|
2602
|
+
P(u(We), { class: "pi pi-search" }),
|
|
2603
|
+
P(u(de), {
|
|
2604
|
+
"model-value": e.crud.search.value,
|
|
2605
|
+
placeholder: "Buscar...",
|
|
2606
|
+
class: "w-72",
|
|
2607
|
+
onInput: e.crud.onSearch
|
|
2608
|
+
}, null, 8, ["model-value", "onInput"])
|
|
2609
|
+
]),
|
|
2610
|
+
_: 1
|
|
2611
|
+
})) : k("", !0),
|
|
2612
|
+
B(c.$slots, "toolbar-start"),
|
|
2613
|
+
B(c.$slots, "toolbar-filters")
|
|
2614
|
+
]),
|
|
2615
|
+
f("div", io, [
|
|
2616
|
+
B(c.$slots, "toolbar-actions"),
|
|
2617
|
+
e.persistState ? (n(), m(te, { key: 0 }, [
|
|
2618
|
+
ue(P(u(O), {
|
|
2619
|
+
icon: "pi pi-sliders-h",
|
|
2620
|
+
text: "",
|
|
2621
|
+
size: "small",
|
|
2622
|
+
onClick: v[3] || (v[3] = (r) => {
|
|
2623
|
+
var N;
|
|
2624
|
+
return (N = Y.value) == null ? void 0 : N.toggle(r);
|
|
2625
|
+
})
|
|
2626
|
+
}, null, 512), [
|
|
2627
|
+
[
|
|
2628
|
+
q,
|
|
2629
|
+
"Colunas",
|
|
2630
|
+
void 0,
|
|
2631
|
+
{ top: !0 }
|
|
2632
|
+
]
|
|
2633
|
+
]),
|
|
2634
|
+
P(u(Mt), {
|
|
2635
|
+
ref_key: "chooser",
|
|
2636
|
+
ref: Y
|
|
2637
|
+
}, {
|
|
2638
|
+
default: H(() => [
|
|
2639
|
+
f("div", so, [
|
|
2640
|
+
(n(!0), m(te, null, ie(K.value, (r) => (n(), m("div", {
|
|
2641
|
+
key: r.field,
|
|
2642
|
+
style: { display: "flex", "align-items": "center", gap: "0.5rem" }
|
|
2643
|
+
}, [
|
|
2644
|
+
P(u(ll), {
|
|
2645
|
+
"model-value": !G.hidden.includes(r.field),
|
|
2646
|
+
"input-id": `wcrud-col-${r.field}`,
|
|
2647
|
+
binary: "",
|
|
2648
|
+
"onUpdate:modelValue": (N) => Z(r.field, !!N)
|
|
2649
|
+
}, null, 8, ["model-value", "input-id", "onUpdate:modelValue"]),
|
|
2650
|
+
f("label", {
|
|
2651
|
+
for: `wcrud-col-${r.field}`,
|
|
2652
|
+
style: { "font-size": "0.85rem", cursor: "pointer" }
|
|
2653
|
+
}, A(r.header), 9, ro)
|
|
2654
|
+
]))), 128))
|
|
2655
|
+
])
|
|
2656
|
+
]),
|
|
2657
|
+
_: 1
|
|
2658
|
+
}, 512)
|
|
2659
|
+
], 64)) : k("", !0),
|
|
2660
|
+
e.exportCsv ? ue((n(), S(u(O), {
|
|
2661
|
+
key: 1,
|
|
2662
|
+
icon: "pi pi-download",
|
|
2663
|
+
text: "",
|
|
2664
|
+
size: "small",
|
|
2665
|
+
loading: Me.value,
|
|
2666
|
+
onClick: qe
|
|
2667
|
+
}, null, 8, ["loading"])), [
|
|
2668
|
+
[
|
|
2669
|
+
q,
|
|
2670
|
+
e.csvScope === "all" ? "Exportar tudo (CSV)" : "Exportar página (CSV)",
|
|
2671
|
+
void 0,
|
|
2672
|
+
{ top: !0 }
|
|
2673
|
+
]
|
|
2674
|
+
]) : k("", !0),
|
|
2675
|
+
e.viewToggle ? (n(), m("div", uo, [
|
|
2676
|
+
P(u(O), {
|
|
2677
|
+
icon: "pi pi-table",
|
|
2678
|
+
size: "small",
|
|
2679
|
+
text: !I("table"),
|
|
2680
|
+
outlined: I("table"),
|
|
2681
|
+
onClick: v[4] || (v[4] = (r) => $("table"))
|
|
2682
|
+
}, null, 8, ["text", "outlined"]),
|
|
2683
|
+
P(u(O), {
|
|
2684
|
+
icon: "pi pi-th-large",
|
|
2685
|
+
size: "small",
|
|
2686
|
+
text: !I("cards"),
|
|
2687
|
+
outlined: I("cards"),
|
|
2688
|
+
onClick: v[5] || (v[5] = (r) => $("cards"))
|
|
2689
|
+
}, null, 8, ["text", "outlined"])
|
|
2690
|
+
])) : k("", !0),
|
|
2691
|
+
!e.showHeader && g.value && !e.actionRail ? (n(), S(u(O), {
|
|
2692
|
+
key: 3,
|
|
2693
|
+
label: "Novo",
|
|
2694
|
+
icon: "pi pi-plus",
|
|
2695
|
+
onClick: v[6] || (v[6] = (r) => e.crud.openCreateDialog())
|
|
2696
|
+
})) : k("", !0)
|
|
2697
|
+
])
|
|
2698
|
+
])
|
|
2699
|
+
]),
|
|
2700
|
+
empty: H(() => [
|
|
2701
|
+
B(c.$slots, "empty", {}, () => [
|
|
2702
|
+
v[22] || (v[22] = f("div", { class: "w-crud-empty" }, [
|
|
2703
|
+
f("div", { class: "w-crud-empty-icon" }, [
|
|
2704
|
+
f("i", { class: "pi pi-inbox" })
|
|
2705
|
+
]),
|
|
2706
|
+
f("p", { class: "w-crud-empty-title" }, "Nenhum registro encontrado"),
|
|
2707
|
+
f("p", { class: "w-crud-empty-text" }, "Tente ajustar sua busca ou crie um novo registro")
|
|
2708
|
+
], -1))
|
|
2709
|
+
])
|
|
2710
|
+
]),
|
|
2711
|
+
default: H(() => [
|
|
2712
|
+
l.value ? (n(), S(u(Oe), {
|
|
2713
|
+
key: 0,
|
|
2714
|
+
"selection-mode": "multiple",
|
|
2715
|
+
style: { width: "3rem" }
|
|
2716
|
+
})) : k("", !0),
|
|
2717
|
+
e.expandable ? (n(), S(u(Oe), {
|
|
2718
|
+
key: 1,
|
|
2719
|
+
expander: "",
|
|
2720
|
+
style: { width: "3rem" }
|
|
2721
|
+
})) : k("", !0),
|
|
2722
|
+
(n(!0), m(te, null, ie(J.value, (r) => (n(), S(u(Oe), {
|
|
2723
|
+
key: r.field,
|
|
2724
|
+
field: r.field,
|
|
2725
|
+
header: r.header,
|
|
2726
|
+
sortable: r.sortable,
|
|
2727
|
+
style: ye(r.style),
|
|
2728
|
+
"header-class": ce(r),
|
|
2729
|
+
"body-class": ce(r)
|
|
2730
|
+
}, Je({
|
|
2731
|
+
body: H(({ data: N }) => [
|
|
2732
|
+
B(c.$slots, `column-${r.field}`, {
|
|
2733
|
+
data: N,
|
|
2734
|
+
value: N[r.field]
|
|
2735
|
+
}, () => [
|
|
2736
|
+
P(ht, {
|
|
2737
|
+
column: r,
|
|
2738
|
+
value: N[r.field],
|
|
2739
|
+
"row-data": N
|
|
2740
|
+
}, null, 8, ["column", "value", "row-data"])
|
|
2741
|
+
])
|
|
2742
|
+
]),
|
|
2743
|
+
_: 2
|
|
2744
|
+
}, [
|
|
2745
|
+
C.value && oe(r.field) ? {
|
|
2746
|
+
name: "editor",
|
|
2747
|
+
fn: H(({ data: N }) => {
|
|
2748
|
+
var Q;
|
|
2749
|
+
return [
|
|
2750
|
+
["number", "currency"].includes(((Q = oe(r.field)) == null ? void 0 : Q.type) || "") ? (n(), S(u(ot), {
|
|
2751
|
+
key: 0,
|
|
2752
|
+
"model-value": N[r.field] ?? null,
|
|
2753
|
+
fluid: "",
|
|
2754
|
+
"onUpdate:modelValue": (xe) => {
|
|
2755
|
+
N[r.field] = xe;
|
|
2756
|
+
}
|
|
2757
|
+
}, null, 8, ["model-value", "onUpdate:modelValue"])) : (n(), S(u(de), {
|
|
2758
|
+
key: 1,
|
|
2759
|
+
"model-value": N[r.field] ?? "",
|
|
2760
|
+
fluid: "",
|
|
2761
|
+
"onUpdate:modelValue": (xe) => {
|
|
2762
|
+
N[r.field] = xe;
|
|
2763
|
+
}
|
|
2764
|
+
}, null, 8, ["model-value", "onUpdate:modelValue"]))
|
|
2765
|
+
];
|
|
2766
|
+
}),
|
|
2767
|
+
key: "0"
|
|
2768
|
+
} : void 0
|
|
2769
|
+
]), 1032, ["field", "header", "sortable", "style", "header-class", "body-class"]))), 128)),
|
|
2770
|
+
De.value && !e.actionRail ? (n(), S(u(Oe), {
|
|
2771
|
+
key: 2,
|
|
2772
|
+
"header-class": "w-crud-actions-header",
|
|
2773
|
+
style: ye({
|
|
2774
|
+
width: `${(me.value.length + (u(i)["row-actions"] ? 1 : 0)) * 2.5 + 1}rem`
|
|
2775
|
+
})
|
|
2776
|
+
}, {
|
|
2777
|
+
body: H(({ data: r }) => [
|
|
2778
|
+
f("div", co, [
|
|
2779
|
+
(n(!0), m(te, null, ie(me.value, (N) => (n(), m(te, {
|
|
2780
|
+
key: N.action
|
|
2781
|
+
}, [
|
|
2782
|
+
be(N, r) ? ue((n(), S(u(O), {
|
|
2783
|
+
key: 0,
|
|
2784
|
+
icon: N.icon,
|
|
2785
|
+
text: "",
|
|
2786
|
+
rounded: "",
|
|
2787
|
+
size: "small",
|
|
2788
|
+
severity: N.severity,
|
|
2789
|
+
disabled: Ee(N, r),
|
|
2790
|
+
onClick: (Q) => ve(N, r)
|
|
2791
|
+
}, null, 8, ["icon", "severity", "disabled", "onClick"])), [
|
|
2792
|
+
[
|
|
2793
|
+
q,
|
|
2794
|
+
N.tooltip,
|
|
2795
|
+
void 0,
|
|
2796
|
+
{ top: !0 }
|
|
2797
|
+
]
|
|
2798
|
+
]) : k("", !0)
|
|
2799
|
+
], 64))), 128)),
|
|
2800
|
+
B(c.$slots, "row-actions", {
|
|
2801
|
+
data: r,
|
|
2802
|
+
crud: e.crud
|
|
2803
|
+
})
|
|
2804
|
+
])
|
|
2805
|
+
]),
|
|
2806
|
+
_: 3
|
|
2807
|
+
}, 8, ["style"])) : k("", !0)
|
|
2808
|
+
]),
|
|
2809
|
+
_: 2
|
|
2810
|
+
}, [
|
|
2811
|
+
e.expandable ? {
|
|
2812
|
+
name: "expansion",
|
|
2813
|
+
fn: H((r) => [
|
|
2814
|
+
B(c.$slots, "expansion", {
|
|
2815
|
+
data: r.data
|
|
2816
|
+
})
|
|
2817
|
+
]),
|
|
2818
|
+
key: "0"
|
|
2819
|
+
} : void 0
|
|
2820
|
+
]), 1032, ["expanded-rows", "value", "loading", "rows", "total-records", "sort-field", "sort-order", "data-key", "edit-mode", "selection", "selection-mode", "context-menu", "context-menu-selection", "onPage"])
|
|
2821
|
+
])) : (n(), m("div", mo, [
|
|
2822
|
+
f("div", fo, [
|
|
2823
|
+
f("div", vo, [
|
|
2824
|
+
e.showSearch ? (n(), S(u(ze), { key: 0 }, {
|
|
2825
|
+
default: H(() => [
|
|
2826
|
+
P(u(We), { class: "pi pi-search" }),
|
|
2827
|
+
P(u(de), {
|
|
2828
|
+
"model-value": e.crud.search.value,
|
|
2829
|
+
placeholder: "Buscar...",
|
|
2830
|
+
class: "w-72",
|
|
2831
|
+
onInput: e.crud.onSearch
|
|
2832
|
+
}, null, 8, ["model-value", "onInput"])
|
|
2833
|
+
]),
|
|
2834
|
+
_: 1
|
|
2835
|
+
})) : k("", !0),
|
|
2836
|
+
B(c.$slots, "toolbar-start"),
|
|
2837
|
+
B(c.$slots, "toolbar-filters")
|
|
2838
|
+
]),
|
|
2839
|
+
f("div", po, [
|
|
2840
|
+
B(c.$slots, "toolbar-actions"),
|
|
2841
|
+
e.exportCsv ? ue((n(), S(u(O), {
|
|
2842
|
+
key: 0,
|
|
2843
|
+
icon: "pi pi-download",
|
|
2844
|
+
text: "",
|
|
2845
|
+
size: "small",
|
|
2846
|
+
loading: Me.value,
|
|
2847
|
+
onClick: qe
|
|
2848
|
+
}, null, 8, ["loading"])), [
|
|
2849
|
+
[
|
|
2850
|
+
q,
|
|
2851
|
+
e.csvScope === "all" ? "Exportar tudo (CSV)" : "Exportar página (CSV)",
|
|
2852
|
+
void 0,
|
|
2853
|
+
{ top: !0 }
|
|
2854
|
+
]
|
|
2855
|
+
]) : k("", !0),
|
|
2856
|
+
e.viewToggle ? (n(), m("div", ho, [
|
|
2857
|
+
P(u(O), {
|
|
2858
|
+
icon: "pi pi-table",
|
|
2859
|
+
size: "small",
|
|
2860
|
+
text: !I("table"),
|
|
2861
|
+
outlined: I("table"),
|
|
2862
|
+
onClick: v[13] || (v[13] = (r) => $("table"))
|
|
2863
|
+
}, null, 8, ["text", "outlined"]),
|
|
2864
|
+
P(u(O), {
|
|
2865
|
+
icon: "pi pi-th-large",
|
|
2866
|
+
size: "small",
|
|
2867
|
+
text: !I("cards"),
|
|
2868
|
+
outlined: I("cards"),
|
|
2869
|
+
onClick: v[14] || (v[14] = (r) => $("cards"))
|
|
2870
|
+
}, null, 8, ["text", "outlined"])
|
|
2871
|
+
])) : k("", !0),
|
|
2872
|
+
!e.showHeader && g.value && !e.actionRail ? (n(), S(u(O), {
|
|
2873
|
+
key: 2,
|
|
2874
|
+
label: "Novo",
|
|
2875
|
+
icon: "pi pi-plus",
|
|
2876
|
+
onClick: v[15] || (v[15] = (r) => e.crud.openCreateDialog())
|
|
2877
|
+
})) : k("", !0)
|
|
2878
|
+
])
|
|
2879
|
+
]),
|
|
2880
|
+
e.crud.loading.value ? (n(), m("div", yo, [...v[23] || (v[23] = [
|
|
2881
|
+
f("i", { class: "pi pi-spin pi-spinner" }, null, -1)
|
|
2882
|
+
])])) : e.crud.items.value.length ? (n(), m("div", {
|
|
2883
|
+
key: 2,
|
|
2884
|
+
class: le(["w-crud-cards", { "w-crud-cards--bare": e.cardBare }])
|
|
2885
|
+
}, [
|
|
2886
|
+
(n(!0), m(te, null, ie(e.crud.items.value, (r, N) => (n(), m("div", {
|
|
2887
|
+
key: r[e.crud.config.pk || "id"] ?? N,
|
|
2888
|
+
class: le(
|
|
2889
|
+
e.cardBare ? "w-crud-card-bare" : ["w-crud-card", { "w-crud-card--selected": y.value === r }]
|
|
2890
|
+
),
|
|
2891
|
+
onClick: (Q) => !e.cardBare && Be(r),
|
|
2892
|
+
onDblclick: (Q) => !e.cardBare && e.crud.config.canEdit !== !1 && e.crud.openEditDialog(r),
|
|
2893
|
+
onContextmenu: (Q) => !e.cardBare && je(Q, r)
|
|
2894
|
+
}, [
|
|
2895
|
+
B(c.$slots, "card", {
|
|
2896
|
+
data: r,
|
|
2897
|
+
crud: e.crud,
|
|
2898
|
+
columns: ke.value,
|
|
2899
|
+
index: N
|
|
2900
|
+
}, () => [
|
|
2901
|
+
f("div", bo, [
|
|
2902
|
+
(n(!0), m(te, null, ie(ke.value, (Q, xe) => (n(), m("div", {
|
|
2903
|
+
key: Q.field,
|
|
2904
|
+
class: le(["w-crud-card-row", { "w-crud-card-row--title": xe === 0 }])
|
|
2905
|
+
}, [
|
|
2906
|
+
xe !== 0 ? (n(), m("span", ko, A(Q.header), 1)) : k("", !0),
|
|
2907
|
+
f("span", wo, [
|
|
2908
|
+
B(c.$slots, `column-${Q.field}`, {
|
|
2909
|
+
data: r,
|
|
2910
|
+
value: r[Q.field]
|
|
2911
|
+
}, () => [
|
|
2912
|
+
P(ht, {
|
|
2913
|
+
column: Q,
|
|
2914
|
+
value: r[Q.field],
|
|
2915
|
+
"row-data": r
|
|
2916
|
+
}, null, 8, ["column", "value", "row-data"])
|
|
2917
|
+
])
|
|
2918
|
+
])
|
|
2919
|
+
], 2))), 128))
|
|
2920
|
+
]),
|
|
2921
|
+
De.value && !e.actionRail ? (n(), m("div", $o, [
|
|
2922
|
+
(n(!0), m(te, null, ie(me.value, (Q) => (n(), m(te, {
|
|
2923
|
+
key: Q.action
|
|
2924
|
+
}, [
|
|
2925
|
+
be(Q, r) ? ue((n(), S(u(O), {
|
|
2926
|
+
key: 0,
|
|
2927
|
+
icon: Q.icon,
|
|
2928
|
+
text: "",
|
|
2929
|
+
rounded: "",
|
|
2930
|
+
size: "small",
|
|
2931
|
+
severity: Q.severity,
|
|
2932
|
+
disabled: Ee(Q, r),
|
|
2933
|
+
onClick: (xe) => ve(Q, r)
|
|
2934
|
+
}, null, 8, ["icon", "severity", "disabled", "onClick"])), [
|
|
2935
|
+
[
|
|
2936
|
+
q,
|
|
2937
|
+
Q.tooltip,
|
|
2938
|
+
void 0,
|
|
2939
|
+
{ top: !0 }
|
|
2940
|
+
]
|
|
2941
|
+
]) : k("", !0)
|
|
2942
|
+
], 64))), 128)),
|
|
2943
|
+
B(c.$slots, "row-actions", {
|
|
2944
|
+
data: r,
|
|
2945
|
+
crud: e.crud
|
|
2946
|
+
})
|
|
2947
|
+
])) : k("", !0)
|
|
2948
|
+
])
|
|
2949
|
+
], 42, go))), 128))
|
|
2950
|
+
], 2)) : B(c.$slots, "empty", {}, () => [
|
|
2951
|
+
v[24] || (v[24] = tl('<div class="w-crud-empty"><div class="w-crud-empty-icon"><i class="pi pi-inbox"></i></div><p class="w-crud-empty-title">Nenhum registro encontrado</p><p class="w-crud-empty-text">Tente ajustar sua busca ou crie um novo registro</p></div>', 1))
|
|
2952
|
+
], void 0, 1),
|
|
2953
|
+
e.crud.items.value.length ? (n(), S(u(al), {
|
|
2954
|
+
key: 3,
|
|
2955
|
+
rows: e.crud.pagination.pageSize,
|
|
2956
|
+
"total-records": e.crud.pagination.rows,
|
|
2957
|
+
first: z.value,
|
|
2958
|
+
"rows-per-page-options": [10, 20, 50],
|
|
2959
|
+
template: "CurrentPageReport PrevPageLink NextPageLink",
|
|
2960
|
+
"current-page-report-template": "Página {currentPage} de {totalPages}",
|
|
2961
|
+
class: "w-crud-paginator",
|
|
2962
|
+
onPage: e.crud.onPage
|
|
2963
|
+
}, null, 8, ["rows", "total-records", "first", "onPage"])) : k("", !0)
|
|
2964
|
+
]))
|
|
2965
|
+
]),
|
|
2966
|
+
e.actionRail ? (n(), m("aside", xo, [
|
|
2967
|
+
g.value ? ue((n(), S(u(O), {
|
|
2968
|
+
key: 0,
|
|
2969
|
+
icon: "pi pi-plus",
|
|
2970
|
+
rounded: "",
|
|
2971
|
+
onClick: v[16] || (v[16] = (r) => e.crud.openCreateDialog())
|
|
2972
|
+
}, null, 512)), [
|
|
2973
|
+
[
|
|
2974
|
+
q,
|
|
2975
|
+
"Novo",
|
|
2976
|
+
void 0,
|
|
2977
|
+
{ left: !0 }
|
|
2978
|
+
]
|
|
2979
|
+
]) : k("", !0),
|
|
2980
|
+
g.value && me.value.length ? (n(), m("div", Co)) : k("", !0),
|
|
2981
|
+
(n(!0), m(te, null, ie(me.value, (r) => (n(), m(te, {
|
|
2982
|
+
key: r.action
|
|
2983
|
+
}, [
|
|
2984
|
+
!y.value || be(r, y.value) ? ue((n(), S(u(O), {
|
|
2985
|
+
key: 0,
|
|
2986
|
+
icon: r.icon,
|
|
2987
|
+
text: "",
|
|
2988
|
+
rounded: "",
|
|
2989
|
+
severity: r.severity,
|
|
2990
|
+
disabled: !y.value || Ee(r, y.value),
|
|
2991
|
+
onClick: (N) => y.value && ve(r, y.value)
|
|
2992
|
+
}, null, 8, ["icon", "severity", "disabled", "onClick"])), [
|
|
2993
|
+
[
|
|
2994
|
+
q,
|
|
2995
|
+
r.tooltip,
|
|
2996
|
+
void 0,
|
|
2997
|
+
{ left: !0 }
|
|
2998
|
+
]
|
|
2999
|
+
]) : k("", !0)
|
|
3000
|
+
], 64))), 128)),
|
|
3001
|
+
B(c.$slots, "rail-actions", {
|
|
3002
|
+
selected: y.value,
|
|
3003
|
+
crud: e.crud
|
|
3004
|
+
}),
|
|
3005
|
+
e.showPrint || e.exportCsv ? (n(), m("div", Vo)) : k("", !0),
|
|
3006
|
+
e.showPrint ? ue((n(), S(u(O), {
|
|
3007
|
+
key: 3,
|
|
3008
|
+
icon: "pi pi-print",
|
|
3009
|
+
text: "",
|
|
3010
|
+
rounded: "",
|
|
3011
|
+
disabled: !y.value,
|
|
3012
|
+
onClick: Ze
|
|
3013
|
+
}, null, 8, ["disabled"])), [
|
|
3014
|
+
[
|
|
3015
|
+
q,
|
|
3016
|
+
"Imprimir",
|
|
3017
|
+
void 0,
|
|
3018
|
+
{ left: !0 }
|
|
3019
|
+
]
|
|
3020
|
+
]) : k("", !0),
|
|
3021
|
+
e.exportCsv ? ue((n(), S(u(O), {
|
|
3022
|
+
key: 4,
|
|
3023
|
+
icon: "pi pi-download",
|
|
3024
|
+
text: "",
|
|
3025
|
+
rounded: "",
|
|
3026
|
+
loading: Me.value,
|
|
3027
|
+
onClick: qe
|
|
3028
|
+
}, null, 8, ["loading"])), [
|
|
3029
|
+
[
|
|
3030
|
+
q,
|
|
3031
|
+
e.csvScope === "all" ? "Exportar tudo (CSV)" : "Exportar página (CSV)",
|
|
3032
|
+
void 0,
|
|
3033
|
+
{ left: !0 }
|
|
3034
|
+
]
|
|
3035
|
+
]) : k("", !0)
|
|
3036
|
+
])) : k("", !0)
|
|
3037
|
+
], 2),
|
|
3038
|
+
e.contextMenu ? (n(), S(u(ol), {
|
|
3039
|
+
key: 1,
|
|
3040
|
+
ref_key: "cm",
|
|
3041
|
+
ref: Pe,
|
|
3042
|
+
model: it.value
|
|
3043
|
+
}, null, 8, ["model"])) : k("", !0),
|
|
3044
|
+
B(c.$slots, "form-dialog", {
|
|
3045
|
+
crud: e.crud,
|
|
3046
|
+
dialogWidth: e.dialogWidth
|
|
3047
|
+
}, () => {
|
|
3048
|
+
var r;
|
|
3049
|
+
return [
|
|
3050
|
+
P(Tt, {
|
|
3051
|
+
visible: e.crud.dialogVisible.value,
|
|
3052
|
+
title: e.crud.dialogTitle.value,
|
|
3053
|
+
fields: e.crud.config.form,
|
|
3054
|
+
"form-data": e.crud.formData,
|
|
3055
|
+
"is-editing": e.crud.isEditing.value,
|
|
3056
|
+
saving: e.crud.saving.value,
|
|
3057
|
+
disabled: ((r = e.crud.viewMode) == null ? void 0 : r.value) ?? !1,
|
|
3058
|
+
width: e.dialogWidth,
|
|
3059
|
+
"form-columns": e.formColumns ?? e.crud.config.formColumns,
|
|
3060
|
+
"keyboard-nav": e.crud.config.keyboardNav,
|
|
3061
|
+
"onUpdate:visible": v[17] || (v[17] = (N) => {
|
|
3062
|
+
e.crud.dialogVisible.value = N, N || (e.crud.editingItem.value = null);
|
|
3063
|
+
}),
|
|
3064
|
+
"onUpdate:field": v[18] || (v[18] = (N, Q) => e.crud.setFormField(N, Q)),
|
|
3065
|
+
onSave: v[19] || (v[19] = (N) => e.crud.save())
|
|
3066
|
+
}, Je({ _: 2 }, [
|
|
3067
|
+
ie(e.crud.config.form, (N) => ({
|
|
3068
|
+
name: `field-${N.field}`,
|
|
3069
|
+
fn: H((Q) => [
|
|
3070
|
+
B(c.$slots, `field-${N.field}`, ft(vt(Q)))
|
|
3071
|
+
])
|
|
3072
|
+
}))
|
|
3073
|
+
]), 1032, ["visible", "title", "fields", "form-data", "is-editing", "saving", "disabled", "width", "form-columns", "keyboard-nav"])
|
|
3074
|
+
];
|
|
3075
|
+
}),
|
|
3076
|
+
c.$slots["delete-message"] ? (n(), S(u(nt), {
|
|
3077
|
+
key: 2,
|
|
3078
|
+
visible: pe.value,
|
|
3079
|
+
"onUpdate:visible": v[21] || (v[21] = (r) => pe.value = r),
|
|
3080
|
+
header: "Confirmar Exclusão",
|
|
3081
|
+
modal: "",
|
|
3082
|
+
draggable: !1,
|
|
3083
|
+
class: "w-crud-delete-dialog",
|
|
3084
|
+
style: { width: "30rem" }
|
|
3085
|
+
}, {
|
|
3086
|
+
footer: H(() => [
|
|
3087
|
+
P(u(O), {
|
|
3088
|
+
type: "button",
|
|
3089
|
+
label: "Cancelar",
|
|
3090
|
+
severity: "secondary",
|
|
3091
|
+
text: "",
|
|
3092
|
+
disabled: ge.value,
|
|
3093
|
+
onClick: v[20] || (v[20] = (r) => pe.value = !1)
|
|
3094
|
+
}, null, 8, ["disabled"]),
|
|
3095
|
+
P(u(O), {
|
|
3096
|
+
type: "button",
|
|
3097
|
+
label: "Excluir",
|
|
3098
|
+
icon: "pi pi-trash",
|
|
3099
|
+
severity: "danger",
|
|
3100
|
+
loading: ge.value,
|
|
3101
|
+
onClick: we
|
|
3102
|
+
}, null, 8, ["loading"])
|
|
3103
|
+
]),
|
|
3104
|
+
default: H(() => [
|
|
3105
|
+
B(c.$slots, "delete-message", { item: fe.value })
|
|
3106
|
+
]),
|
|
3107
|
+
_: 3
|
|
3108
|
+
}, 8, ["visible"])) : k("", !0)
|
|
3109
|
+
]);
|
|
3110
|
+
};
|
|
3111
|
+
}
|
|
3112
|
+
}), vi = /* @__PURE__ */ se({
|
|
3113
|
+
__name: "WDateRange",
|
|
3114
|
+
props: {
|
|
3115
|
+
modelValue: { default: null },
|
|
3116
|
+
placeholder: { default: "Selecione o período" },
|
|
3117
|
+
minDate: {},
|
|
3118
|
+
maxDate: {},
|
|
3119
|
+
showButtonBar: { type: Boolean, default: !0 },
|
|
3120
|
+
disabled: { type: Boolean, default: !1 }
|
|
3121
|
+
},
|
|
3122
|
+
emits: ["update:modelValue"],
|
|
3123
|
+
setup(e, { emit: a }) {
|
|
3124
|
+
const t = a;
|
|
3125
|
+
function o(i) {
|
|
3126
|
+
t("update:modelValue", i ?? null);
|
|
3127
|
+
}
|
|
3128
|
+
return (i, d) => (n(), S(u(At), {
|
|
3129
|
+
"model-value": e.modelValue ?? void 0,
|
|
3130
|
+
"selection-mode": "range",
|
|
3131
|
+
placeholder: e.placeholder,
|
|
3132
|
+
"min-date": e.minDate,
|
|
3133
|
+
"max-date": e.maxDate,
|
|
3134
|
+
"show-button-bar": e.showButtonBar,
|
|
3135
|
+
disabled: e.disabled,
|
|
3136
|
+
"date-format": "dd/mm/yy",
|
|
3137
|
+
fluid: "",
|
|
3138
|
+
"onUpdate:modelValue": o
|
|
3139
|
+
}, null, 8, ["model-value", "placeholder", "min-date", "max-date", "show-button-bar", "disabled"]));
|
|
3140
|
+
}
|
|
3141
|
+
}), So = "g:", Do = "n:";
|
|
3142
|
+
function ct(e) {
|
|
3143
|
+
return String(e ?? "").normalize("NFD").replace(new RegExp("\\p{Diacritic}", "gu"), "").toLocaleLowerCase();
|
|
3144
|
+
}
|
|
3145
|
+
function Eo(e, { optionValue: a = "id", optionLabel: t = "nome", groupBy: o, groupLabel: i } = {}) {
|
|
3146
|
+
const d = [], h = /* @__PURE__ */ new Map();
|
|
3147
|
+
for (const V of e ?? []) {
|
|
3148
|
+
const x = V[a];
|
|
3149
|
+
if (x == null) continue;
|
|
3150
|
+
const w = {
|
|
3151
|
+
key: `${Do}${x}`,
|
|
3152
|
+
label: String(V[t] ?? x),
|
|
3153
|
+
value: x,
|
|
3154
|
+
data: V,
|
|
3155
|
+
leaf: !0
|
|
3156
|
+
}, I = o ? V[o] : void 0;
|
|
3157
|
+
if (I == null || I === "") {
|
|
3158
|
+
d.push(w);
|
|
3159
|
+
continue;
|
|
3160
|
+
}
|
|
3161
|
+
const $ = String(I);
|
|
3162
|
+
let z = h.get($);
|
|
3163
|
+
z || (z = {
|
|
3164
|
+
key: `${So}${$}`,
|
|
3165
|
+
label: i ? i($) : $,
|
|
3166
|
+
children: [],
|
|
3167
|
+
leaf: !1
|
|
3168
|
+
}, h.set($, z), d.push(z)), z.children.push(w);
|
|
3169
|
+
}
|
|
3170
|
+
return d;
|
|
3171
|
+
}
|
|
3172
|
+
function bt(e) {
|
|
3173
|
+
var a;
|
|
3174
|
+
return (a = e.children) != null && a.length ? e.children.flatMap(bt) : e.value === void 0 ? [] : [e.value];
|
|
3175
|
+
}
|
|
3176
|
+
function mt(e) {
|
|
3177
|
+
return e.flatMap(bt);
|
|
3178
|
+
}
|
|
3179
|
+
function Fo(e) {
|
|
3180
|
+
const a = /* @__PURE__ */ new Map(), t = (o) => {
|
|
3181
|
+
var i;
|
|
3182
|
+
a.set(o.key, o), (i = o.children) == null || i.forEach(t);
|
|
3183
|
+
};
|
|
3184
|
+
return e.forEach(t), a;
|
|
3185
|
+
}
|
|
3186
|
+
function Po(e, a) {
|
|
3187
|
+
const t = new Set(a ?? []), o = {}, i = (d) => {
|
|
3188
|
+
var x;
|
|
3189
|
+
if (!((x = d.children) != null && x.length)) {
|
|
3190
|
+
const w = d.value !== void 0 && t.has(d.value);
|
|
3191
|
+
return w && (o[d.key] = { checked: !0, partialChecked: !1 }), { checked: w, partialChecked: !1 };
|
|
3192
|
+
}
|
|
3193
|
+
let h = !0, V = !1;
|
|
3194
|
+
for (const w of d.children) {
|
|
3195
|
+
const I = i(w);
|
|
3196
|
+
I.checked ? V = !0 : h = !1, I.partialChecked && (V = !0, h = !1);
|
|
3197
|
+
}
|
|
3198
|
+
return h ? o[d.key] = { checked: !0, partialChecked: !1 } : V && (o[d.key] = { checked: !1, partialChecked: !0 }), { checked: h, partialChecked: !h && V };
|
|
3199
|
+
};
|
|
3200
|
+
return e.forEach(i), o;
|
|
3201
|
+
}
|
|
3202
|
+
function Lt(e, a, t = []) {
|
|
3203
|
+
var h;
|
|
3204
|
+
const o = ct(a).trim();
|
|
3205
|
+
if (!o) return [...e];
|
|
3206
|
+
const i = (V) => ct(V.label).includes(o) ? !0 : t.some((x) => {
|
|
3207
|
+
var w;
|
|
3208
|
+
return ct((w = V.data) == null ? void 0 : w[x]).includes(o);
|
|
3209
|
+
}), d = [];
|
|
3210
|
+
for (const V of e) {
|
|
3211
|
+
if (!((h = V.children) != null && h.length)) {
|
|
3212
|
+
i(V) && d.push(V);
|
|
3213
|
+
continue;
|
|
3214
|
+
}
|
|
3215
|
+
if (i(V)) {
|
|
3216
|
+
d.push(V);
|
|
3217
|
+
continue;
|
|
3218
|
+
}
|
|
3219
|
+
const x = Lt(V.children, a, t);
|
|
3220
|
+
x.length && d.push({ ...V, children: x });
|
|
3221
|
+
}
|
|
3222
|
+
return d;
|
|
3223
|
+
}
|
|
3224
|
+
function Mo(e, a, t) {
|
|
3225
|
+
const o = new Set(a);
|
|
3226
|
+
if (!t) return (e ?? []).filter((h) => !o.has(h));
|
|
3227
|
+
const i = [...e ?? []], d = new Set(i);
|
|
3228
|
+
for (const h of a)
|
|
3229
|
+
d.has(h) || (d.add(h), i.push(h));
|
|
3230
|
+
return i;
|
|
3231
|
+
}
|
|
3232
|
+
const Io = {
|
|
3233
|
+
key: 0,
|
|
3234
|
+
class: "w-tree-select__head"
|
|
3235
|
+
}, Ro = {
|
|
3236
|
+
key: 0,
|
|
3237
|
+
class: "w-tree-select__count"
|
|
3238
|
+
}, Ao = { key: 1 }, Bo = {
|
|
3239
|
+
key: 2,
|
|
3240
|
+
class: "w-tree-select__actions"
|
|
3241
|
+
}, Uo = {
|
|
3242
|
+
key: 2,
|
|
3243
|
+
class: "w-tree-select__empty"
|
|
3244
|
+
}, pi = /* @__PURE__ */ se({
|
|
3245
|
+
__name: "WTreeSelect",
|
|
3246
|
+
props: {
|
|
3247
|
+
modelValue: { default: () => [] },
|
|
3248
|
+
options: { default: () => [] },
|
|
3249
|
+
optionValue: { default: "id" },
|
|
3250
|
+
optionLabel: { default: "nome" },
|
|
3251
|
+
groupBy: {},
|
|
3252
|
+
groupLabel: {},
|
|
3253
|
+
filter: { type: Boolean, default: !1 },
|
|
3254
|
+
filterPlaceholder: { default: "Buscar..." },
|
|
3255
|
+
filterFields: { default: () => [] },
|
|
3256
|
+
loading: { type: Boolean, default: !1 },
|
|
3257
|
+
disabled: { type: Boolean, default: !1 },
|
|
3258
|
+
emptyMessage: { default: "Nenhum item disponível" },
|
|
3259
|
+
filterEmptyMessage: { default: "Nenhum item encontrado" },
|
|
3260
|
+
showCount: { type: Boolean, default: !0 },
|
|
3261
|
+
showToggleAll: { type: Boolean, default: !0 },
|
|
3262
|
+
defaultExpanded: { type: Boolean, default: !1 },
|
|
3263
|
+
ariaLabel: {}
|
|
3264
|
+
},
|
|
3265
|
+
emits: ["update:modelValue"],
|
|
3266
|
+
setup(e, { emit: a }) {
|
|
3267
|
+
const t = e, o = a, i = T(""), d = T({}), h = D(
|
|
3268
|
+
() => Eo(t.options, {
|
|
3269
|
+
optionValue: t.optionValue,
|
|
3270
|
+
optionLabel: t.optionLabel,
|
|
3271
|
+
groupBy: t.groupBy,
|
|
3272
|
+
groupLabel: t.groupLabel
|
|
3273
|
+
})
|
|
3274
|
+
), V = D(() => Fo(h.value)), x = D(() => t.filter && i.value.trim().length > 0), w = D(
|
|
3275
|
+
() => x.value ? Lt(h.value, i.value, t.filterFields) : h.value
|
|
3276
|
+
), I = D(() => Po(h.value, t.modelValue)), $ = D(() => mt(h.value).length), z = D(() => {
|
|
3277
|
+
const K = new Set(mt(h.value));
|
|
3278
|
+
return t.modelValue.filter((Z) => K.has(Z)).length;
|
|
3279
|
+
}), G = D(
|
|
3280
|
+
() => (t.showCount || t.showToggleAll) && ($.value > 0 || t.loading)
|
|
3281
|
+
), Y = D(() => !t.loading && w.value.length === 0), X = D(
|
|
3282
|
+
() => x.value ? t.filterEmptyMessage : t.emptyMessage
|
|
3283
|
+
);
|
|
3284
|
+
function R(K) {
|
|
3285
|
+
var J;
|
|
3286
|
+
const Z = { ...d.value };
|
|
3287
|
+
for (const ce of K) (J = ce.children) != null && J.length && (Z[ce.key] = !0);
|
|
3288
|
+
d.value = Z;
|
|
3289
|
+
}
|
|
3290
|
+
const L = /* @__PURE__ */ new Set();
|
|
3291
|
+
Ve(
|
|
3292
|
+
h,
|
|
3293
|
+
(K) => {
|
|
3294
|
+
if (!t.defaultExpanded) return;
|
|
3295
|
+
const Z = K.filter((J) => {
|
|
3296
|
+
var ce;
|
|
3297
|
+
return ((ce = J.children) == null ? void 0 : ce.length) && !L.has(J.key);
|
|
3298
|
+
});
|
|
3299
|
+
Z.length && (Z.forEach((J) => L.add(J.key)), R(Z));
|
|
3300
|
+
},
|
|
3301
|
+
{ immediate: !0 }
|
|
3302
|
+
), Ve(i, (K) => {
|
|
3303
|
+
K.trim() && R(w.value);
|
|
3304
|
+
});
|
|
3305
|
+
function W(K, Z) {
|
|
3306
|
+
if (t.disabled) return;
|
|
3307
|
+
const J = V.value.get(K.key);
|
|
3308
|
+
J && o("update:modelValue", Mo(t.modelValue, bt(J), Z));
|
|
3309
|
+
}
|
|
3310
|
+
function F() {
|
|
3311
|
+
t.disabled || o("update:modelValue", mt(h.value));
|
|
3312
|
+
}
|
|
3313
|
+
function j() {
|
|
3314
|
+
t.disabled || o("update:modelValue", []);
|
|
3315
|
+
}
|
|
3316
|
+
return (K, Z) => (n(), m("div", {
|
|
3317
|
+
class: le(["w-tree-select", { "w-tree-select--disabled": e.disabled }])
|
|
3318
|
+
}, [
|
|
3319
|
+
B(K.$slots, "header", {
|
|
3320
|
+
selectedCount: z.value,
|
|
3321
|
+
total: $.value
|
|
3322
|
+
}, () => [
|
|
3323
|
+
G.value ? (n(), m("div", Io, [
|
|
3324
|
+
e.showCount ? (n(), m("span", Ro, A(z.value) + " de " + A($.value) + " selecionados ", 1)) : (n(), m("span", Ao)),
|
|
3325
|
+
e.showToggleAll ? (n(), m("div", Bo, [
|
|
3326
|
+
P(u(O), {
|
|
3327
|
+
type: "button",
|
|
3328
|
+
label: "Marcar todos",
|
|
3329
|
+
text: "",
|
|
3330
|
+
"data-kbd-skip": "",
|
|
3331
|
+
tabindex: "-1",
|
|
3332
|
+
disabled: e.disabled || z.value === $.value || !$.value,
|
|
3333
|
+
onClick: F
|
|
3334
|
+
}, null, 8, ["disabled"]),
|
|
3335
|
+
P(u(O), {
|
|
3336
|
+
type: "button",
|
|
3337
|
+
label: "Limpar",
|
|
3338
|
+
text: "",
|
|
3339
|
+
"data-kbd-skip": "",
|
|
3340
|
+
tabindex: "-1",
|
|
3341
|
+
disabled: e.disabled || !z.value,
|
|
3342
|
+
onClick: j
|
|
3343
|
+
}, null, 8, ["disabled"])
|
|
3344
|
+
])) : k("", !0)
|
|
3345
|
+
])) : k("", !0)
|
|
3346
|
+
]),
|
|
3347
|
+
e.filter ? (n(), S(u(ze), {
|
|
3348
|
+
key: 0,
|
|
3349
|
+
class: "w-tree-select__filter"
|
|
3350
|
+
}, {
|
|
3351
|
+
default: H(() => [
|
|
3352
|
+
P(u(We), { class: "pi pi-search" }),
|
|
3353
|
+
P(u(de), {
|
|
3354
|
+
modelValue: i.value,
|
|
3355
|
+
"onUpdate:modelValue": Z[0] || (Z[0] = (J) => i.value = J),
|
|
3356
|
+
placeholder: e.filterPlaceholder,
|
|
3357
|
+
disabled: e.disabled,
|
|
3358
|
+
"aria-label": e.filterPlaceholder,
|
|
3359
|
+
"data-kbd-skip": "",
|
|
3360
|
+
fluid: ""
|
|
3361
|
+
}, null, 8, ["modelValue", "placeholder", "disabled", "aria-label"])
|
|
3362
|
+
]),
|
|
3363
|
+
_: 1
|
|
3364
|
+
})) : k("", !0),
|
|
3365
|
+
Y.value ? (n(), m("div", Uo, [
|
|
3366
|
+
B(K.$slots, "empty", { filtering: x.value }, () => [
|
|
3367
|
+
Fe(A(X.value), 1)
|
|
3368
|
+
])
|
|
3369
|
+
])) : (n(), S(u(hl), {
|
|
3370
|
+
key: 1,
|
|
3371
|
+
value: w.value,
|
|
3372
|
+
"selection-mode": "checkbox",
|
|
3373
|
+
"selection-keys": I.value,
|
|
3374
|
+
"expanded-keys": d.value,
|
|
3375
|
+
loading: e.loading,
|
|
3376
|
+
"aria-label": e.ariaLabel,
|
|
3377
|
+
class: "w-tree-select__tree",
|
|
3378
|
+
"onUpdate:expandedKeys": Z[1] || (Z[1] = (J) => d.value = J),
|
|
3379
|
+
onNodeSelect: Z[2] || (Z[2] = (J) => W(J, !0)),
|
|
3380
|
+
onNodeUnselect: Z[3] || (Z[3] = (J) => W(J, !1))
|
|
3381
|
+
}, {
|
|
3382
|
+
default: H((J) => [
|
|
3383
|
+
B(K.$slots, "node", {
|
|
3384
|
+
node: J.node
|
|
3385
|
+
}, () => [
|
|
3386
|
+
Fe(A(J.node.label), 1)
|
|
3387
|
+
])
|
|
3388
|
+
]),
|
|
3389
|
+
_: 3
|
|
3390
|
+
}, 8, ["value", "selection-keys", "expanded-keys", "loading", "aria-label"]))
|
|
3391
|
+
], 2));
|
|
3392
|
+
}
|
|
3393
|
+
}), To = /* @__PURE__ */ se({
|
|
3394
|
+
__name: "WStatusTag",
|
|
3395
|
+
props: {
|
|
3396
|
+
value: {},
|
|
3397
|
+
map: {}
|
|
3398
|
+
},
|
|
3399
|
+
setup(e) {
|
|
3400
|
+
const a = e, t = {
|
|
3401
|
+
ativo: { label: "Ativo", severity: "success" },
|
|
3402
|
+
ativa: { label: "Ativa", severity: "success" },
|
|
3403
|
+
inativo: { label: "Inativo", severity: "danger" },
|
|
3404
|
+
inativa: { label: "Inativa", severity: "danger" },
|
|
3405
|
+
suspensa: { label: "Suspensa", severity: "warn" },
|
|
3406
|
+
suspenso: { label: "Suspenso", severity: "warn" },
|
|
3407
|
+
cancelada: { label: "Cancelada", severity: "danger" },
|
|
3408
|
+
cancelado: { label: "Cancelado", severity: "danger" },
|
|
3409
|
+
pendente: { label: "Pendente", severity: "warn" },
|
|
3410
|
+
confirmada: { label: "Confirmada", severity: "success" },
|
|
3411
|
+
confirmado: { label: "Confirmado", severity: "success" },
|
|
3412
|
+
vencida: { label: "Vencida", severity: "danger" },
|
|
3413
|
+
vencido: { label: "Vencido", severity: "danger" },
|
|
3414
|
+
concluido: { label: "Concluído", severity: "success" },
|
|
3415
|
+
concluida: { label: "Concluída", severity: "success" },
|
|
3416
|
+
em_progresso: { label: "Em Progresso", severity: "info" },
|
|
3417
|
+
em_andamento: { label: "Em Andamento", severity: "info" },
|
|
3418
|
+
expirado: { label: "Expirado", severity: "secondary" },
|
|
3419
|
+
expirada: { label: "Expirada", severity: "secondary" },
|
|
3420
|
+
aberto: { label: "Aberto", severity: "info" },
|
|
3421
|
+
aberta: { label: "Aberta", severity: "info" },
|
|
3422
|
+
fechado: { label: "Fechado", severity: "secondary" },
|
|
3423
|
+
fechada: { label: "Fechada", severity: "secondary" },
|
|
3424
|
+
pago: { label: "Pago", severity: "success" },
|
|
3425
|
+
paga: { label: "Paga", severity: "success" },
|
|
3426
|
+
inadimplente: { label: "Inadimplente", severity: "danger" }
|
|
3427
|
+
}, o = D(() => (a.map ?? t)[a.value] ?? { label: a.value, severity: "secondary" });
|
|
3428
|
+
return (i, d) => (n(), S(u(It), {
|
|
3429
|
+
value: o.value.label,
|
|
3430
|
+
severity: o.value.severity
|
|
3431
|
+
}, null, 8, ["value", "severity"]));
|
|
3432
|
+
}
|
|
3433
|
+
}), Lo = { class: "w-page-header" }, No = { class: "w-page-header-content" }, Oo = { class: "w-page-header-title" }, zo = {
|
|
3434
|
+
key: 0,
|
|
3435
|
+
class: "w-page-header-subtitle"
|
|
3436
|
+
}, Wo = { class: "w-page-header-actions" }, hi = /* @__PURE__ */ se({
|
|
3437
|
+
__name: "WPageHeader",
|
|
3438
|
+
props: {
|
|
3439
|
+
title: {},
|
|
3440
|
+
subtitle: {},
|
|
3441
|
+
actionLabel: {},
|
|
3442
|
+
actionIcon: {}
|
|
3443
|
+
},
|
|
3444
|
+
emits: ["action"],
|
|
3445
|
+
setup(e, { emit: a }) {
|
|
3446
|
+
const t = a;
|
|
3447
|
+
return (o, i) => (n(), m("div", Lo, [
|
|
3448
|
+
f("div", No, [
|
|
3449
|
+
f("h2", Oo, A(e.title), 1),
|
|
3450
|
+
e.subtitle ? (n(), m("p", zo, A(e.subtitle), 1)) : k("", !0)
|
|
3451
|
+
]),
|
|
3452
|
+
f("div", Wo, [
|
|
3453
|
+
B(o.$slots, "actions"),
|
|
3454
|
+
e.actionLabel ? (n(), S(u(O), {
|
|
3455
|
+
key: 0,
|
|
3456
|
+
label: e.actionLabel,
|
|
3457
|
+
icon: e.actionIcon,
|
|
3458
|
+
onClick: i[0] || (i[0] = (d) => t("action"))
|
|
3459
|
+
}, null, 8, ["label", "icon"])) : k("", !0)
|
|
3460
|
+
])
|
|
3461
|
+
]));
|
|
3462
|
+
}
|
|
3463
|
+
}), jo = { class: "w-empty-state" }, qo = { class: "w-empty-state-icon" }, Ko = { class: "w-empty-state-title" }, Ho = {
|
|
3464
|
+
key: 0,
|
|
3465
|
+
class: "w-empty-state-description"
|
|
3466
|
+
}, yi = /* @__PURE__ */ se({
|
|
3467
|
+
__name: "WEmptyState",
|
|
3468
|
+
props: {
|
|
3469
|
+
icon: {},
|
|
3470
|
+
title: {},
|
|
3471
|
+
description: {},
|
|
3472
|
+
actionLabel: {},
|
|
3473
|
+
actionIcon: {}
|
|
3474
|
+
},
|
|
3475
|
+
emits: ["action"],
|
|
3476
|
+
setup(e, { emit: a }) {
|
|
3477
|
+
const t = a;
|
|
3478
|
+
return (o, i) => (n(), m("div", jo, [
|
|
3479
|
+
f("div", qo, [
|
|
3480
|
+
f("i", {
|
|
3481
|
+
class: le(e.icon)
|
|
3482
|
+
}, null, 2)
|
|
3483
|
+
]),
|
|
3484
|
+
f("p", Ko, A(e.title), 1),
|
|
3485
|
+
e.description ? (n(), m("p", Ho, A(e.description), 1)) : k("", !0),
|
|
3486
|
+
e.actionLabel ? (n(), S(u(O), {
|
|
3487
|
+
key: 1,
|
|
3488
|
+
label: e.actionLabel,
|
|
3489
|
+
icon: e.actionIcon,
|
|
3490
|
+
size: "small",
|
|
3491
|
+
class: "mt-3",
|
|
3492
|
+
onClick: i[0] || (i[0] = (d) => t("action"))
|
|
3493
|
+
}, null, 8, ["label", "icon"])) : k("", !0)
|
|
3494
|
+
]));
|
|
3495
|
+
}
|
|
3496
|
+
});
|
|
3497
|
+
/*!
|
|
3498
|
+
* vue-router v4.6.4
|
|
3499
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
3500
|
+
* @license MIT
|
|
3501
|
+
*/
|
|
3502
|
+
Symbol(process.env.NODE_ENV !== "production" ? "navigation failure" : "");
|
|
3503
|
+
Symbol(process.env.NODE_ENV !== "production" ? "router view location matched" : "");
|
|
3504
|
+
Symbol(process.env.NODE_ENV !== "production" ? "router view depth" : "");
|
|
3505
|
+
const Go = Symbol(process.env.NODE_ENV !== "production" ? "router" : "");
|
|
3506
|
+
Symbol(process.env.NODE_ENV !== "production" ? "route location" : "");
|
|
3507
|
+
Symbol(process.env.NODE_ENV !== "production" ? "router view location" : "");
|
|
3508
|
+
/*!
|
|
3509
|
+
* vue-router v4.6.4
|
|
3510
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
3511
|
+
* @license MIT
|
|
3512
|
+
*/
|
|
3513
|
+
function Yo() {
|
|
3514
|
+
return Et(Go);
|
|
3515
|
+
}
|
|
3516
|
+
const Jo = { class: "w-detail-header" }, Xo = { class: "w-detail-header-left" }, Zo = { class: "w-detail-header-content" }, Qo = { class: "w-detail-header-title" }, _o = {
|
|
3517
|
+
key: 0,
|
|
3518
|
+
class: "w-detail-header-subtitle"
|
|
3519
|
+
}, en = { class: "w-detail-header-actions" }, gi = /* @__PURE__ */ se({
|
|
3520
|
+
__name: "WDetailHeader",
|
|
3521
|
+
props: {
|
|
3522
|
+
title: {},
|
|
3523
|
+
subtitle: {},
|
|
3524
|
+
icon: {},
|
|
3525
|
+
backRoute: {},
|
|
3526
|
+
backTo: {},
|
|
3527
|
+
status: {},
|
|
3528
|
+
statusMap: {}
|
|
3529
|
+
},
|
|
3530
|
+
setup(e) {
|
|
3531
|
+
const a = e, t = Yo();
|
|
3532
|
+
function o() {
|
|
3533
|
+
a.backTo ? t.push(typeof a.backTo == "string" ? { name: a.backTo } : a.backTo) : a.backRoute ? t.push({ name: a.backRoute }) : t.back();
|
|
3534
|
+
}
|
|
3535
|
+
return (i, d) => (n(), m("div", Jo, [
|
|
3536
|
+
f("div", Xo, [
|
|
3537
|
+
P(u(O), {
|
|
3538
|
+
icon: "pi pi-arrow-left",
|
|
3539
|
+
text: "",
|
|
3540
|
+
rounded: "",
|
|
3541
|
+
onClick: o
|
|
3542
|
+
}),
|
|
3543
|
+
e.icon ? (n(), m("i", {
|
|
3544
|
+
key: 0,
|
|
3545
|
+
class: le([e.icon, "w-detail-header-icon"])
|
|
3546
|
+
}, null, 2)) : k("", !0),
|
|
3547
|
+
f("div", Zo, [
|
|
3548
|
+
f("h2", Qo, A(e.title), 1),
|
|
3549
|
+
e.subtitle ? (n(), m("p", _o, A(e.subtitle), 1)) : k("", !0)
|
|
3550
|
+
]),
|
|
3551
|
+
e.status ? (n(), S(To, {
|
|
3552
|
+
key: 1,
|
|
3553
|
+
value: e.status,
|
|
3554
|
+
map: e.statusMap
|
|
3555
|
+
}, null, 8, ["value", "map"])) : k("", !0)
|
|
3556
|
+
]),
|
|
3557
|
+
f("div", en, [
|
|
3558
|
+
B(i.$slots, "actions")
|
|
3559
|
+
])
|
|
3560
|
+
]));
|
|
3561
|
+
}
|
|
3562
|
+
}), tn = { class: "w-info-card" }, ln = {
|
|
3563
|
+
key: 0,
|
|
3564
|
+
class: "w-info-card-title"
|
|
3565
|
+
}, an = { class: "w-info-card-grid" }, on = { class: "w-info-card-label" }, nn = { class: "w-info-card-value" }, bi = /* @__PURE__ */ se({
|
|
3566
|
+
__name: "WInfoCard",
|
|
3567
|
+
props: {
|
|
3568
|
+
title: {},
|
|
3569
|
+
fields: {}
|
|
3570
|
+
},
|
|
3571
|
+
setup(e) {
|
|
3572
|
+
const { formatCurrency: a, formatDate: t, formatNumber: o } = gt();
|
|
3573
|
+
function i(d) {
|
|
3574
|
+
const h = d.value;
|
|
3575
|
+
return h == null || h === "" ? "-" : d.format === "currency" ? a(Number(h)) : d.format === "date" ? t(String(h)) : d.format === "datetime" ? t(String(h), "DD/MM/YYYY HH:mm") : d.format === "number" ? o(Number(h)) : String(h);
|
|
3576
|
+
}
|
|
3577
|
+
return (d, h) => (n(), m("div", tn, [
|
|
3578
|
+
e.title ? (n(), m("h3", ln, A(e.title), 1)) : k("", !0),
|
|
3579
|
+
f("div", an, [
|
|
3580
|
+
(n(!0), m(te, null, ie(e.fields, (V) => (n(), m("div", {
|
|
3581
|
+
key: V.label,
|
|
3582
|
+
class: "w-info-card-field"
|
|
3583
|
+
}, [
|
|
3584
|
+
f("span", on, A(V.label), 1),
|
|
3585
|
+
f("span", nn, A(i(V)), 1)
|
|
3586
|
+
]))), 128))
|
|
3587
|
+
])
|
|
3588
|
+
]));
|
|
3589
|
+
}
|
|
3590
|
+
}), sn = {
|
|
3591
|
+
key: 0,
|
|
3592
|
+
class: "w-kpi-card__loading"
|
|
3593
|
+
}, rn = { class: "w-kpi-card__loading-content" }, un = { class: "w-kpi-card__header" }, dn = {
|
|
3594
|
+
key: 0,
|
|
3595
|
+
class: "w-kpi-card__icon"
|
|
3596
|
+
}, cn = {
|
|
3597
|
+
key: 1,
|
|
3598
|
+
class: "w-kpi-card__trend"
|
|
3599
|
+
}, mn = { class: "w-kpi-card__content" }, fn = { class: "w-kpi-card__label" }, vn = { class: "w-kpi-card__value" }, pn = {
|
|
3600
|
+
key: 0,
|
|
3601
|
+
class: "w-kpi-card__hint"
|
|
3602
|
+
}, hn = {
|
|
3603
|
+
key: 0,
|
|
3604
|
+
class: "w-kpi-card__footer"
|
|
3605
|
+
}, yn = /* @__PURE__ */ se({
|
|
3606
|
+
__name: "WKpiCard",
|
|
3607
|
+
props: {
|
|
3608
|
+
label: {},
|
|
3609
|
+
value: {},
|
|
3610
|
+
icon: {},
|
|
3611
|
+
hint: {},
|
|
3612
|
+
severity: {},
|
|
3613
|
+
trend: {},
|
|
3614
|
+
loading: { type: Boolean }
|
|
3615
|
+
},
|
|
3616
|
+
setup(e) {
|
|
3617
|
+
return (a, t) => (n(), m("article", {
|
|
3618
|
+
class: le(["w-kpi-card", e.severity ? `w-kpi-card--${e.severity}` : ""])
|
|
3619
|
+
}, [
|
|
3620
|
+
e.loading ? (n(), m("div", sn, [
|
|
3621
|
+
P(u(et), {
|
|
3622
|
+
shape: "circle",
|
|
3623
|
+
size: "2.75rem"
|
|
3624
|
+
}),
|
|
3625
|
+
f("div", rn, [
|
|
3626
|
+
P(u(et), {
|
|
3627
|
+
width: "6rem",
|
|
3628
|
+
height: "0.75rem"
|
|
3629
|
+
}),
|
|
3630
|
+
P(u(et), {
|
|
3631
|
+
width: "7.5rem",
|
|
3632
|
+
height: "1.5rem"
|
|
3633
|
+
}),
|
|
3634
|
+
P(u(et), {
|
|
3635
|
+
width: "5rem",
|
|
3636
|
+
height: "0.75rem"
|
|
3637
|
+
})
|
|
3638
|
+
])
|
|
3639
|
+
])) : (n(), m(te, { key: 1 }, [
|
|
3640
|
+
f("div", un, [
|
|
3641
|
+
e.icon || a.$slots.icon ? (n(), m("div", dn, [
|
|
3642
|
+
B(a.$slots, "icon", {}, () => [
|
|
3643
|
+
e.icon ? (n(), m("i", {
|
|
3644
|
+
key: 0,
|
|
3645
|
+
class: le(e.icon)
|
|
3646
|
+
}, null, 2)) : k("", !0)
|
|
3647
|
+
])
|
|
3648
|
+
])) : k("", !0),
|
|
3649
|
+
e.trend || a.$slots.trend ? (n(), m("div", cn, [
|
|
3650
|
+
B(a.$slots, "trend", {}, () => [
|
|
3651
|
+
e.trend ? (n(), m("span", {
|
|
3652
|
+
key: 0,
|
|
3653
|
+
class: le(["w-kpi-card__trend-badge", e.trend.direction ? `w-kpi-card__trend-badge--${e.trend.direction}` : ""])
|
|
3654
|
+
}, A(e.trend.value), 3)) : k("", !0)
|
|
3655
|
+
])
|
|
3656
|
+
])) : k("", !0)
|
|
3657
|
+
]),
|
|
3658
|
+
f("div", mn, [
|
|
3659
|
+
f("p", fn, A(e.label), 1),
|
|
3660
|
+
f("div", vn, [
|
|
3661
|
+
B(a.$slots, "value", {}, () => [
|
|
3662
|
+
Fe(A(e.value), 1)
|
|
3663
|
+
])
|
|
3664
|
+
]),
|
|
3665
|
+
e.hint || a.$slots.hint ? (n(), m("p", pn, [
|
|
3666
|
+
B(a.$slots, "hint", {}, () => [
|
|
3667
|
+
Fe(A(e.hint), 1)
|
|
3668
|
+
])
|
|
3669
|
+
])) : k("", !0)
|
|
3670
|
+
]),
|
|
3671
|
+
a.$slots.footer ? (n(), m("footer", hn, [
|
|
3672
|
+
B(a.$slots, "footer")
|
|
3673
|
+
])) : k("", !0)
|
|
3674
|
+
], 64))
|
|
3675
|
+
], 2));
|
|
3676
|
+
}
|
|
3677
|
+
}), ki = /* @__PURE__ */ se({
|
|
3678
|
+
__name: "WKpiGrid",
|
|
3679
|
+
props: {
|
|
3680
|
+
items: { default: () => [] },
|
|
3681
|
+
columns: { default: 4 },
|
|
3682
|
+
dense: { type: Boolean, default: !1 }
|
|
3683
|
+
},
|
|
3684
|
+
setup(e) {
|
|
3685
|
+
const a = e, t = D(() => [
|
|
3686
|
+
a.columns === "auto" ? "w-kpi-grid--auto" : `w-kpi-grid--cols-${a.columns}`,
|
|
3687
|
+
{ "w-kpi-grid--dense": a.dense }
|
|
3688
|
+
]);
|
|
3689
|
+
return (o, i) => (n(), m("div", {
|
|
3690
|
+
class: le(["w-kpi-grid", t.value])
|
|
3691
|
+
}, [
|
|
3692
|
+
o.$slots.item ? (n(!0), m(te, { key: 0 }, ie(e.items, (d, h) => B(o.$slots, "item", {
|
|
3693
|
+
key: h,
|
|
3694
|
+
item: d,
|
|
3695
|
+
index: h
|
|
3696
|
+
})), 128)) : (n(!0), m(te, { key: 1 }, ie(e.items, (d, h) => (n(), S(yn, {
|
|
3697
|
+
key: h,
|
|
3698
|
+
label: d.label,
|
|
3699
|
+
value: d.value,
|
|
3700
|
+
icon: d.icon,
|
|
3701
|
+
severity: d.severity || "primary",
|
|
3702
|
+
hint: d.hint,
|
|
3703
|
+
trend: d.trend,
|
|
3704
|
+
loading: d.loading
|
|
3705
|
+
}, null, 8, ["label", "value", "icon", "severity", "hint", "trend", "loading"]))), 128))
|
|
3706
|
+
], 2));
|
|
3707
|
+
}
|
|
3708
|
+
}), gn = { class: "w-section-header__main" }, bn = {
|
|
3709
|
+
key: 0,
|
|
3710
|
+
class: "w-section-header__icon"
|
|
3711
|
+
}, kn = { class: "w-section-header__content" }, wn = { class: "w-section-header__title-row" }, $n = { class: "w-section-header__title" }, xn = {
|
|
3712
|
+
key: 0,
|
|
3713
|
+
class: "w-section-header__subtitle"
|
|
3714
|
+
}, Cn = {
|
|
3715
|
+
key: 0,
|
|
3716
|
+
class: "w-section-header__actions"
|
|
3717
|
+
}, wi = /* @__PURE__ */ se({
|
|
3718
|
+
__name: "WSectionHeader",
|
|
3719
|
+
props: {
|
|
3720
|
+
title: {},
|
|
3721
|
+
subtitle: {},
|
|
3722
|
+
icon: {},
|
|
3723
|
+
compact: { type: Boolean }
|
|
3724
|
+
},
|
|
3725
|
+
setup(e) {
|
|
3726
|
+
return (a, t) => (n(), m("div", {
|
|
3727
|
+
class: le(["w-section-header", { "w-section-header--compact": e.compact }])
|
|
3728
|
+
}, [
|
|
3729
|
+
f("div", gn, [
|
|
3730
|
+
e.icon || a.$slots.icon ? (n(), m("div", bn, [
|
|
3731
|
+
B(a.$slots, "icon", {}, () => [
|
|
3732
|
+
e.icon ? (n(), m("i", {
|
|
3733
|
+
key: 0,
|
|
3734
|
+
class: le(e.icon)
|
|
3735
|
+
}, null, 2)) : k("", !0)
|
|
3736
|
+
])
|
|
3737
|
+
])) : k("", !0),
|
|
3738
|
+
f("div", kn, [
|
|
3739
|
+
f("div", wn, [
|
|
3740
|
+
f("h3", $n, A(e.title), 1),
|
|
3741
|
+
B(a.$slots, "meta")
|
|
3742
|
+
]),
|
|
3743
|
+
e.subtitle ? (n(), m("p", xn, A(e.subtitle), 1)) : k("", !0)
|
|
3744
|
+
])
|
|
3745
|
+
]),
|
|
3746
|
+
a.$slots.actions ? (n(), m("div", Cn, [
|
|
3747
|
+
B(a.$slots, "actions")
|
|
3748
|
+
])) : k("", !0)
|
|
3749
|
+
], 2));
|
|
3750
|
+
}
|
|
3751
|
+
}), Vn = {
|
|
3752
|
+
key: 0,
|
|
3753
|
+
class: "w-form-section__header"
|
|
3754
|
+
}, Sn = { class: "w-form-section__content" }, Dn = { class: "w-form-section__title" }, En = {
|
|
3755
|
+
key: 0,
|
|
3756
|
+
class: "w-form-section__description"
|
|
3757
|
+
}, Fn = {
|
|
3758
|
+
key: 0,
|
|
3759
|
+
class: "w-form-section__actions"
|
|
3760
|
+
}, Pn = { class: "w-form-section__body" }, $i = /* @__PURE__ */ se({
|
|
3761
|
+
__name: "WFormSection",
|
|
3762
|
+
props: {
|
|
3763
|
+
title: {},
|
|
3764
|
+
description: {},
|
|
3765
|
+
variant: {}
|
|
3766
|
+
},
|
|
3767
|
+
setup(e) {
|
|
3768
|
+
return (a, t) => (n(), m("section", {
|
|
3769
|
+
class: le(["w-form-section", e.variant ? `w-form-section--${e.variant}` : ""])
|
|
3770
|
+
}, [
|
|
3771
|
+
e.title || e.description || a.$slots.actions ? (n(), m("div", Vn, [
|
|
3772
|
+
f("div", Sn, [
|
|
3773
|
+
f("h3", Dn, A(e.title), 1),
|
|
3774
|
+
e.description ? (n(), m("p", En, A(e.description), 1)) : k("", !0)
|
|
3775
|
+
]),
|
|
3776
|
+
a.$slots.actions ? (n(), m("div", Fn, [
|
|
3777
|
+
B(a.$slots, "actions")
|
|
3778
|
+
])) : k("", !0)
|
|
3779
|
+
])) : k("", !0),
|
|
3780
|
+
f("div", Pn, [
|
|
3781
|
+
B(a.$slots, "default")
|
|
3782
|
+
])
|
|
3783
|
+
], 2));
|
|
3784
|
+
}
|
|
3785
|
+
}), Mn = {
|
|
3786
|
+
key: 0,
|
|
3787
|
+
class: "w-action-bar__primary"
|
|
3788
|
+
}, In = {
|
|
3789
|
+
key: 1,
|
|
3790
|
+
class: "w-action-bar__filters"
|
|
3791
|
+
}, Rn = {
|
|
3792
|
+
key: 2,
|
|
3793
|
+
class: "w-action-bar__secondary"
|
|
3794
|
+
}, xi = /* @__PURE__ */ se({
|
|
3795
|
+
__name: "WActionBar",
|
|
3796
|
+
props: {
|
|
3797
|
+
align: { default: "between" },
|
|
3798
|
+
stackOnMobile: { type: Boolean, default: !0 }
|
|
3799
|
+
},
|
|
3800
|
+
setup(e) {
|
|
3801
|
+
return (a, t) => (n(), m("div", {
|
|
3802
|
+
class: le(["w-action-bar", [`w-action-bar--${e.align}`, { "w-action-bar--stack": e.stackOnMobile }]])
|
|
3803
|
+
}, [
|
|
3804
|
+
a.$slots.primary || a.$slots.default ? (n(), m("div", Mn, [
|
|
3805
|
+
B(a.$slots, "primary", {}, () => [
|
|
3806
|
+
B(a.$slots, "default")
|
|
3807
|
+
])
|
|
3808
|
+
])) : k("", !0),
|
|
3809
|
+
a.$slots.filters ? (n(), m("div", In, [
|
|
3810
|
+
B(a.$slots, "filters")
|
|
3811
|
+
])) : k("", !0),
|
|
3812
|
+
a.$slots.secondary ? (n(), m("div", Rn, [
|
|
3813
|
+
B(a.$slots, "secondary")
|
|
3814
|
+
])) : k("", !0)
|
|
3815
|
+
], 2));
|
|
3816
|
+
}
|
|
3817
|
+
}), An = { class: "w-progress-flow__marker" }, Bn = { class: "w-progress-flow__content" }, Un = { class: "w-progress-flow__label" }, Tn = {
|
|
3818
|
+
key: 0,
|
|
3819
|
+
class: "w-progress-flow__description"
|
|
3820
|
+
}, Ci = /* @__PURE__ */ se({
|
|
3821
|
+
__name: "WProgressFlow",
|
|
3822
|
+
props: {
|
|
3823
|
+
steps: {},
|
|
3824
|
+
currentStep: {},
|
|
3825
|
+
orientation: { default: "horizontal" }
|
|
3826
|
+
},
|
|
3827
|
+
setup(e) {
|
|
3828
|
+
const a = e, t = D(() => a.steps.findIndex((i) => i.key === a.currentStep));
|
|
3829
|
+
function o(i) {
|
|
3830
|
+
return i < t.value ? "done" : i === t.value ? "current" : "pending";
|
|
3831
|
+
}
|
|
3832
|
+
return (i, d) => (n(), m("div", {
|
|
3833
|
+
class: le(["w-progress-flow", `w-progress-flow--${e.orientation}`])
|
|
3834
|
+
}, [
|
|
3835
|
+
(n(!0), m(te, null, ie(e.steps, (h, V) => (n(), m("div", {
|
|
3836
|
+
key: h.key,
|
|
3837
|
+
class: le(["w-progress-flow__step", `w-progress-flow__step--${o(V)}`])
|
|
3838
|
+
}, [
|
|
3839
|
+
B(i.$slots, "step", {
|
|
3840
|
+
step: h,
|
|
3841
|
+
index: V,
|
|
3842
|
+
state: o(V)
|
|
3843
|
+
}, () => [
|
|
3844
|
+
f("div", An, [
|
|
3845
|
+
f("span", null, A(V + 1), 1)
|
|
3846
|
+
]),
|
|
3847
|
+
f("div", Bn, [
|
|
3848
|
+
f("p", Un, A(h.label), 1),
|
|
3849
|
+
h.description ? (n(), m("p", Tn, A(h.description), 1)) : k("", !0)
|
|
3850
|
+
])
|
|
3851
|
+
])
|
|
3852
|
+
], 2))), 128))
|
|
3853
|
+
], 2));
|
|
3854
|
+
}
|
|
3855
|
+
});
|
|
3856
|
+
export {
|
|
3857
|
+
na as W,
|
|
3858
|
+
xi as _,
|
|
3859
|
+
Kl as a,
|
|
3860
|
+
ht as b,
|
|
3861
|
+
Tt as c,
|
|
3862
|
+
fi as d,
|
|
3863
|
+
St as e,
|
|
3864
|
+
vi as f,
|
|
3865
|
+
gi as g,
|
|
3866
|
+
yi as h,
|
|
3867
|
+
La as i,
|
|
3868
|
+
$i as j,
|
|
3869
|
+
bi as k,
|
|
3870
|
+
yn as l,
|
|
3871
|
+
ki as m,
|
|
3872
|
+
Jl as n,
|
|
3873
|
+
hi as o,
|
|
3874
|
+
Ci as p,
|
|
3875
|
+
wi as q,
|
|
3876
|
+
To as r,
|
|
3877
|
+
ba as s,
|
|
3878
|
+
pi as t,
|
|
3879
|
+
Wa as u,
|
|
3880
|
+
Tl as v,
|
|
3881
|
+
Al as w,
|
|
3882
|
+
Ll as x,
|
|
3883
|
+
Bl as y,
|
|
3884
|
+
za as z
|
|
3885
|
+
};
|
|
3886
|
+
//# sourceMappingURL=WProgressFlow.vue_vue_type_script_setup_true_lang-D9HgZsV9.js.map
|