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