@wgalleti/primevue-components 0.8.0 → 0.8.3

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