@wgalleti/primevue-components 1.17.1 → 1.19.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.
Files changed (39) hide show
  1. package/dist/components/charts/WChart.vue.d.ts +1 -1
  2. package/dist/components/crud/WCrudView.vue.d.ts +88 -39
  3. package/dist/components/form/WDatePicker.vue.d.ts +3 -1
  4. package/dist/components/ui/WCheckList.vue.d.ts +1 -1
  5. package/dist/components/ui/WKpiCard.vue.d.ts +2 -2
  6. package/dist/components/ui/WMapSelect.vue.d.ts +1 -1
  7. package/dist/components/ui/WMeter.vue.d.ts +2 -2
  8. package/dist/components-BG5SUm-f.cjs +25 -0
  9. package/dist/components-BG5SUm-f.cjs.map +1 -0
  10. package/dist/{components-lO0I43CU.js → components-DDidEKfp.js} +1921 -1640
  11. package/dist/components-DDidEKfp.js.map +1 -0
  12. package/dist/components.cjs +1 -1
  13. package/dist/components.js +1 -1
  14. package/dist/{composables-BYOQ7IBQ.js → composables-BEcmxiCQ.js} +2 -2
  15. package/dist/{composables-BYOQ7IBQ.js.map → composables-BEcmxiCQ.js.map} +1 -1
  16. package/dist/{composables-B5lQK7vG.cjs → composables-D013e6u-.cjs} +2 -2
  17. package/dist/{composables-B5lQK7vG.cjs.map → composables-D013e6u-.cjs.map} +1 -1
  18. package/dist/composables.cjs +1 -1
  19. package/dist/composables.js +2 -2
  20. package/dist/index.cjs +1 -1
  21. package/dist/index.d.ts +1 -1
  22. package/dist/index.js +3 -3
  23. package/dist/primevue-components.css +1 -1
  24. package/dist/types/column.d.ts +30 -1
  25. package/dist/types/crudGroup.d.ts +11 -0
  26. package/dist/types/index.d.ts +1 -0
  27. package/dist/useFormKeyboardNav-Dzczvgce.js +493 -0
  28. package/dist/useFormKeyboardNav-Dzczvgce.js.map +1 -0
  29. package/dist/useFormKeyboardNav-wNRvUJ1H.cjs +3 -0
  30. package/dist/useFormKeyboardNav-wNRvUJ1H.cjs.map +1 -0
  31. package/package.json +1 -1
  32. package/skill/references/crud.md +2 -0
  33. package/dist/components-BOnwAcU6.cjs +0 -25
  34. package/dist/components-BOnwAcU6.cjs.map +0 -1
  35. package/dist/components-lO0I43CU.js.map +0 -1
  36. package/dist/useFormKeyboardNav-P-sZq9cy.cjs +0 -3
  37. package/dist/useFormKeyboardNav-P-sZq9cy.cjs.map +0 -1
  38. package/dist/useFormKeyboardNav-wVvZqL_0.js +0 -658
  39. package/dist/useFormKeyboardNav-wVvZqL_0.js.map +0 -1
@@ -1,658 +0,0 @@
1
- import { i as e, n as t } from "./routeTabs-C86S8jNU.js";
2
- import { inject as n, nextTick as r, onScopeDispose as i, readonly as a, ref as o } from "vue";
3
- import s from "dayjs";
4
- import { useToast as c } from "primevue/usetoast";
5
- import { useConfirm as l } from "primevue/useconfirm";
6
- // \0rolldown/runtime.js
7
- var u = Object.create, d = Object.defineProperty, f = Object.getOwnPropertyDescriptor, p = Object.getOwnPropertyNames, m = Object.getPrototypeOf, h = Object.prototype.hasOwnProperty, g = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e = null), t.exports), _ = (e, t, n, r) => {
8
- if (t && typeof t == "object" || typeof t == "function") for (var i = p(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !h.call(e, s) && s !== n && d(e, s, {
9
- get: ((e) => t[e]).bind(null, s),
10
- enumerable: !(r = f(t, s)) || r.enumerable
11
- });
12
- return e;
13
- }, v = (e, t, n) => (n = e == null ? {} : u(m(e)), _(t || !e || !e.__esModule || !h.call(e, "default") ? d(n, "default", {
14
- value: e,
15
- enumerable: !0
16
- }) : n, e)), y = {
17
- celular: 600,
18
- retrato: 840,
19
- desktop: 1200
20
- };
21
- function b(e) {
22
- let t = o(!1);
23
- if (typeof window > "u" || typeof window.matchMedia != "function") return t;
24
- let n = window.matchMedia(e);
25
- t.value = n.matches;
26
- let r = (e) => {
27
- t.value = e.matches;
28
- };
29
- return n.addEventListener("change", r), i(() => n.removeEventListener("change", r)), t;
30
- }
31
- function x() {
32
- let e = b(`(max-width: ${y.celular - 1}px)`), t = b(`(max-width: ${y.retrato - 1}px)`), n = b(`(min-width: ${y.retrato}px)`), r = b(`(min-width: ${y.desktop}px)`), i = b("(pointer: coarse)");
33
- return {
34
- isCelular: a(e),
35
- isRetrato: a(t),
36
- isPaisagem: a(n),
37
- isDesktop: a(r),
38
- isToque: a(i)
39
- };
40
- }
41
- // src/utils/dates.ts
42
- var S = /* @__PURE__ */ v((/* @__PURE__ */ g(((e, t, n) => {
43
- (function(n, r) {
44
- typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n = typeof globalThis < "u" ? globalThis : n || self).dayjs_plugin_customParseFormat = r();
45
- })(n, (function() {
46
- var e = {
47
- LTS: "h:mm:ss A",
48
- LT: "h:mm A",
49
- L: "MM/DD/YYYY",
50
- LL: "MMMM D, YYYY",
51
- LLL: "MMMM D, YYYY h:mm A",
52
- LLLL: "dddd, MMMM D, YYYY h:mm A"
53
- }, t = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, n = /\d/, r = /\d\d/, i = /\d\d?/, a = /\d*[^-_:/,()\s\d]+/, o = {}, s = function(e) {
54
- return (e = +e) + (e > 68 ? 1900 : 2e3);
55
- }, c = function(e) {
56
- return function(t) {
57
- this[e] = +t;
58
- };
59
- }, l = [/[+-]\d\d:?(\d\d)?|Z/, function(e) {
60
- (this.zone ||= {}).offset = function(e) {
61
- if (!e || e === "Z") return 0;
62
- var t = e.match(/([+-]|\d\d)/g), n = 60 * t[1] + (+t[2] || 0);
63
- return n === 0 ? 0 : t[0] === "+" ? -n : n;
64
- }(e);
65
- }], u = function(e) {
66
- var t = o[e];
67
- return t && (t.indexOf ? t : t.s.concat(t.f));
68
- }, d = function(e, t) {
69
- var n, r = o.meridiem;
70
- if (r) {
71
- for (var i = 1; i <= 24; i += 1) if (e.indexOf(r(i, 0, t)) > -1) {
72
- n = i > 12;
73
- break;
74
- }
75
- } else n = e === (t ? "pm" : "PM");
76
- return n;
77
- }, f = {
78
- A: [a, function(e) {
79
- this.afternoon = d(e, !1);
80
- }],
81
- a: [a, function(e) {
82
- this.afternoon = d(e, !0);
83
- }],
84
- Q: [n, function(e) {
85
- this.month = 3 * (e - 1) + 1;
86
- }],
87
- S: [n, function(e) {
88
- this.milliseconds = 100 * e;
89
- }],
90
- SS: [r, function(e) {
91
- this.milliseconds = 10 * e;
92
- }],
93
- SSS: [/\d{3}/, function(e) {
94
- this.milliseconds = +e;
95
- }],
96
- s: [i, c("seconds")],
97
- ss: [i, c("seconds")],
98
- m: [i, c("minutes")],
99
- mm: [i, c("minutes")],
100
- H: [i, c("hours")],
101
- h: [i, c("hours")],
102
- HH: [i, c("hours")],
103
- hh: [i, c("hours")],
104
- D: [i, c("day")],
105
- DD: [r, c("day")],
106
- Do: [a, function(e) {
107
- var t = o.ordinal, n = e.match(/\d+/);
108
- if (this.day = n[0], t) for (var r = 1; r <= 31; r += 1) t(r).replace(/\[|\]/g, "") === e && (this.day = r);
109
- }],
110
- w: [i, c("week")],
111
- ww: [r, c("week")],
112
- M: [i, c("month")],
113
- MM: [r, c("month")],
114
- MMM: [a, function(e) {
115
- var t = u("months"), n = (u("monthsShort") || t.map((function(e) {
116
- return e.slice(0, 3);
117
- }))).indexOf(e) + 1;
118
- if (n < 1) throw Error();
119
- this.month = n % 12 || n;
120
- }],
121
- MMMM: [a, function(e) {
122
- var t = u("months").indexOf(e) + 1;
123
- if (t < 1) throw Error();
124
- this.month = t % 12 || t;
125
- }],
126
- Y: [/[+-]?\d+/, c("year")],
127
- YY: [r, function(e) {
128
- this.year = s(e);
129
- }],
130
- YYYY: [/\d{4}/, c("year")],
131
- Z: l,
132
- ZZ: l
133
- };
134
- function p(n) {
135
- for (var r = n, i = o && o.formats, a = (n = r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (function(t, n, r) {
136
- var a = r && r.toUpperCase();
137
- return n || i[r] || e[r] || i[a].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (function(e, t, n) {
138
- return t || n.slice(1);
139
- }));
140
- }))).match(t), s = a.length, c = 0; c < s; c += 1) {
141
- var l = a[c], u = f[l], d = u && u[0], p = u && u[1];
142
- a[c] = p ? {
143
- regex: d,
144
- parser: p
145
- } : l.replace(/^\[|\]$/g, "");
146
- }
147
- return function(e) {
148
- for (var t = {}, n = 0, r = 0; n < s; n += 1) {
149
- var i = a[n];
150
- if (typeof i == "string") r += i.length;
151
- else {
152
- var o = i.regex, c = i.parser, l = e.slice(r), u = o.exec(l)[0];
153
- c.call(t, u), e = e.replace(u, "");
154
- }
155
- }
156
- return function(e) {
157
- var t = e.afternoon;
158
- if (t !== void 0) {
159
- var n = e.hours;
160
- t ? n < 12 && (e.hours += 12) : n === 12 && (e.hours = 0), delete e.afternoon;
161
- }
162
- }(t), t;
163
- };
164
- }
165
- return function(e, t, n) {
166
- n.p.customParseFormat = !0, e && e.parseTwoDigitYear && (s = e.parseTwoDigitYear);
167
- var r = t.prototype, i = r.parse;
168
- r.parse = function(e) {
169
- var t = e.date, r = e.utc, a = e.args;
170
- this.$u = r;
171
- var s = a[1];
172
- if (typeof s == "string") {
173
- var c = !0 === a[2], l = !0 === a[3], u = c || l, d = a[2];
174
- l && (d = a[2]), o = this.$locale(), !c && d && (o = n.Ls[d]), this.$d = function(e, t, n, r) {
175
- try {
176
- if (["x", "X"].indexOf(t) > -1) return /* @__PURE__ */ new Date((t === "X" ? 1e3 : 1) * e);
177
- var i = p(t)(e), a = i.year, o = i.month, s = i.day, c = i.hours, l = i.minutes, u = i.seconds, d = i.milliseconds, f = i.zone, m = i.week, h = /* @__PURE__ */ new Date(), g = s || (a || o ? 1 : h.getDate()), _ = a || h.getFullYear(), v = 0;
178
- a && !o || (v = o > 0 ? o - 1 : h.getMonth());
179
- var y, b = c || 0, x = l || 0, S = u || 0, C = d || 0;
180
- return f ? new Date(Date.UTC(_, v, g, b, x, S, C + 60 * f.offset * 1e3)) : n ? new Date(Date.UTC(_, v, g, b, x, S, C)) : (y = new Date(_, v, g, b, x, S, C), m && (y = r(y).week(m).toDate()), y);
181
- } catch {
182
- return /* @__PURE__ */ new Date("");
183
- }
184
- }(t, s, r, n), this.init(), d && !0 !== d && (this.$L = this.locale(d).$L), u && t != this.format(s) && (this.$d = /* @__PURE__ */ new Date("")), o = {};
185
- } else if (s instanceof Array) for (var f = s.length, m = 1; m <= f; m += 1) {
186
- a[1] = s[m - 1];
187
- var h = n.apply(this, a);
188
- if (h.isValid()) {
189
- this.$d = h.$d, this.$L = h.$L, this.init();
190
- break;
191
- }
192
- m === f && (this.$d = /* @__PURE__ */ new Date(""));
193
- }
194
- else i.call(this, e);
195
- };
196
- };
197
- }));
198
- })))(), 1);
199
- s.extend(S.default);
200
- function C(e) {
201
- if (!e) return null;
202
- if (e instanceof Date) return e;
203
- let t = s(e, "YYYY-MM-DD", !0);
204
- return t.isValid() ? t.toDate() : s(e).toDate();
205
- }
206
- function w(e) {
207
- return e ? typeof e == "string" ? e : s(e).format("YYYY-MM-DD") : null;
208
- }
209
- function T(e) {
210
- return e ? typeof e == "string" ? e : s(e).toISOString() : null;
211
- }
212
- function E(e, t = "DD/MM/YYYY") {
213
- return e ? s(e).format(t) : "—";
214
- }
215
- function D(e) {
216
- return e ? s(e).format("DD/MM/YYYY HH:mm") : "—";
217
- }
218
- // src/utils/masks.ts
219
- function O(e) {
220
- return e.replace(/\D/g, "");
221
- }
222
- function k(e) {
223
- if (!e) return "—";
224
- let t = O(e);
225
- return t.length === 11 ? t.replace(/^(\d{3})(\d{3})(\d{3})(\d{2})$/, "$1.$2.$3-$4") : e;
226
- }
227
- function A(e) {
228
- if (!e) return "—";
229
- let t = O(e);
230
- return t.length === 14 ? t.replace(/^(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})$/, "$1.$2.$3/$4-$5") : e;
231
- }
232
- function j(e) {
233
- if (!e) return "—";
234
- let t = O(e);
235
- return t.length === 11 ? k(e) : t.length === 14 ? A(e) : e;
236
- }
237
- function ee(e) {
238
- if (!e) return "—";
239
- let t = O(e);
240
- return t.length === 11 ? t.replace(/^(\d{2})(\d{5})(\d{4})$/, "($1) $2-$3") : t.length === 10 ? t.replace(/^(\d{2})(\d{4})(\d{4})$/, "($1) $2-$3") : e;
241
- }
242
- function M(e) {
243
- if (!e) return null;
244
- let t = O(e);
245
- if (t.length !== 11) return "CPF deve ter 11 dígitos.";
246
- if (/^(\d)\1{10}$/.test(t)) return "CPF inválido.";
247
- let n = 0;
248
- for (let e = 0; e < 9; e++) n += parseInt(t[e]) * (10 - e);
249
- let r = n % 11, i = r < 2 ? 0 : 11 - r;
250
- if (parseInt(t[9]) !== i) return "CPF inválido.";
251
- n = 0;
252
- for (let e = 0; e < 10; e++) n += parseInt(t[e]) * (11 - e);
253
- r = n % 11;
254
- let a = r < 2 ? 0 : 11 - r;
255
- return parseInt(t[10]) === a ? null : "CPF inválido.";
256
- }
257
- function N(e) {
258
- if (!e) return null;
259
- let t = O(e);
260
- if (t.length !== 14) return "CNPJ deve ter 14 dígitos.";
261
- if (/^(\d)\1{13}$/.test(t)) return "CNPJ inválido.";
262
- let n = [
263
- 5,
264
- 4,
265
- 3,
266
- 2,
267
- 9,
268
- 8,
269
- 7,
270
- 6,
271
- 5,
272
- 4,
273
- 3,
274
- 2
275
- ], r = 0;
276
- for (let e = 0; e < 12; e++) r += parseInt(t[e]) * n[e];
277
- let i = r % 11, a = i < 2 ? 0 : 11 - i;
278
- if (parseInt(t[12]) !== a) return "CNPJ inválido.";
279
- let o = [
280
- 6,
281
- 5,
282
- 4,
283
- 3,
284
- 2,
285
- 9,
286
- 8,
287
- 7,
288
- 6,
289
- 5,
290
- 4,
291
- 3,
292
- 2
293
- ];
294
- r = 0;
295
- for (let e = 0; e < 13; e++) r += parseInt(t[e]) * o[e];
296
- i = r % 11;
297
- let s = i < 2 ? 0 : 11 - i;
298
- return parseInt(t[13]) === s ? null : "CNPJ inválido.";
299
- }
300
- function P(e) {
301
- if (!e) return null;
302
- let t = O(e);
303
- return t.length === 11 ? M(e) : t.length === 14 ? N(e) : "CPF deve ter 11 dígitos ou CNPJ deve ter 14 dígitos.";
304
- }
305
- // src/composables/useFormatters.ts
306
- var F = /* @__PURE__ */ new Map();
307
- function I(e, t) {
308
- let n = `${e}-${t}`, r = F.get(n);
309
- return r || (r = new Intl.NumberFormat(e, {
310
- minimumFractionDigits: t,
311
- maximumFractionDigits: t
312
- }), F.set(n, r)), r;
313
- }
314
- function te(e, t) {
315
- let n = `${e}-${t}`, r = F.get(n);
316
- return r || (r = new Intl.NumberFormat(e, {
317
- style: "currency",
318
- currency: t
319
- }), F.set(n, r)), r;
320
- }
321
- function L(e, t) {
322
- let n = `${e}-compact-${t ?? ""}`, r = F.get(n);
323
- return r || (r = new Intl.NumberFormat(e, {
324
- notation: "compact",
325
- maximumFractionDigits: 1,
326
- ...t ? {
327
- style: "currency",
328
- currency: t
329
- } : {}
330
- }), F.set(n, r)), r;
331
- }
332
- function R() {
333
- let t = n(e, {
334
- defaultPageSize: 20,
335
- dateFormat: "DD/MM/YYYY",
336
- dateTimeFormat: "DD/MM/YYYY HH:mm",
337
- locale: "pt-BR",
338
- currency: "BRL"
339
- }), r = t?.locale ?? "pt-BR", i = t?.currency ?? "BRL";
340
- function a(e) {
341
- return e == null ? "—" : te(r, i).format(e);
342
- }
343
- function o(e, t = 2) {
344
- return e == null ? "—" : I(r, t).format(e);
345
- }
346
- function s(e, n) {
347
- return E(e, n ?? t?.dateFormat ?? "DD/MM/YYYY");
348
- }
349
- function c(e) {
350
- return D(e);
351
- }
352
- function l(e) {
353
- return e == null ? "—" : `${I(r, 2).format(e)}%`;
354
- }
355
- function u(e) {
356
- return e == null ? "—" : Math.abs(e) < 1e3 ? a(e) : L(r, i).format(e);
357
- }
358
- function d(e) {
359
- return e == null ? "—" : L(r).format(e);
360
- }
361
- return {
362
- formatCurrency: a,
363
- formatCurrencyCompact: u,
364
- formatNumberCompact: d,
365
- formatNumber: o,
366
- formatDate: s,
367
- formatDateTime: c,
368
- formatPercent: l,
369
- formatCpf: k,
370
- formatCnpj: A,
371
- formatCpfCnpj: j,
372
- formatTelefone: ee,
373
- validateCpf: M,
374
- validateCnpj: N,
375
- validateCpfCnpj: P,
376
- parseDate: C,
377
- toDateString: w,
378
- toDateTimeString: T
379
- };
380
- }
381
- // src/utils/formRecord.ts
382
- function z(e) {
383
- let t = {};
384
- for (let n of e) t[n.field] = n.defaultValue === void 0 ? null : typeof n.defaultValue == "function" ? n.defaultValue() : n.defaultValue;
385
- return t;
386
- }
387
- function B(e, t, n) {
388
- let r = {};
389
- for (let i of t) {
390
- let t = e[i.field] === void 0 ? null : e[i.field];
391
- t && (i.type === "date" || i.type === "datetime") && typeof t == "string" && (t = C(t)), n[i.field] = t, r[i.field] = t;
392
- }
393
- return r;
394
- }
395
- function V(e, t) {
396
- let n = { ...e };
397
- for (let e of t) {
398
- let t = n[e.field];
399
- if (e.type === "date" && t instanceof Date ? n[e.field] = w(t) : e.type === "datetime" && t instanceof Date && (n[e.field] = T(t)), e.type === "fk" && typeof t == "object" && t) {
400
- let r = e.optionValue || "id";
401
- n[e.field] = t[r] ?? t;
402
- }
403
- (e.type === "mask" || e.type === "cpf_cnpj") && typeof t == "string" && (n[e.field] = O(t));
404
- }
405
- return n;
406
- }
407
- function H(e, t, n = !1) {
408
- return e.visible === void 0 || e.visible === !0 ? !0 : typeof e.visible == "function" ? e.visible(t, n) : e.visible;
409
- }
410
- function U(e, t, n = !1) {
411
- for (let r of e) if (H(r, t, n)) {
412
- if (r.validate) {
413
- let e = r.validate(t[r.field], {
414
- formData: t,
415
- isEditing: n
416
- });
417
- if (e) return e;
418
- }
419
- if (r.required) {
420
- let e = t[r.field];
421
- if (e == null || e === "") return `${r.label} é obrigatório`;
422
- }
423
- }
424
- return null;
425
- }
426
- // src/composables/useAppToast.ts
427
- function W() {
428
- let e = c();
429
- function t(t, n = "Sucesso") {
430
- e.add({
431
- severity: "success",
432
- summary: n,
433
- detail: t,
434
- life: 3e3
435
- });
436
- }
437
- function n(t, n = "Erro") {
438
- e.add({
439
- severity: "error",
440
- summary: n,
441
- detail: t,
442
- life: 5e3
443
- });
444
- }
445
- function r(t, n = "Atenção") {
446
- e.add({
447
- severity: "warn",
448
- summary: n,
449
- detail: t,
450
- life: 4e3
451
- });
452
- }
453
- function i(t, n = "Info") {
454
- e.add({
455
- severity: "info",
456
- summary: n,
457
- detail: t,
458
- life: 3e3
459
- });
460
- }
461
- return {
462
- success: t,
463
- error: n,
464
- warn: r,
465
- info: i
466
- };
467
- }
468
- // src/composables/useAppConfirm.ts
469
- function G() {
470
- let e = l(), n = t(), r = () => n && !n.active.value ? "body" : n?.hostEl.value ?? "body";
471
- function i(t, n = "Deseja realmente excluir este registro?") {
472
- e.require({
473
- appendTo: r(),
474
- message: n,
475
- header: "Confirmar Exclusão",
476
- icon: "pi pi-trash",
477
- rejectLabel: "Cancelar",
478
- rejectProps: {
479
- severity: "secondary",
480
- text: !0
481
- },
482
- acceptLabel: "Excluir",
483
- acceptProps: { severity: "danger" },
484
- accept: t
485
- });
486
- }
487
- function a(t, n, i = "Confirmação") {
488
- e.require({
489
- appendTo: r(),
490
- message: t,
491
- header: i,
492
- icon: "pi pi-question-circle",
493
- rejectLabel: "Cancelar",
494
- rejectProps: {
495
- severity: "secondary",
496
- text: !0
497
- },
498
- acceptLabel: "Confirmar",
499
- accept: n
500
- });
501
- }
502
- function o(t = "Há alterações não salvas. Descartar e fechar?", n = "Alterações não salvas") {
503
- return new Promise((i) => {
504
- let a = !1, o = (e) => {
505
- a || (a = !0, i(e));
506
- };
507
- e.require({
508
- appendTo: r(),
509
- message: t,
510
- header: n,
511
- icon: "pi pi-exclamation-triangle",
512
- rejectLabel: "Continuar editando",
513
- rejectProps: {
514
- severity: "secondary",
515
- text: !0
516
- },
517
- acceptLabel: "Descartar",
518
- acceptProps: { severity: "danger" },
519
- accept: () => o(!0),
520
- reject: () => o(!1),
521
- onHide: () => o(!1)
522
- });
523
- });
524
- }
525
- return {
526
- confirmDelete: i,
527
- confirmAction: a,
528
- confirmDiscard: o
529
- };
530
- }
531
- // src/composables/useApiError.ts
532
- function K(e) {
533
- return e.replace(/_/g, " ").replace(/^\w/, (e) => e.toUpperCase());
534
- }
535
- function q(e) {
536
- if (typeof e == "string") return e;
537
- if (Array.isArray(e)) {
538
- let t = e.filter((e) => typeof e == "string");
539
- return t.length > 0 ? t.join(" ") : null;
540
- }
541
- if (typeof e == "object" && e) {
542
- let t = e;
543
- if (Array.isArray(t.non_field_errors) && t.non_field_errors.length > 0) return t.non_field_errors.filter((e) => typeof e == "string").join(" ");
544
- let n = [];
545
- for (let [e, r] of Object.entries(t)) {
546
- if (e === "non_field_errors") continue;
547
- let t = K(e);
548
- if (Array.isArray(r)) {
549
- let e = r.filter((e) => typeof e == "string");
550
- e.length > 0 && n.push(`${t}: ${e.join(" ")}`);
551
- } else typeof r == "string" && n.push(`${t}: ${r}`);
552
- }
553
- return n.length > 0 ? n.join("\n") : null;
554
- }
555
- return null;
556
- }
557
- function J(e, t = "Erro inesperado") {
558
- if (!e || typeof e != "object") return t;
559
- let n = e.response?.data;
560
- return !n || typeof n != "object" ? t : q(n.detail ?? n) || t;
561
- }
562
- function Y(e) {
563
- let t = e?.response;
564
- if (!t || t.status !== 400 || typeof t.data != "object" || t.data === null) return {};
565
- let n = {};
566
- for (let [e, r] of Object.entries(t.data)) {
567
- if (e === "detail" || e === "non_field_errors") continue;
568
- let t = (Array.isArray(r) ? r : [r]).filter((e) => typeof e == "string");
569
- t.length > 0 && (n[e] = t.join(" "));
570
- }
571
- return n;
572
- }
573
- function X() {
574
- return {
575
- extractApiError: J,
576
- extractFieldErrors: Y
577
- };
578
- }
579
- // src/composables/useDateInput.ts
580
- s.extend(S.default);
581
- var Z = "DD/MM/YYYY", ne = "DD/MM/YYYY HH:mm", Q = "YYYY-MM-DD", $ = "YYYY-MM-DDTHH:mm:ss";
582
- function re(e = {}) {
583
- let t = () => e.showTime?.() ?? !1, n = () => t() ? ne : Z, r = () => t() ? "##/##/#### ##:##" : "##/##/####", i = () => t() ? "dd/mm/aaaa hh:mm" : "dd/mm/aaaa";
584
- function a(e) {
585
- if (e == null || e === "") return null;
586
- if (e instanceof Date) return isNaN(e.getTime()) ? null : e;
587
- if (typeof e == "string") {
588
- let t = s(e, Q, !0);
589
- if (t.isValid()) return t.toDate();
590
- let n = s(e);
591
- return n.isValid() ? n.toDate() : null;
592
- }
593
- return null;
594
- }
595
- function o(n) {
596
- return n ? (e.valueFormat?.() ?? "iso") === "date" ? n : s(n).format(t() ? $ : Q) : null;
597
- }
598
- function c(e) {
599
- return e ? s(e).format(n()) : "";
600
- }
601
- function l(e) {
602
- if (!e) return null;
603
- let t = s(e, n(), !0);
604
- return t.isValid() ? t.toDate() : null;
605
- }
606
- function u() {
607
- return t() ? /* @__PURE__ */ new Date() : s().startOf("day").toDate();
608
- }
609
- return {
610
- toDate: a,
611
- toValue: o,
612
- toDisplay: c,
613
- fromDisplay: l,
614
- today: u,
615
- mask: r,
616
- placeholder: i,
617
- displayFormat: n
618
- };
619
- }
620
- // src/composables/useFormKeyboardNav.ts
621
- var ie = "input:not([type=\"hidden\"]):not([disabled]), textarea:not([disabled]), select:not([disabled]), button:not([disabled]), [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"]", ae = ".p-select, .p-multiselect, .p-cascadeselect, .p-treeselect", oe = ".w-segmented, .w-choice, .p-selectbutton, [role=\"radiogroup\"]";
622
- function se(e, t = {}) {
623
- let n = () => !t.enabled || t.enabled();
624
- function i() {
625
- let t = e.value;
626
- return t ? Array.from(t.querySelectorAll(ie)).filter((e) => e.getClientRects().length > 0 && !e.hasAttribute("data-kbd-skip")) : [];
627
- }
628
- function a() {
629
- n() && r(() => {
630
- let e = i(), t = e.find((e) => e.tagName !== "BUTTON") ?? e[0];
631
- if (!t) return;
632
- t.focus();
633
- let n = t;
634
- if (typeof n.select == "function") try {
635
- n.select();
636
- } catch {}
637
- });
638
- }
639
- function o(e) {
640
- if (!n() || e.key !== "Enter" || e.isComposing) return;
641
- let r = e.target;
642
- if (r.tagName === "TEXTAREA") return;
643
- let a = r.closest(oe);
644
- if (r.tagName === "BUTTON" && !a || (e.preventDefault(), r.closest("[data-kbd-hold]")) || r.closest("[aria-expanded=\"true\"]")) return;
645
- r.closest(ae) && e.stopPropagation();
646
- let o = i(), s = o.indexOf(r);
647
- if (s === -1) return;
648
- let c = o.slice(s + 1).find((e) => !a || !a.contains(e));
649
- c ? c.focus() : t.onSubmit?.();
650
- }
651
- return {
652
- focusFirst: a,
653
- handleKeydown: o
654
- };
655
- }
656
- export { y as _, X as a, V as c, B as d, U as f, T as g, w as h, Y as i, z as l, C as m, re as n, G as o, R as p, J as r, W as s, se as t, H as u, x as v };
657
-
658
- //# sourceMappingURL=useFormKeyboardNav-wVvZqL_0.js.map