@wgalleti/primevue-components 2.3.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/components-Baq_M7Gn.cjs +25 -0
- package/dist/components-Baq_M7Gn.cjs.map +1 -0
- package/dist/{components-CwZVBNLm.js → components-BoRkwqQg.js} +2503 -2503
- package/dist/components-BoRkwqQg.js.map +1 -0
- package/dist/components.cjs +1 -1
- package/dist/components.js +1 -1
- package/dist/composables/useBreakpoint.d.ts +3 -0
- package/dist/{composables-rF6oNCGV.cjs → composables-B6kp379d.cjs} +2 -2
- package/dist/composables-B6kp379d.cjs.map +1 -0
- package/dist/{composables-DbmYTwL7.js → composables-DYbPW1ve.js} +265 -265
- package/dist/composables-DYbPW1ve.js.map +1 -0
- package/dist/composables.cjs +1 -1
- package/dist/composables.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -9
- package/dist/index.js.map +1 -1
- package/dist/routeTabs-CEBF0r_Z.js +9 -0
- package/dist/routeTabs-CEBF0r_Z.js.map +1 -0
- package/dist/routeTabs-a2hlb8DZ.cjs +2 -0
- package/dist/routeTabs-a2hlb8DZ.cjs.map +1 -0
- package/dist/types/plugin.d.ts +4 -1
- package/dist/types.cjs +1 -1
- package/dist/types.js +2 -2
- package/dist/useFormKeyboardNav-B9hm1fTm.cjs +3 -0
- package/dist/useFormKeyboardNav-B9hm1fTm.cjs.map +1 -0
- package/dist/{useFormKeyboardNav-CeR3k4bn.js → useFormKeyboardNav-DaNdKt5u.js} +137 -135
- package/dist/useFormKeyboardNav-DaNdKt5u.js.map +1 -0
- package/package.json +1 -1
- package/dist/components-Cqtp3sI9.cjs +0 -25
- package/dist/components-Cqtp3sI9.cjs.map +0 -1
- package/dist/components-CwZVBNLm.js.map +0 -1
- package/dist/composables-DbmYTwL7.js.map +0 -1
- package/dist/composables-rF6oNCGV.cjs.map +0 -1
- package/dist/routeTabs-BnVpnSeJ.cjs +0 -2
- package/dist/routeTabs-BnVpnSeJ.cjs.map +0 -1
- package/dist/routeTabs-C86S8jNU.js +0 -9
- package/dist/routeTabs-C86S8jNU.js.map +0 -1
- package/dist/useFormKeyboardNav-BDnTzUm9.cjs +0 -3
- package/dist/useFormKeyboardNav-BDnTzUm9.cjs.map +0 -1
- package/dist/useFormKeyboardNav-CeR3k4bn.js.map +0 -1
|
@@ -1,93 +1,95 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { useToast as
|
|
6
|
-
import { useConfirm as
|
|
1
|
+
import { a as e, n as t } from "./routeTabs-CEBF0r_Z.js";
|
|
2
|
+
import { getCurrentInstance as n, inject as r, nextTick as i, onMounted as a, onScopeDispose as o, readonly as s, ref as c, toValue as l, watch as u } from "vue";
|
|
3
|
+
import d from "dayjs";
|
|
4
|
+
import f from "dayjs/plugin/customParseFormat.js";
|
|
5
|
+
import { useToast as p } from "primevue/usetoast";
|
|
6
|
+
import { useConfirm as m } from "primevue/useconfirm";
|
|
7
7
|
// src/composables/useBreakpoint.ts
|
|
8
|
-
var
|
|
8
|
+
var h = {
|
|
9
9
|
celular: 600,
|
|
10
10
|
retrato: 840,
|
|
11
11
|
desktop: 1200
|
|
12
12
|
};
|
|
13
|
-
function
|
|
14
|
-
let t =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
function g(e, t) {
|
|
14
|
+
let r = c(t), i = () => {
|
|
15
|
+
if (typeof window > "u" || typeof window.matchMedia != "function") return;
|
|
16
|
+
let t = window.matchMedia(e);
|
|
17
|
+
r.value = t.matches;
|
|
18
|
+
let n = (e) => {
|
|
19
|
+
r.value = e.matches;
|
|
20
|
+
};
|
|
21
|
+
t.addEventListener("change", n), o(() => t.removeEventListener("change", n));
|
|
20
22
|
};
|
|
21
|
-
return n
|
|
23
|
+
return n() ? a(i) : i(), r;
|
|
22
24
|
}
|
|
23
|
-
function
|
|
24
|
-
let e =
|
|
25
|
+
function _() {
|
|
26
|
+
let e = g(`(max-width: ${h.celular - 1}px)`, !1), t = g(`(max-width: ${h.retrato - 1}px)`, !1), n = g(`(min-width: ${h.retrato}px)`, !0), r = g(`(min-width: ${h.desktop}px)`, !0), i = g("(pointer: coarse)", !1);
|
|
25
27
|
return {
|
|
26
|
-
isCelular:
|
|
27
|
-
isRetrato:
|
|
28
|
-
isPaisagem:
|
|
29
|
-
isDesktop:
|
|
30
|
-
isToque:
|
|
28
|
+
isCelular: s(e),
|
|
29
|
+
isRetrato: s(t),
|
|
30
|
+
isPaisagem: s(n),
|
|
31
|
+
isDesktop: s(r),
|
|
32
|
+
isToque: s(i)
|
|
31
33
|
};
|
|
32
34
|
}
|
|
33
35
|
// src/composables/useDelayedLoading.ts
|
|
34
|
-
function
|
|
35
|
-
let n =
|
|
36
|
+
function v(e, { delay: t = 150 } = {}) {
|
|
37
|
+
let n = c(!1), r, i = () => {
|
|
36
38
|
r !== void 0 && clearTimeout(r), r = void 0;
|
|
37
39
|
};
|
|
38
|
-
return
|
|
39
|
-
|
|
40
|
+
return u(() => l(e), (e) => {
|
|
41
|
+
i(), e ? r = setTimeout(() => {
|
|
40
42
|
r = void 0, n.value = !0;
|
|
41
|
-
},
|
|
42
|
-
}, { immediate: !0 }), i
|
|
43
|
+
}, l(t)) : n.value = !1;
|
|
44
|
+
}, { immediate: !0 }), o(i), { showSkeleton: s(n) };
|
|
43
45
|
}
|
|
44
46
|
// src/utils/dates.ts
|
|
45
|
-
|
|
46
|
-
function
|
|
47
|
+
d.extend(f);
|
|
48
|
+
function y(e) {
|
|
47
49
|
if (!e) return null;
|
|
48
50
|
if (e instanceof Date) return e;
|
|
49
|
-
let t =
|
|
50
|
-
return t.isValid() ? t.toDate() :
|
|
51
|
+
let t = d(e, "YYYY-MM-DD", !0);
|
|
52
|
+
return t.isValid() ? t.toDate() : d(e).toDate();
|
|
51
53
|
}
|
|
52
|
-
function
|
|
53
|
-
return e ? typeof e == "string" ? e :
|
|
54
|
+
function b(e) {
|
|
55
|
+
return e ? typeof e == "string" ? e : d(e).format("YYYY-MM-DD") : null;
|
|
54
56
|
}
|
|
55
|
-
function
|
|
56
|
-
return e ? typeof e == "string" ? e :
|
|
57
|
+
function x(e) {
|
|
58
|
+
return e ? typeof e == "string" ? e : d(e).toISOString() : null;
|
|
57
59
|
}
|
|
58
|
-
function
|
|
59
|
-
return e ?
|
|
60
|
+
function S(e, t = "DD/MM/YYYY") {
|
|
61
|
+
return e ? d(e).format(t) : "—";
|
|
60
62
|
}
|
|
61
|
-
function
|
|
62
|
-
return e ?
|
|
63
|
+
function C(e) {
|
|
64
|
+
return e ? d(e).format("DD/MM/YYYY HH:mm") : "—";
|
|
63
65
|
}
|
|
64
66
|
// src/utils/masks.ts
|
|
65
|
-
function
|
|
67
|
+
function w(e) {
|
|
66
68
|
return e.replace(/\D/g, "");
|
|
67
69
|
}
|
|
68
|
-
function
|
|
70
|
+
function T(e) {
|
|
69
71
|
if (!e) return "—";
|
|
70
|
-
let t =
|
|
72
|
+
let t = w(e);
|
|
71
73
|
return t.length === 11 ? t.replace(/^(\d{3})(\d{3})(\d{3})(\d{2})$/, "$1.$2.$3-$4") : e;
|
|
72
74
|
}
|
|
73
|
-
function
|
|
75
|
+
function E(e) {
|
|
74
76
|
if (!e) return "—";
|
|
75
|
-
let t =
|
|
77
|
+
let t = w(e);
|
|
76
78
|
return t.length === 14 ? t.replace(/^(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})$/, "$1.$2.$3/$4-$5") : e;
|
|
77
79
|
}
|
|
78
|
-
function
|
|
80
|
+
function D(e) {
|
|
79
81
|
if (!e) return "—";
|
|
80
|
-
let t =
|
|
81
|
-
return t.length === 11 ?
|
|
82
|
+
let t = w(e);
|
|
83
|
+
return t.length === 11 ? T(e) : t.length === 14 ? E(e) : e;
|
|
82
84
|
}
|
|
83
|
-
function
|
|
85
|
+
function O(e) {
|
|
84
86
|
if (!e) return "—";
|
|
85
|
-
let t =
|
|
87
|
+
let t = w(e);
|
|
86
88
|
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;
|
|
87
89
|
}
|
|
88
|
-
function
|
|
90
|
+
function k(e) {
|
|
89
91
|
if (!e) return null;
|
|
90
|
-
let t =
|
|
92
|
+
let t = w(e);
|
|
91
93
|
if (t.length !== 11) return "CPF deve ter 11 dígitos.";
|
|
92
94
|
if (/^(\d)\1{10}$/.test(t)) return "CPF inválido.";
|
|
93
95
|
let n = 0;
|
|
@@ -100,9 +102,9 @@ function D(e) {
|
|
|
100
102
|
let a = r < 2 ? 0 : 11 - r;
|
|
101
103
|
return parseInt(t[10]) === a ? null : "CPF inválido.";
|
|
102
104
|
}
|
|
103
|
-
function
|
|
105
|
+
function A(e) {
|
|
104
106
|
if (!e) return null;
|
|
105
|
-
let t =
|
|
107
|
+
let t = w(e);
|
|
106
108
|
if (t.length !== 14) return "CNPJ deve ter 14 dígitos.";
|
|
107
109
|
if (/^(\d)\1{13}$/.test(t)) return "CNPJ inválido.";
|
|
108
110
|
let n = [
|
|
@@ -143,29 +145,29 @@ function O(e) {
|
|
|
143
145
|
let s = i < 2 ? 0 : 11 - i;
|
|
144
146
|
return parseInt(t[13]) === s ? null : "CNPJ inválido.";
|
|
145
147
|
}
|
|
146
|
-
function
|
|
148
|
+
function j(e) {
|
|
147
149
|
if (!e) return null;
|
|
148
|
-
let t =
|
|
149
|
-
return t.length === 11 ?
|
|
150
|
+
let t = w(e);
|
|
151
|
+
return t.length === 11 ? k(e) : t.length === 14 ? A(e) : "CPF deve ter 11 dígitos ou CNPJ deve ter 14 dígitos.";
|
|
150
152
|
}
|
|
151
153
|
// src/composables/useFormatters.ts
|
|
152
|
-
var
|
|
153
|
-
function
|
|
154
|
-
let n = `${e}-${t}`, r =
|
|
154
|
+
var M = /* @__PURE__ */ new Map();
|
|
155
|
+
function N(e, t) {
|
|
156
|
+
let n = `${e}-${t}`, r = M.get(n);
|
|
155
157
|
return r || (r = new Intl.NumberFormat(e, {
|
|
156
158
|
minimumFractionDigits: t,
|
|
157
159
|
maximumFractionDigits: t
|
|
158
|
-
}),
|
|
160
|
+
}), M.set(n, r)), r;
|
|
159
161
|
}
|
|
160
|
-
function
|
|
161
|
-
let n = `${e}-${t}`, r =
|
|
162
|
+
function P(e, t) {
|
|
163
|
+
let n = `${e}-${t}`, r = M.get(n);
|
|
162
164
|
return r || (r = new Intl.NumberFormat(e, {
|
|
163
165
|
style: "currency",
|
|
164
166
|
currency: t
|
|
165
|
-
}),
|
|
167
|
+
}), M.set(n, r)), r;
|
|
166
168
|
}
|
|
167
|
-
function
|
|
168
|
-
let n = `${e}-compact-${t ?? ""}`, r =
|
|
169
|
+
function F(e, t) {
|
|
170
|
+
let n = `${e}-compact-${t ?? ""}`, r = M.get(n);
|
|
169
171
|
return r || (r = new Intl.NumberFormat(e, {
|
|
170
172
|
notation: "compact",
|
|
171
173
|
minimumFractionDigits: 0,
|
|
@@ -174,36 +176,36 @@ function N(e, t) {
|
|
|
174
176
|
style: "currency",
|
|
175
177
|
currency: t
|
|
176
178
|
} : {}
|
|
177
|
-
}),
|
|
179
|
+
}), M.set(n, r)), r;
|
|
178
180
|
}
|
|
179
|
-
function
|
|
180
|
-
let t =
|
|
181
|
+
function I() {
|
|
182
|
+
let t = r(e, {
|
|
181
183
|
defaultPageSize: 20,
|
|
182
184
|
dateFormat: "DD/MM/YYYY",
|
|
183
185
|
dateTimeFormat: "DD/MM/YYYY HH:mm",
|
|
184
186
|
locale: "pt-BR",
|
|
185
187
|
currency: "BRL"
|
|
186
|
-
}),
|
|
188
|
+
}), n = t?.locale ?? "pt-BR", i = t?.currency ?? "BRL";
|
|
187
189
|
function a(e) {
|
|
188
|
-
return e == null ? "—" :
|
|
190
|
+
return e == null ? "—" : P(n, i).format(e);
|
|
189
191
|
}
|
|
190
192
|
function o(e, t = 2) {
|
|
191
|
-
return e == null ? "—" :
|
|
193
|
+
return e == null ? "—" : N(n, t).format(e);
|
|
192
194
|
}
|
|
193
195
|
function s(e, n) {
|
|
194
|
-
return
|
|
196
|
+
return S(e, n ?? t?.dateFormat ?? "DD/MM/YYYY");
|
|
195
197
|
}
|
|
196
198
|
function c(e) {
|
|
197
|
-
return
|
|
199
|
+
return C(e);
|
|
198
200
|
}
|
|
199
201
|
function l(e) {
|
|
200
|
-
return e == null ? "—" : `${
|
|
202
|
+
return e == null ? "—" : `${N(n, 2).format(e)}%`;
|
|
201
203
|
}
|
|
202
204
|
function u(e) {
|
|
203
|
-
return e == null ? "—" : Math.abs(e) < 1e3 ? a(e) :
|
|
205
|
+
return e == null ? "—" : Math.abs(e) < 1e3 ? a(e) : F(n, i).format(e);
|
|
204
206
|
}
|
|
205
207
|
function d(e) {
|
|
206
|
-
return e == null ? "—" :
|
|
208
|
+
return e == null ? "—" : F(n).format(e);
|
|
207
209
|
}
|
|
208
210
|
return {
|
|
209
211
|
formatCurrency: a,
|
|
@@ -213,49 +215,49 @@ function P() {
|
|
|
213
215
|
formatDate: s,
|
|
214
216
|
formatDateTime: c,
|
|
215
217
|
formatPercent: l,
|
|
216
|
-
formatCpf:
|
|
217
|
-
formatCnpj:
|
|
218
|
-
formatCpfCnpj:
|
|
219
|
-
formatTelefone:
|
|
220
|
-
validateCpf:
|
|
221
|
-
validateCnpj:
|
|
222
|
-
validateCpfCnpj:
|
|
223
|
-
parseDate:
|
|
224
|
-
toDateString:
|
|
225
|
-
toDateTimeString:
|
|
218
|
+
formatCpf: T,
|
|
219
|
+
formatCnpj: E,
|
|
220
|
+
formatCpfCnpj: D,
|
|
221
|
+
formatTelefone: O,
|
|
222
|
+
validateCpf: k,
|
|
223
|
+
validateCnpj: A,
|
|
224
|
+
validateCpfCnpj: j,
|
|
225
|
+
parseDate: y,
|
|
226
|
+
toDateString: b,
|
|
227
|
+
toDateTimeString: x
|
|
226
228
|
};
|
|
227
229
|
}
|
|
228
230
|
// src/utils/formRecord.ts
|
|
229
|
-
function
|
|
231
|
+
function L(e) {
|
|
230
232
|
let t = {};
|
|
231
233
|
for (let n of e) t[n.field] = n.defaultValue === void 0 ? null : typeof n.defaultValue == "function" ? n.defaultValue() : n.defaultValue;
|
|
232
234
|
return t;
|
|
233
235
|
}
|
|
234
|
-
function
|
|
236
|
+
function R(e, t, n) {
|
|
235
237
|
let r = {};
|
|
236
238
|
for (let i of t) {
|
|
237
239
|
let t = e[i.field] === void 0 ? null : e[i.field];
|
|
238
|
-
t && (i.type === "date" || i.type === "datetime") && typeof t == "string" && (t =
|
|
240
|
+
t && (i.type === "date" || i.type === "datetime") && typeof t == "string" && (t = y(t)), n[i.field] = t, r[i.field] = t;
|
|
239
241
|
}
|
|
240
242
|
return r;
|
|
241
243
|
}
|
|
242
|
-
function
|
|
244
|
+
function z(e, t) {
|
|
243
245
|
let n = { ...e };
|
|
244
246
|
for (let e of t) {
|
|
245
247
|
let t = n[e.field];
|
|
246
|
-
if (e.type === "date" && t instanceof Date ? n[e.field] =
|
|
248
|
+
if (e.type === "date" && t instanceof Date ? n[e.field] = b(t) : e.type === "datetime" && t instanceof Date && (n[e.field] = x(t)), e.type === "fk" && typeof t == "object" && t) {
|
|
247
249
|
let r = e.optionValue || "id";
|
|
248
250
|
n[e.field] = t[r] ?? t;
|
|
249
251
|
}
|
|
250
|
-
(e.type === "mask" || e.type === "cpf_cnpj") && typeof t == "string" && (n[e.field] =
|
|
252
|
+
(e.type === "mask" || e.type === "cpf_cnpj") && typeof t == "string" && (n[e.field] = w(t));
|
|
251
253
|
}
|
|
252
254
|
return n;
|
|
253
255
|
}
|
|
254
|
-
function
|
|
256
|
+
function B(e, t, n = !1) {
|
|
255
257
|
return e.visible === void 0 || e.visible === !0 ? !0 : typeof e.visible == "function" ? e.visible(t, n) : e.visible;
|
|
256
258
|
}
|
|
257
|
-
function
|
|
258
|
-
for (let r of e) if (
|
|
259
|
+
function V(e, t, n = !1) {
|
|
260
|
+
for (let r of e) if (B(r, t, n)) {
|
|
259
261
|
if (r.validate) {
|
|
260
262
|
let e = r.validate(t[r.field], {
|
|
261
263
|
formData: t,
|
|
@@ -271,8 +273,8 @@ function z(e, t, n = !1) {
|
|
|
271
273
|
return null;
|
|
272
274
|
}
|
|
273
275
|
// src/composables/useAppToast.ts
|
|
274
|
-
function
|
|
275
|
-
let e =
|
|
276
|
+
function H() {
|
|
277
|
+
let e = p();
|
|
276
278
|
function t(t, n = "Sucesso") {
|
|
277
279
|
e.add({
|
|
278
280
|
severity: "success",
|
|
@@ -313,8 +315,8 @@ function B() {
|
|
|
313
315
|
};
|
|
314
316
|
}
|
|
315
317
|
// src/composables/useAppConfirm.ts
|
|
316
|
-
function
|
|
317
|
-
let e =
|
|
318
|
+
function U() {
|
|
319
|
+
let e = m(), n = t(), r = () => n && !n.active.value ? "body" : n?.hostEl.value ?? "body";
|
|
318
320
|
function i(t, n = "Deseja realmente excluir este registro?") {
|
|
319
321
|
e.require({
|
|
320
322
|
appendTo: r(),
|
|
@@ -376,10 +378,10 @@ function V() {
|
|
|
376
378
|
};
|
|
377
379
|
}
|
|
378
380
|
// src/composables/useApiError.ts
|
|
379
|
-
function
|
|
381
|
+
function W(e) {
|
|
380
382
|
return e.replace(/_/g, " ").replace(/^\w/, (e) => e.toUpperCase());
|
|
381
383
|
}
|
|
382
|
-
function
|
|
384
|
+
function G(e) {
|
|
383
385
|
if (typeof e == "string") return e;
|
|
384
386
|
if (Array.isArray(e)) {
|
|
385
387
|
let t = e.filter((e) => typeof e == "string");
|
|
@@ -391,7 +393,7 @@ function U(e) {
|
|
|
391
393
|
let n = [];
|
|
392
394
|
for (let [e, r] of Object.entries(t)) {
|
|
393
395
|
if (e === "non_field_errors") continue;
|
|
394
|
-
let t =
|
|
396
|
+
let t = W(e);
|
|
395
397
|
if (Array.isArray(r)) {
|
|
396
398
|
let e = r.filter((e) => typeof e == "string");
|
|
397
399
|
e.length > 0 && n.push(`${t}: ${e.join(" ")}`);
|
|
@@ -401,12 +403,12 @@ function U(e) {
|
|
|
401
403
|
}
|
|
402
404
|
return null;
|
|
403
405
|
}
|
|
404
|
-
function
|
|
406
|
+
function K(e, t = "Erro inesperado") {
|
|
405
407
|
if (!e || typeof e != "object") return t;
|
|
406
408
|
let n = e.response?.data;
|
|
407
|
-
return !n || typeof n != "object" ? t :
|
|
409
|
+
return !n || typeof n != "object" ? t : G(n.detail ?? n) || t;
|
|
408
410
|
}
|
|
409
|
-
function
|
|
411
|
+
function q(e) {
|
|
410
412
|
let t = e?.response;
|
|
411
413
|
if (!t || t.status !== 400 || typeof t.data != "object" || t.data === null) return {};
|
|
412
414
|
let n = {};
|
|
@@ -417,64 +419,64 @@ function G(e) {
|
|
|
417
419
|
}
|
|
418
420
|
return n;
|
|
419
421
|
}
|
|
420
|
-
function
|
|
422
|
+
function J() {
|
|
421
423
|
return {
|
|
422
|
-
extractApiError:
|
|
423
|
-
extractFieldErrors:
|
|
424
|
+
extractApiError: K,
|
|
425
|
+
extractFieldErrors: q
|
|
424
426
|
};
|
|
425
427
|
}
|
|
426
428
|
// src/composables/useDateInput.ts
|
|
427
|
-
|
|
428
|
-
var
|
|
429
|
-
function
|
|
430
|
-
let t = () => e.showTime?.() ?? !1, n = () => t() ?
|
|
429
|
+
d.extend(f);
|
|
430
|
+
var Y = "DD/MM/YYYY", X = "DD/MM/YYYY HH:mm", Z = "YYYY-MM-DD", Q = "YYYY-MM-DDTHH:mm:ss";
|
|
431
|
+
function $(e = {}) {
|
|
432
|
+
let t = () => e.showTime?.() ?? !1, n = () => t() ? X : Y, r = () => t() ? "##/##/#### ##:##" : "##/##/####", i = () => t() ? "dd/mm/aaaa hh:mm" : "dd/mm/aaaa";
|
|
431
433
|
function a(e) {
|
|
432
434
|
if (e == null || e === "") return null;
|
|
433
435
|
if (e instanceof Date) return isNaN(e.getTime()) ? null : e;
|
|
434
436
|
if (typeof e == "string") {
|
|
435
|
-
let t =
|
|
437
|
+
let t = d(e, Z, !0);
|
|
436
438
|
if (t.isValid()) return t.toDate();
|
|
437
|
-
let n =
|
|
439
|
+
let n = d(e);
|
|
438
440
|
return n.isValid() ? n.toDate() : null;
|
|
439
441
|
}
|
|
440
442
|
return null;
|
|
441
443
|
}
|
|
442
444
|
function o(n) {
|
|
443
|
-
return n ? (e.valueFormat?.() ?? "iso") === "date" ? n :
|
|
445
|
+
return n ? (e.valueFormat?.() ?? "iso") === "date" ? n : d(n).format(t() ? Q : Z) : null;
|
|
444
446
|
}
|
|
445
447
|
function s(e) {
|
|
446
|
-
return e ?
|
|
448
|
+
return e ? d(e).format(n()) : "";
|
|
447
449
|
}
|
|
448
450
|
function c(e) {
|
|
449
451
|
if (!e) return null;
|
|
450
|
-
let t =
|
|
452
|
+
let t = d(e, n(), !0);
|
|
451
453
|
return t.isValid() ? t.toDate() : null;
|
|
452
454
|
}
|
|
453
|
-
function
|
|
454
|
-
return t() ? /* @__PURE__ */ new Date() :
|
|
455
|
+
function l() {
|
|
456
|
+
return t() ? /* @__PURE__ */ new Date() : d().startOf("day").toDate();
|
|
455
457
|
}
|
|
456
458
|
return {
|
|
457
459
|
toDate: a,
|
|
458
460
|
toValue: o,
|
|
459
461
|
toDisplay: s,
|
|
460
462
|
fromDisplay: c,
|
|
461
|
-
today:
|
|
463
|
+
today: l,
|
|
462
464
|
mask: r,
|
|
463
465
|
placeholder: i,
|
|
464
466
|
displayFormat: n
|
|
465
467
|
};
|
|
466
468
|
}
|
|
467
469
|
// src/composables/useFormKeyboardNav.ts
|
|
468
|
-
var
|
|
469
|
-
function
|
|
470
|
+
var ee = "input:not([type=\"hidden\"]):not([disabled]), textarea:not([disabled]), select:not([disabled]), button:not([disabled]), [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"]", te = ".p-select, .p-multiselect, .p-cascadeselect, .p-treeselect", ne = ".w-segmented, .w-choice, .p-selectbutton, [role=\"radiogroup\"]";
|
|
471
|
+
function re(e, t = {}) {
|
|
470
472
|
let n = () => !t.enabled || t.enabled();
|
|
471
|
-
function
|
|
473
|
+
function r() {
|
|
472
474
|
let t = e.value;
|
|
473
|
-
return t ? Array.from(t.querySelectorAll(
|
|
475
|
+
return t ? Array.from(t.querySelectorAll(ee)).filter((e) => e.getClientRects().length > 0 && !e.hasAttribute("data-kbd-skip")) : [];
|
|
474
476
|
}
|
|
475
477
|
function a() {
|
|
476
|
-
n() &&
|
|
477
|
-
let e =
|
|
478
|
+
n() && i(() => {
|
|
479
|
+
let e = r(), t = e.find((e) => e.tagName !== "BUTTON") ?? e[0];
|
|
478
480
|
if (!t) return;
|
|
479
481
|
t.focus();
|
|
480
482
|
let n = t;
|
|
@@ -485,12 +487,12 @@ function te(e, t = {}) {
|
|
|
485
487
|
}
|
|
486
488
|
function o(e) {
|
|
487
489
|
if (!n() || e.key !== "Enter" || e.isComposing) return;
|
|
488
|
-
let
|
|
489
|
-
if (
|
|
490
|
-
let a =
|
|
491
|
-
if (
|
|
492
|
-
|
|
493
|
-
let o =
|
|
490
|
+
let i = e.target;
|
|
491
|
+
if (i.tagName === "TEXTAREA") return;
|
|
492
|
+
let a = i.closest(ne);
|
|
493
|
+
if (i.tagName === "BUTTON" && !a || (e.preventDefault(), i.closest("[data-kbd-hold]")) || i.closest("[aria-expanded=\"true\"]")) return;
|
|
494
|
+
i.closest(te) && e.stopPropagation();
|
|
495
|
+
let o = r(), s = o.indexOf(i);
|
|
494
496
|
if (s === -1) return;
|
|
495
497
|
let c = o.slice(s + 1).find((e) => !a || !a.contains(e));
|
|
496
498
|
c ? c.focus() : t.onSubmit?.();
|
|
@@ -500,6 +502,6 @@ function te(e, t = {}) {
|
|
|
500
502
|
handleKeydown: o
|
|
501
503
|
};
|
|
502
504
|
}
|
|
503
|
-
export {
|
|
505
|
+
export { v as _, J as a, z as c, R as d, V as f, x as g, b as h, q as i, L as l, y as m, $ as n, U as o, I as p, K as r, H as s, re as t, B as u, h as v, _ as y };
|
|
504
506
|
|
|
505
|
-
//# sourceMappingURL=useFormKeyboardNav-
|
|
507
|
+
//# sourceMappingURL=useFormKeyboardNav-DaNdKt5u.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFormKeyboardNav-DaNdKt5u.js","names":["axiosError","W_CONFIG_KEY","useTabHost","dayjs","customParseFormat","BREAKPOINTS","useMediaQuery","matches","ref","inicial","ligar","mql","query","onChange","event","onScopeDispose","getCurrentInstance","onMounted","useBreakpoint","isCelular","isRetrato","isPaisagem","isDesktop","isToque","readonly","useDelayedLoading","showSkeleton","timer","clear","watch","toValue","loading","active","delay","parseDate","value","d","toDateString","toDateTimeString","formatDateValue","format","formatDateTimeValue","stripMask","formatCpf","digits","formatCnpj","formatCpfCnpj","formatTelefone","validateCpf","cpf","soma","i","resto","d1","d2","validateCnpj","cnpj","pesos1","pesos2","validateCpfCnpj","numberFormatters","getNumberFormatter","key","locale","decimals","fmt","getCurrencyFormatter","currency","getCompactFormatter","useFormatters","config","inject","currencyCode","formatCurrency","formatNumber","formatDate","formatDateTime","formatPercent","formatCurrencyCompact","formatNumberCompact","getFieldDefaults","defaults","f","fields","loadItemIntoRecord","snapshot","item","convertFormRecord","out","record","val","isFieldVisible","field","formData","isEditing","validateFormRecord","result","useAppToast","toast","useToast","success","title","message","error","warn","info","useAppConfirm","confirm","useConfirm","tabHost","appendTo","confirmDelete","onAccept","confirmAction","confirmDiscard","respondido","responder","resolve","descartar","formatFieldName","c","extractMessage","detail","messages","obj","label","strs","extractApiError","fallback","data","extractFieldErrors","m","useApiError","DISPLAY_DATE","DISPLAY_DATETIME","ISO_DATE","ISO_DATETIME","useDateInput","withTime","opts","displayFormat","mask","placeholder","toDate","dateOnly","any","date","toDisplay","fromDisplay","text","today","FOCUSABLE","OPENS_ON_ENTER","OPTION_GROUP","useFormKeyboardNav","isEnabled","options","focusables","root","container","el","focusFirst","nextTick","els","first","input","handleKeydown","target","group","next"],"sources":["../src/composables/useBreakpoint.ts","../src/composables/useDelayedLoading.ts","../src/utils/dates.ts","../src/utils/masks.ts","../src/composables/useFormatters.ts","../src/utils/formRecord.ts","../src/composables/useAppToast.ts","../src/composables/useAppConfirm.ts","../src/composables/useApiError.ts","../src/composables/useDateInput.ts","../src/composables/useFormKeyboardNav.ts"],"sourcesContent":["import { getCurrentInstance, onMounted, onScopeDispose, readonly, ref, type Ref } from 'vue'\n\n/**\n * Faixas de largura da suite — a régua de layout.\n *\n * ```\n * < 600px celular 1 coluna, navegação colapsada\n * 600-839px tablet RETRATO 1 painel por vez, drill-in com voltar\n * 840-1199px tablet PAISAGEM 2 painéis lado a lado\n * >= 1200px desktop 2-3 painéis, densidade de mesa\n * ```\n *\n * 840px é a fronteira medium/expanded do Material — a única com dado de parque\n * (93,7% dos tablets em retrato abaixo dela, 97,2% em paisagem acima). Todo\n * tablet de 10-11\" em retrato mede 768-876 CSS px; em paisagem, >= 1024.\n *\n * **Largura, nunca `orientation`**: travar ou ramificar por orientação é falha de\n * acessibilidade (WCAG 1.3.4), e um tablet de 12,9\" em retrato tem largura de\n * laptop — ele deve receber o layout de duas colunas.\n */\nexport const BREAKPOINTS = {\n /** Acima disto é tablet ou maior. */\n celular: 600,\n /** Acima disto cabem dois painéis lado a lado. */\n retrato: 840,\n /** Acima disto é mesa: densidade e três painéis liberados. */\n desktop: 1200,\n} as const\n\n/**\n * Uma media query reativa, com limpeza automática ao sair do escopo.\n *\n * Dentro de componente o valor começa em `inicial` e só lê a janela no `onMounted`:\n * o servidor e o primeiro render do cliente saem iguais e a hidratação não diverge.\n * Fora de componente (escopo avulso, teste) lê na hora.\n */\nfunction useMediaQuery(query: string, inicial: boolean): Ref<boolean> {\n const matches = ref(inicial)\n\n const ligar = () => {\n // Sem `window` (SSR, teste em ambiente node) fica o valor inicial — o layout de mesa.\n if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return\n const mql = window.matchMedia(query)\n matches.value = mql.matches\n const onChange = (event: MediaQueryListEvent) => {\n matches.value = event.matches\n }\n mql.addEventListener('change', onChange)\n onScopeDispose(() => mql.removeEventListener('change', onChange))\n }\n\n if (getCurrentInstance()) onMounted(ligar)\n else ligar()\n\n return matches\n}\n\n/**\n * Em qual faixa a janela está, e se o ponteiro primário é o dedo.\n *\n * Antes da montagem (e no servidor) responde o layout de mesa: paisagem e desktop\n * `true`, o resto `false`. A faixa real chega no `onMounted`.\n *\n * `isToque` vem de `pointer: coarse` — o ponteiro **primário**, então notebook\n * com tela sensível continua reportando `fine` e não é afetado.\n *\n * ```ts\n * const { isRetrato, isToque } = useBreakpoint()\n * // isRetrato: uma coluna, drill-in, tabela vira card\n * ```\n */\nexport function useBreakpoint() {\n const isCelular = useMediaQuery(`(max-width: ${BREAKPOINTS.celular - 1}px)`, false)\n /** Tablet em pé ou menor: um painel por vez. */\n const isRetrato = useMediaQuery(`(max-width: ${BREAKPOINTS.retrato - 1}px)`, false)\n /** Tablet deitado ou maior: cabem dois painéis. */\n const isPaisagem = useMediaQuery(`(min-width: ${BREAKPOINTS.retrato}px)`, true)\n const isDesktop = useMediaQuery(`(min-width: ${BREAKPOINTS.desktop}px)`, true)\n /** O dedo é o ponteiro: alvos maiores, sem hover. */\n const isToque = useMediaQuery('(pointer: coarse)', false)\n\n return {\n isCelular: readonly(isCelular),\n isRetrato: readonly(isRetrato),\n isPaisagem: readonly(isPaisagem),\n isDesktop: readonly(isDesktop),\n isToque: readonly(isToque),\n }\n}\n","import { onScopeDispose, readonly, ref, toValue, watch, type MaybeRefOrGetter } from 'vue'\n\nexport interface UseDelayedLoadingOptions {\n /** Milissegundos de carregamento antes de o esqueleto aparecer (valor, ref ou getter). Default 150. */\n delay?: MaybeRefOrGetter<number>\n}\n\n/**\n * Esqueleto sem piscar: `showSkeleton` só vira true se o carregamento passar de `delay` ms\n * e volta a false assim que termina. Só decide o que desenhar — nunca segura o dado.\n */\nexport function useDelayedLoading(\n loading: MaybeRefOrGetter<boolean>,\n { delay = 150 }: UseDelayedLoadingOptions = {},\n) {\n const showSkeleton = ref(false)\n let timer: ReturnType<typeof setTimeout> | undefined\n\n const clear = () => {\n if (timer !== undefined) clearTimeout(timer)\n timer = undefined\n }\n\n watch(\n () => toValue(loading),\n (active) => {\n clear()\n if (!active) {\n showSkeleton.value = false\n return\n }\n timer = setTimeout(() => {\n timer = undefined\n showSkeleton.value = true\n }, toValue(delay))\n },\n { immediate: true },\n )\n\n onScopeDispose(clear)\n\n return { showSkeleton: readonly(showSkeleton) }\n}\n","import dayjs from 'dayjs'\nimport customParseFormat from 'dayjs/plugin/customParseFormat.js'\n\ndayjs.extend(customParseFormat)\n\nexport function parseDate(value: string | Date | null | undefined): Date | null {\n if (!value) return null\n if (value instanceof Date) return value\n const d = dayjs(value, 'YYYY-MM-DD', true)\n return d.isValid() ? d.toDate() : dayjs(value).toDate()\n}\n\nexport function toDateString(value: Date | string | null | undefined): string | null {\n if (!value) return null\n if (typeof value === 'string') return value\n return dayjs(value).format('YYYY-MM-DD')\n}\n\nexport function toDateTimeString(value: Date | string | null | undefined): string | null {\n if (!value) return null\n if (typeof value === 'string') return value\n return dayjs(value).toISOString()\n}\n\nexport function formatDateValue(\n value: string | Date | null | undefined,\n format = 'DD/MM/YYYY',\n): string {\n if (!value) return '—'\n return dayjs(value).format(format)\n}\n\nexport function formatDateTimeValue(value: string | Date | null | undefined): string {\n if (!value) return '—'\n return dayjs(value).format('DD/MM/YYYY HH:mm')\n}\n","export function stripMask(value: string): string {\n return value.replace(/\\D/g, '')\n}\n\nexport function formatCpf(value: string | null | undefined): string {\n if (!value) return '—'\n const digits = stripMask(value)\n if (digits.length !== 11) return value\n return digits.replace(/^(\\d{3})(\\d{3})(\\d{3})(\\d{2})$/, '$1.$2.$3-$4')\n}\n\nexport function formatCnpj(value: string | null | undefined): string {\n if (!value) return '—'\n const digits = stripMask(value)\n if (digits.length !== 14) return value\n return digits.replace(/^(\\d{2})(\\d{3})(\\d{3})(\\d{4})(\\d{2})$/, '$1.$2.$3/$4-$5')\n}\n\nexport function formatCpfCnpj(value: string | null | undefined): string {\n if (!value) return '—'\n const digits = stripMask(value)\n if (digits.length === 11) return formatCpf(value)\n if (digits.length === 14) return formatCnpj(value)\n return value\n}\n\nexport function formatTelefone(value: string | null | undefined): string {\n if (!value) return '—'\n const digits = stripMask(value)\n if (digits.length === 11) return digits.replace(/^(\\d{2})(\\d{5})(\\d{4})$/, '($1) $2-$3')\n if (digits.length === 10) return digits.replace(/^(\\d{2})(\\d{4})(\\d{4})$/, '($1) $2-$3')\n return value\n}\n\nexport function validateCpf(value: string | null | undefined): string | null {\n if (!value) return null\n const cpf = stripMask(value)\n if (cpf.length !== 11) return 'CPF deve ter 11 dígitos.'\n if (/^(\\d)\\1{10}$/.test(cpf)) return 'CPF inválido.'\n let soma = 0\n for (let i = 0; i < 9; i++) soma += parseInt(cpf[i]) * (10 - i)\n let resto = soma % 11\n const d1 = resto < 2 ? 0 : 11 - resto\n if (parseInt(cpf[9]) !== d1) return 'CPF inválido.'\n soma = 0\n for (let i = 0; i < 10; i++) soma += parseInt(cpf[i]) * (11 - i)\n resto = soma % 11\n const d2 = resto < 2 ? 0 : 11 - resto\n if (parseInt(cpf[10]) !== d2) return 'CPF inválido.'\n return null\n}\n\nexport function validateCnpj(value: string | null | undefined): string | null {\n if (!value) return null\n const cnpj = stripMask(value)\n if (cnpj.length !== 14) return 'CNPJ deve ter 14 dígitos.'\n if (/^(\\d)\\1{13}$/.test(cnpj)) return 'CNPJ inválido.'\n const pesos1 = [5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2]\n let soma = 0\n for (let i = 0; i < 12; i++) soma += parseInt(cnpj[i]) * pesos1[i]\n let resto = soma % 11\n const d1 = resto < 2 ? 0 : 11 - resto\n if (parseInt(cnpj[12]) !== d1) return 'CNPJ inválido.'\n const pesos2 = [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2]\n soma = 0\n for (let i = 0; i < 13; i++) soma += parseInt(cnpj[i]) * pesos2[i]\n resto = soma % 11\n const d2 = resto < 2 ? 0 : 11 - resto\n if (parseInt(cnpj[13]) !== d2) return 'CNPJ inválido.'\n return null\n}\n\nexport function validateCpfCnpj(value: string | null | undefined): string | null {\n if (!value) return null\n const digits = stripMask(value)\n if (digits.length === 11) return validateCpf(value)\n if (digits.length === 14) return validateCnpj(value)\n return 'CPF deve ter 11 dígitos ou CNPJ deve ter 14 dígitos.'\n}\n","import { inject } from 'vue'\nimport { W_CONFIG_KEY } from '@/types/plugin'\nimport type { WPluginConfig } from '@/types/plugin'\nimport {\n formatDateValue,\n formatDateTimeValue,\n parseDate,\n toDateString,\n toDateTimeString,\n} from '@/utils/dates'\nimport {\n formatCpf,\n formatCnpj,\n formatCpfCnpj,\n formatTelefone,\n validateCpf,\n validateCnpj,\n validateCpfCnpj,\n} from '@/utils/masks'\n\nconst numberFormatters = new Map<string, Intl.NumberFormat>()\n\nfunction getNumberFormatter(locale: string, decimals: number): Intl.NumberFormat {\n const key = `${locale}-${decimals}`\n let fmt = numberFormatters.get(key)\n if (!fmt) {\n fmt = new Intl.NumberFormat(locale, {\n minimumFractionDigits: decimals,\n maximumFractionDigits: decimals,\n })\n numberFormatters.set(key, fmt)\n }\n return fmt\n}\n\nfunction getCurrencyFormatter(locale: string, currency: string): Intl.NumberFormat {\n const key = `${locale}-${currency}`\n let fmt = numberFormatters.get(key)\n if (!fmt) {\n fmt = new Intl.NumberFormat(locale, {\n style: 'currency',\n currency,\n })\n numberFormatters.set(key, fmt)\n }\n return fmt\n}\n\nfunction getCompactFormatter(locale: string, currency?: string): Intl.NumberFormat {\n const key = `${locale}-compact-${currency ?? ''}`\n let fmt = numberFormatters.get(key)\n if (!fmt) {\n fmt = new Intl.NumberFormat(locale, {\n notation: 'compact',\n minimumFractionDigits: 0, // Node 22 herda as 2 casas da moeda: \"R$ 2,0 mi\"\n maximumFractionDigits: 1,\n ...(currency ? { style: 'currency' as const, currency } : {}),\n })\n numberFormatters.set(key, fmt)\n }\n return fmt\n}\n\nexport function useFormatters() {\n const config = inject<WPluginConfig>(W_CONFIG_KEY, {\n defaultPageSize: 20,\n dateFormat: 'DD/MM/YYYY',\n dateTimeFormat: 'DD/MM/YYYY HH:mm',\n locale: 'pt-BR',\n currency: 'BRL',\n } as WPluginConfig)\n\n const locale = config?.locale ?? 'pt-BR'\n const currencyCode = config?.currency ?? 'BRL'\n\n function formatCurrency(value: number | null | undefined): string {\n if (value == null) return '—'\n return getCurrencyFormatter(locale, currencyCode).format(value)\n }\n\n function formatNumber(value: number | null | undefined, decimals = 2): string {\n if (value == null) return '—'\n return getNumberFormatter(locale, decimals).format(value)\n }\n\n function formatDate(value: string | Date | null | undefined, format?: string): string {\n return formatDateValue(value, format ?? config?.dateFormat ?? 'DD/MM/YYYY')\n }\n\n function formatDateTime(value: string | Date | null | undefined): string {\n return formatDateTimeValue(value)\n }\n\n function formatPercent(value: number | null | undefined): string {\n if (value == null) return '—'\n return `${getNumberFormatter(locale, 2).format(value)}%`\n }\n\n /** Moeda em notação compacta: `R$ 1,2 mi`, `R$ 350 mil`. Abaixo de mil, o formato cheio. */\n function formatCurrencyCompact(value: number | null | undefined): string {\n if (value == null) return '—'\n if (Math.abs(value) < 1000) return formatCurrency(value)\n return getCompactFormatter(locale, currencyCode).format(value)\n }\n\n /** Número em notação compacta: `12,5 mil`, `1,2 mi`. Abaixo de mil, até uma casa. */\n function formatNumberCompact(value: number | null | undefined): string {\n if (value == null) return '—'\n return getCompactFormatter(locale).format(value)\n }\n\n return {\n formatCurrency,\n formatCurrencyCompact,\n formatNumberCompact,\n formatNumber,\n formatDate,\n formatDateTime,\n formatPercent,\n formatCpf,\n formatCnpj,\n formatCpfCnpj,\n formatTelefone,\n validateCpf,\n validateCnpj,\n validateCpfCnpj,\n parseDate,\n toDateString,\n toDateTimeString,\n }\n}\n","/**\n * Regras de formulário que independem de onde o registro é gravado.\n *\n * Nasceram dentro do `useCrudManager` (que grava numa API) e saíram para cá quando o\n * `useSubviewCrud` passou a precisar das mesmas: um form é um form, o destino do\n * payload é que muda. Manter uma cópia em cada manager faria as duas divergirem no\n * primeiro `FieldType` novo.\n */\nimport type { FieldDef } from '@/types/field'\nimport { parseDate, toDateString, toDateTimeString } from './dates'\nimport { stripMask } from './masks'\n\n/** Valor inicial de cada campo: `defaultValue` (avaliado, se função) ou `null`. */\nexport function getFieldDefaults(fields: FieldDef[]): Record<string, unknown> {\n const defaults: Record<string, unknown> = {}\n for (const f of fields) {\n defaults[f.field] =\n f.defaultValue !== undefined\n ? typeof f.defaultValue === 'function'\n ? (f.defaultValue as () => unknown)()\n : f.defaultValue\n : null\n }\n return defaults\n}\n\n/**\n * Lê um registro existente para dentro do form.\n *\n * Data vem do servidor como string e o `WDatePicker` trabalha com `Date` — por isso a\n * volta por `parseDate`. Devolve o snapshot dos valores carregados, que o chamador usa\n * como base do diff quando quiser mandar só o que mudou.\n */\nexport function loadItemIntoRecord(\n item: Record<string, unknown>,\n fields: FieldDef[],\n target: Record<string, unknown>,\n): Record<string, unknown> {\n const snapshot: Record<string, unknown> = {}\n for (const f of fields) {\n let value = item[f.field] !== undefined ? item[f.field] : null\n if (value && (f.type === 'date' || f.type === 'datetime') && typeof value === 'string') {\n value = parseDate(value)\n }\n target[f.field] = value\n snapshot[f.field] = value\n }\n return snapshot\n}\n\n/**\n * Converte o form no registro que vai ser gravado: data vira string, FK vira id, campo\n * mascarado perde a máscara. Devolve objeto novo — o form não é tocado.\n */\nexport function convertFormRecord(\n record: Record<string, unknown>,\n fields: FieldDef[],\n): Record<string, unknown> {\n const out: Record<string, unknown> = { ...record }\n for (const f of fields) {\n const val = out[f.field]\n\n // Datas\n if (f.type === 'date' && val instanceof Date) {\n out[f.field] = toDateString(val)\n } else if (f.type === 'datetime' && val instanceof Date) {\n out[f.field] = toDateTimeString(val)\n }\n\n // FK — extrair o ID do objeto selecionado\n if (f.type === 'fk' && val !== null && typeof val === 'object') {\n const key = f.optionValue || 'id'\n out[f.field] = (val as Record<string, unknown>)[key] ?? val\n }\n\n // Máscaras — strip para gravar só dígitos\n if ((f.type === 'mask' || f.type === 'cpf_cnpj') && typeof val === 'string') {\n out[f.field] = stripMask(val)\n }\n }\n return out\n}\n\n/** Resolve `visible` do campo (boolean ou função) para o estado atual do form. */\nexport function isFieldVisible(\n field: FieldDef,\n formData: Record<string, unknown>,\n isEditing = false,\n): boolean {\n if (field.visible === undefined || field.visible === true) return true\n if (typeof field.visible === 'function') return field.visible(formData, isEditing)\n return field.visible\n}\n\n/**\n * Primeira mensagem de erro do form, ou `null` se está tudo certo.\n *\n * Campo oculto (`visible` falso para o form atual) não é validado: o usuário não\n * tem como preenchê-lo, então `required`/`validate` dele não podem barrar o save.\n *\n * A ordem importa: o `validate` do campo vence a obrigatoriedade, para a mensagem\n * específica (\"CNPJ inválido\") aparecer no lugar da genérica.\n */\nexport function validateFormRecord(\n fields: FieldDef[],\n formData: Record<string, unknown>,\n isEditing = false,\n): string | null {\n for (const f of fields) {\n if (!isFieldVisible(f, formData, isEditing)) continue\n if (f.validate) {\n const result = f.validate(formData[f.field], { formData, isEditing })\n if (result) return result\n }\n if (f.required) {\n const val = formData[f.field]\n if (val === null || val === undefined || val === '') {\n return `${f.label} é obrigatório`\n }\n }\n }\n return null\n}\n","import { useToast } from 'primevue/usetoast'\n\nexport function useAppToast() {\n const toast = useToast()\n\n function success(message: string, title = 'Sucesso') {\n toast.add({ severity: 'success', summary: title, detail: message, life: 3000 })\n }\n\n function error(message: string, title = 'Erro') {\n toast.add({ severity: 'error', summary: title, detail: message, life: 5000 })\n }\n\n function warn(message: string, title = 'Atenção') {\n toast.add({ severity: 'warn', summary: title, detail: message, life: 4000 })\n }\n\n function info(message: string, title = 'Info') {\n toast.add({ severity: 'info', summary: title, detail: message, life: 3000 })\n }\n\n return { success, error, warn, info }\n}\n","import { useConfirm } from 'primevue/useconfirm'\nimport { useTabHost } from '@/types/routeTabs'\n\nexport function useAppConfirm() {\n const confirm = useConfirm()\n // Dentro da navegação por abas, o confirm pendura no pane da própria aba\n // (some e volta com ela); fora de abas, o body de sempre. O ConfirmDialog\n // global continua único — só a âncora muda, por confirmação.\n const tabHost = useTabHost()\n // Aba oculta (fechar outras, limite de abas, X numa aba que não é a visível): o painel dela\n // está escondido, então a confirmação vai para o body — senão ninguém a vê e a aba não fecha.\n const appendTo = () =>\n tabHost && !tabHost.active.value ? 'body' : (tabHost?.hostEl.value ?? 'body')\n\n function confirmDelete(\n onAccept: () => void,\n message = 'Deseja realmente excluir este registro?',\n ) {\n confirm.require({\n appendTo: appendTo(),\n message,\n header: 'Confirmar Exclusão',\n icon: 'pi pi-trash',\n rejectLabel: 'Cancelar',\n rejectProps: {\n severity: 'secondary',\n text: true,\n },\n acceptLabel: 'Excluir',\n acceptProps: {\n severity: 'danger',\n },\n accept: onAccept,\n })\n }\n\n function confirmAction(message: string, onAccept: () => void, header = 'Confirmação') {\n confirm.require({\n appendTo: appendTo(),\n message,\n header,\n icon: 'pi pi-question-circle',\n rejectLabel: 'Cancelar',\n rejectProps: {\n severity: 'secondary',\n text: true,\n },\n acceptLabel: 'Confirmar',\n accept: onAccept,\n })\n }\n\n /**\n * Pergunta antes de descartar alteração não salva. Resolve `true` para descartar; fechar o\n * diálogo sem escolher conta como continuar editando.\n */\n function confirmDiscard(\n message = 'Há alterações não salvas. Descartar e fechar?',\n header = 'Alterações não salvas',\n ): Promise<boolean> {\n return new Promise((resolve) => {\n let respondido = false\n const responder = (descartar: boolean) => {\n if (respondido) return\n respondido = true\n resolve(descartar)\n }\n confirm.require({\n appendTo: appendTo(),\n message,\n header,\n icon: 'pi pi-exclamation-triangle',\n rejectLabel: 'Continuar editando',\n rejectProps: { severity: 'secondary', text: true },\n acceptLabel: 'Descartar',\n acceptProps: { severity: 'danger' },\n accept: () => responder(true),\n reject: () => responder(false),\n onHide: () => responder(false),\n })\n })\n }\n\n return { confirmDelete, confirmAction, confirmDiscard }\n}\n","function formatFieldName(field: string): string {\n return field.replace(/_/g, ' ').replace(/^\\w/, (c) => c.toUpperCase())\n}\n\nfunction extractMessage(detail: unknown): string | null {\n if (typeof detail === 'string') {\n return detail\n }\n\n if (Array.isArray(detail)) {\n const messages = detail.filter((item) => typeof item === 'string')\n return messages.length > 0 ? messages.join(' ') : null\n }\n\n if (typeof detail === 'object' && detail !== null) {\n const obj = detail as Record<string, unknown>\n\n if (Array.isArray(obj.non_field_errors) && obj.non_field_errors.length > 0) {\n return obj.non_field_errors.filter((item: unknown) => typeof item === 'string').join(' ')\n }\n\n const messages: string[] = []\n for (const [key, value] of Object.entries(obj)) {\n if (key === 'non_field_errors') continue\n const label = formatFieldName(key)\n if (Array.isArray(value)) {\n const strs = value.filter((item: unknown) => typeof item === 'string')\n if (strs.length > 0) messages.push(`${label}: ${strs.join(' ')}`)\n } else if (typeof value === 'string') {\n messages.push(`${label}: ${value}`)\n }\n }\n return messages.length > 0 ? messages.join('\\n') : null\n }\n\n return null\n}\n\nexport function extractApiError(error: unknown, fallback = 'Erro inesperado'): string {\n if (!error || typeof error !== 'object') return fallback\n\n const axiosError = error as {\n response?: { data?: Record<string, unknown> }\n }\n const data = axiosError.response?.data\n\n // Sem corpo JSON (rede fora, página HTML de erro do proxy): a mensagem do transporte é\n // técnica e em inglês (\"Request failed with status code 502\") — quem lê é o usuário.\n if (!data || typeof data !== 'object') return fallback\n\n const detail = data.detail ?? data\n return extractMessage(detail) || fallback\n}\n\n/**\n * Erros por campo de uma resposta 400 (`{ campo: [msgs] }` no DRF; o provedor Connect entrega\n * o `BadRequest.field_violations` no mesmo formato). Só campos com mensagem de texto; `detail` e\n * `non_field_errors` ficam de fora — não pertencem a um campo.\n */\nexport function extractFieldErrors(error: unknown): Record<string, string> {\n const data = (error as { response?: { status?: number; data?: unknown } } | null)?.response\n if (!data || data.status !== 400 || typeof data.data !== 'object' || data.data === null) return {}\n const out: Record<string, string> = {}\n for (const [key, value] of Object.entries(data.data as Record<string, unknown>)) {\n if (key === 'detail' || key === 'non_field_errors') continue\n const messages = (Array.isArray(value) ? value : [value]).filter((m) => typeof m === 'string')\n if (messages.length > 0) out[key] = messages.join(' ')\n }\n return out\n}\n\nexport function useApiError() {\n return { extractApiError, extractFieldErrors }\n}\n","import dayjs from 'dayjs'\nimport customParseFormat from 'dayjs/plugin/customParseFormat.js'\n\ndayjs.extend(customParseFormat)\n\n/**\n * Formato do valor emitido pelo WDatePicker:\n * - `'iso'` → string `YYYY-MM-DD` (ou `YYYY-MM-DDTHH:mm:ss` com hora). Ideal p/ API.\n * - `'date'` → objeto `Date` (compatível com o contrato atual do useCrudManager).\n */\nexport type DateValueFormat = 'iso' | 'date'\n\nconst DISPLAY_DATE = 'DD/MM/YYYY'\nconst DISPLAY_DATETIME = 'DD/MM/YYYY HH:mm'\nconst ISO_DATE = 'YYYY-MM-DD'\nconst ISO_DATETIME = 'YYYY-MM-DDTHH:mm:ss'\n\nexport interface UseDateInputOptions {\n /** Reativo: se o campo inclui hora (datetime). */\n showTime?: () => boolean\n /** Reativo: formato do valor emitido (default `'iso'`). */\n valueFormat?: () => DateValueFormat\n}\n\n/**\n * Lógica pura de parse/format/máscara para inputs de data em pt-BR.\n *\n * Timezone-safe: parse e format usam sempre os componentes LOCAIS via dayjs\n * (nunca `toISOString`, que converte p/ UTC e causa off-by-one em fusos negativos).\n * Sem estado reativo próprio — apenas funções; o componente cuida da reatividade.\n */\nexport function useDateInput(opts: UseDateInputOptions = {}) {\n const withTime = () => opts.showTime?.() ?? false\n const displayFormat = () => (withTime() ? DISPLAY_DATETIME : DISPLAY_DATE)\n const mask = () => (withTime() ? '##/##/#### ##:##' : '##/##/####')\n const placeholder = () => (withTime() ? 'dd/mm/aaaa hh:mm' : 'dd/mm/aaaa')\n\n /** Valor de entrada (string ISO ou Date) → `Date` local, ou `null` se inválido. */\n function toDate(value: unknown): Date | null {\n if (value == null || value === '') return null\n if (value instanceof Date) return isNaN(value.getTime()) ? null : value\n if (typeof value === 'string') {\n // Aceita YYYY-MM-DD estrito primeiro (data pura, meia-noite local)…\n const dateOnly = dayjs(value, ISO_DATE, true)\n if (dateOnly.isValid()) return dateOnly.toDate()\n // …senão qualquer ISO datetime válido (dayjs interpreta como local).\n const any = dayjs(value)\n return any.isValid() ? any.toDate() : null\n }\n return null\n }\n\n /** `Date` → valor emitido, respeitando `valueFormat` (default string ISO). */\n function toValue(date: Date | null): string | Date | null {\n if (!date) return null\n if ((opts.valueFormat?.() ?? 'iso') === 'date') return date\n return dayjs(date).format(withTime() ? ISO_DATETIME : ISO_DATE)\n }\n\n /** `Date` → texto de exibição `DD/MM/YYYY[ HH:mm]`. */\n function toDisplay(date: Date | null): string {\n if (!date) return ''\n return dayjs(date).format(displayFormat())\n }\n\n /** Texto digitado (`30/05/1988`) → `Date`, ou `null` se incompleto/inválido. */\n function fromDisplay(text: string): Date | null {\n if (!text) return null\n const d = dayjs(text, displayFormat(), true)\n return d.isValid() ? d.toDate() : null\n }\n\n /** Hoje: date-only zera a hora; datetime mantém a hora atual. */\n function today(): Date {\n return withTime() ? new Date() : dayjs().startOf('day').toDate()\n }\n\n return { toDate, toValue, toDisplay, fromDisplay, today, mask, placeholder, displayFormat }\n}\n","import { nextTick, type Ref } from 'vue'\n\n/**\n * Navegação por teclado em formulários, estilo aplicação desktop (DevExpress):\n * - `focusFirst()` posiciona o foco no primeiro campo ativo (e seleciona o texto).\n * - `handleKeydown` faz o Enter pular para o próximo campo, até o botão de salvar.\n *\n * Sem watchers nem addEventListener manual: o `handleKeydown` é bindado via\n * `@keydown.capture` no container (o Vue gerencia o listener) e `focusFirst` é\n * chamado no `@show` do Dialog. Shift+Tab / Tab continuam nativos.\n *\n * Por que **capture**: o Select do PrimeVue abre o painel no Enter e o Vue\n * re-renderiza entre o listener dele e o do container — no bubble, o handler\n * já encontra o painel aberto e deixa passar, e o Enter vira \"abrir, escolher,\n * avançar\": três teclas para um campo já preenchido. No capture o handler vê o\n * Select ainda fechado e trata o Enter como Tab antes de o componente agir.\n * Quem binda em bubble (`@keydown`) continua funcionando, só sem esse ganho.\n *\n * Regras do Enter (para não atrapalhar a semântica de cada componente):\n * - `textarea` → Enter é quebra de linha (não pula).\n * - `button` → Enter é o clique/submit nativo (não pula). Exceção: opção de\n * segmented/choice/SelectButton é campo, não ação — Enter pula o grupo\n * inteiro (Espaço e clique escolhem).\n * - Select/MultiSelect FECHADO → Enter é Tab (o painel abre com Espaço ou seta).\n * - painel do PRÓPRIO campo aberto (`aria-expanded`: Select, AutoComplete,\n * DatePicker, MultiSelect…) → Enter seleciona o item; só o Enter seguinte\n * pula o foco. Painel aberto de outro campo (um filtro da página, por\n * exemplo) não interfere.\n * - Enter num `input` nunca é o submit implícito do `<form>`: quem submete é o\n * Enter no último campo (`onSubmit`) ou o botão de salvar.\n * - marque um elemento com `data-kbd-skip` para excluí-lo da sequência (ex.: o\n * botão Cancelar, para o Enter ir direto ao Salvar).\n * - `data-kbd-hold` (no alvo ou num ancestral) segura o Enter no campo: o handler\n * só faz `preventDefault()` e não avança — para o componente tratar o Enter\n * ele mesmo (ex.: FK com texto novo, que abre o cadastro). Marque só enquanto\n * valer; com o atributo fora, o campo volta a pular.\n */\n\n// Elementos que recebem foco por tabulação.\nconst FOCUSABLE = [\n 'input:not([type=\"hidden\"]):not([disabled])',\n 'textarea:not([disabled])',\n 'select:not([disabled])',\n 'button:not([disabled])',\n '[tabindex]:not([tabindex=\"-1\"])',\n '[contenteditable=\"true\"]',\n].join(', ')\n\n// Componentes cujo Enter nativo, com o painel fechado, ABRE o painel. Para eles\n// o Enter é Tab: o handler do componente não chega a rodar (ver capture acima).\nconst OPENS_ON_ENTER = '.p-select, .p-multiselect, .p-cascadeselect, .p-treeselect'\n\n// Grupos de escolha única feitos de botões: o Enter numa opção pula o grupo\n// inteiro, como se fosse um campo só.\nconst OPTION_GROUP = '.w-segmented, .w-choice, .p-selectbutton, [role=\"radiogroup\"]'\n\nexport interface FormKeyboardNavOptions {\n /** Liga/desliga a navegação (default: sempre ligada). */\n enabled?: () => boolean\n /** Chamado quando o Enter passa do último elemento sem próximo foco. */\n onSubmit?: () => void\n}\n\nexport function useFormKeyboardNav(\n container: Ref<HTMLElement | null>,\n options: FormKeyboardNavOptions = {},\n) {\n const isEnabled = () => (options.enabled ? options.enabled() : true)\n\n function focusables(): HTMLElement[] {\n const root = container.value\n if (!root) return []\n return Array.from(root.querySelectorAll<HTMLElement>(FOCUSABLE)).filter(\n (el) => el.getClientRects().length > 0 && !el.hasAttribute('data-kbd-skip'),\n )\n }\n\n function focusFirst(): void {\n if (!isEnabled()) return\n nextTick(() => {\n const els = focusables()\n const first = els.find((el) => el.tagName !== 'BUTTON') ?? els[0]\n if (!first) return\n first.focus()\n // Seleciona o conteúdo de inputs de texto para facilitar sobrescrever.\n const input = first as HTMLInputElement\n if (typeof input.select === 'function') {\n try {\n input.select()\n } catch {\n /* nem todo input suporta select() */\n }\n }\n })\n }\n\n function handleKeydown(e: KeyboardEvent): void {\n if (!isEnabled() || e.key !== 'Enter' || e.isComposing) return\n const target = e.target as HTMLElement\n if (target.tagName === 'TEXTAREA') return\n const group = target.closest<HTMLElement>(OPTION_GROUP)\n if (target.tagName === 'BUTTON' && !group) return\n\n // Nada de submit implícito: o form só submete pelo `onSubmit` ou pelo botão.\n e.preventDefault()\n\n // O campo pediu para segurar o Enter (`data-kbd-hold`) → ele mesmo trata.\n if (target.closest('[data-kbd-hold]')) return\n\n // Painel do próprio campo aberto → o componente trata o Enter (seleciona).\n if (target.closest('[aria-expanded=\"true\"]')) return\n\n // Fechado, o Enter abriria o painel; aqui ele só avança. Só faz diferença\n // quando bindado em capture — em bubble o componente já rodou.\n if (target.closest(OPENS_ON_ENTER)) e.stopPropagation()\n\n const els = focusables()\n const i = els.indexOf(target)\n if (i === -1) return\n const next = els.slice(i + 1).find((el) => !group || !group.contains(el))\n if (next) next.focus()\n else options.onSubmit?.()\n }\n\n return { focusFirst, handleKeydown }\n}\n"],"mappings":";;;;;;;AAoBA,IAAaK,IAAc;CAEzB,SAAS;CAET,SAAS;CAET,SAAS;AACX;AASA,SAASC,EAAc,GAAe,GAAgC;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