@wgalleti/primevue-components 0.9.5 → 0.10.0

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