@wgalleti/primevue-components 1.16.0 → 1.17.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 +42 -0
- package/dist/components/crud/WCrudFormDialog.vue.d.ts +2 -0
- package/dist/components/form/WFormRenderer.vue.d.ts +2 -0
- package/dist/components-BOnwAcU6.cjs +25 -0
- package/dist/components-BOnwAcU6.cjs.map +1 -0
- package/dist/{components-mSxE0Tfa.js → components-lO0I43CU.js} +1764 -1850
- package/dist/components-lO0I43CU.js.map +1 -0
- package/dist/components.cjs +1 -1
- package/dist/components.js +1 -2
- package/dist/composables/index.d.ts +1 -1
- package/dist/composables/useApiError.d.ts +7 -0
- package/dist/composables-B5lQK7vG.cjs +2 -0
- package/dist/composables-B5lQK7vG.cjs.map +1 -0
- package/dist/{composables-Bu1oxAgP.js → composables-BYOQ7IBQ.js} +244 -250
- package/dist/composables-BYOQ7IBQ.js.map +1 -0
- package/dist/composables.cjs +1 -1
- package/dist/composables.js +3 -3
- package/dist/connect.cjs +2 -0
- package/dist/connect.cjs.map +1 -0
- package/dist/connect.d.ts +2 -0
- package/dist/connect.js +199 -0
- package/dist/connect.js.map +1 -0
- package/dist/data-providers/connect/connectDataProvider.d.ts +29 -0
- package/dist/data-providers/connect/connectErrors.d.ts +15 -0
- package/dist/data-providers/connect/index.d.ts +2 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +44 -48
- package/dist/index.js.map +1 -1
- package/dist/{labels-CXBhCk2N.js → labels-Dgz3NmZ4.js} +2 -3
- package/dist/labels-Dgz3NmZ4.js.map +1 -0
- package/dist/labels-DiFDhFhQ.cjs.map +1 -1
- package/dist/routeTabs-BnVpnSeJ.cjs.map +1 -1
- package/dist/{routeTabs-D6m8PuP6.js → routeTabs-C86S8jNU.js} +2 -3
- package/dist/routeTabs-C86S8jNU.js.map +1 -0
- package/dist/types/dataProvider.d.ts +2 -0
- package/dist/types/manager.d.ts +2 -0
- package/dist/types.cjs +1 -1
- package/dist/types.js +3 -3
- package/dist/useFormKeyboardNav-P-sZq9cy.cjs +3 -0
- package/dist/useFormKeyboardNav-P-sZq9cy.cjs.map +1 -0
- package/dist/{useFormKeyboardNav-DNaAWyrr.js → useFormKeyboardNav-wVvZqL_0.js} +80 -83
- package/dist/useFormKeyboardNav-wVvZqL_0.js.map +1 -0
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.js +1 -2
- package/dist/vite.js.map +1 -1
- package/package.json +26 -5
- package/dist/components-CYEqtT7k.cjs +0 -25
- package/dist/components-CYEqtT7k.cjs.map +0 -1
- package/dist/components-mSxE0Tfa.js.map +0 -1
- package/dist/composables-BZTlY1QU.cjs +0 -2
- package/dist/composables-BZTlY1QU.cjs.map +0 -1
- package/dist/composables-Bu1oxAgP.js.map +0 -1
- package/dist/labels-CXBhCk2N.js.map +0 -1
- package/dist/routeTabs-D6m8PuP6.js.map +0 -1
- package/dist/useFormKeyboardNav-DNaAWyrr.js.map +0 -1
- package/dist/useFormKeyboardNav-DkUCe_b7.cjs +0 -3
- package/dist/useFormKeyboardNav-DkUCe_b7.cjs.map +0 -1
|
@@ -1,87 +1,86 @@
|
|
|
1
|
-
import { a as e,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { computed as
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
function D() {
|
|
11
|
-
w || typeof window > "u" || (window.addEventListener("beforeunload", E), w = !0);
|
|
1
|
+
import { a as e, i as t, n } from "./routeTabs-C86S8jNU.js";
|
|
2
|
+
import { t as r } from "./labels-Dgz3NmZ4.js";
|
|
3
|
+
import { c as i, d as a, f as o, g as s, h as c, i as l, l as u, m as d, o as f, r as p, s as m } from "./useFormKeyboardNav-wVvZqL_0.js";
|
|
4
|
+
import { computed as h, getCurrentScope as g, inject as _, onScopeDispose as v, reactive as y, ref as b, shallowReactive as x, toValue as S, watch as C } from "vue";
|
|
5
|
+
// src/composables/usePendingForms.ts
|
|
6
|
+
var w = /* @__PURE__ */ new Set(), T = !1, E = 0;
|
|
7
|
+
function D(e) {
|
|
8
|
+
w.size !== 0 && (e.preventDefault(), e.returnValue = "");
|
|
12
9
|
}
|
|
13
10
|
function O() {
|
|
14
|
-
|
|
11
|
+
T || typeof window > "u" || (window.addEventListener("beforeunload", D), T = !0);
|
|
15
12
|
}
|
|
16
|
-
function k(
|
|
17
|
-
|
|
13
|
+
function k() {
|
|
14
|
+
return [...w];
|
|
18
15
|
}
|
|
19
16
|
function A(e, t) {
|
|
20
|
-
|
|
21
|
-
S(() => !!x(e), (e) => k(n, e), { immediate: !0 }), h() && _(() => k(n, !1));
|
|
17
|
+
t ? (w.add(e), O()) : w.delete(e);
|
|
22
18
|
}
|
|
23
|
-
//#endregion
|
|
24
|
-
//#region src/composables/useCrudManager.ts
|
|
25
19
|
function j(e, t) {
|
|
20
|
+
let n = t ?? `w-form-${++E}`;
|
|
21
|
+
C(() => !!S(e), (e) => A(n, e), { immediate: !0 }), g() && v(() => A(n, !1));
|
|
22
|
+
}
|
|
23
|
+
// src/composables/useCrudManager.ts
|
|
24
|
+
function M(e, t) {
|
|
26
25
|
let n = {};
|
|
27
26
|
for (let r of Object.keys(t)) JSON.stringify(e[r]) !== JSON.stringify(t[r]) && (n[r] = t[r]);
|
|
28
27
|
return n;
|
|
29
28
|
}
|
|
30
|
-
function
|
|
31
|
-
let { endpoint:
|
|
32
|
-
if (!
|
|
33
|
-
let
|
|
34
|
-
...
|
|
35
|
-
...
|
|
36
|
-
}, B =
|
|
37
|
-
...
|
|
38
|
-
keyboardNav:
|
|
39
|
-
}, V =
|
|
29
|
+
function N(g) {
|
|
30
|
+
let { endpoint: v, form: x, pk: S = "id", searchDebounce: w = 300, partialUpdate: T = !0, refetchOnSave: E = !0, fetchDetailOnEdit: D = !1, filterParams: O = void 0, createDefaults: k = void 0, transformItems: A = void 0, transformPayload: N = void 0, onAfterSave: P = void 0, onAfterDelete: F = void 0 } = g, I = _(e);
|
|
31
|
+
if (!I) throw Error("[wPrimeVueComponents] dataProvider não encontrado. Registre o WPrimeVuePlugin antes de usar useCrudManager.");
|
|
32
|
+
let L = I, R = _(t), ee = g.pageSize ?? R?.defaultPageSize ?? 20, z = {
|
|
33
|
+
...r,
|
|
34
|
+
...g.labels
|
|
35
|
+
}, B = m(), { confirmDelete: te, confirmDiscard: ne } = f(), re = {
|
|
36
|
+
...g,
|
|
37
|
+
keyboardNav: g.keyboardNav ?? R?.keyboardNav ?? !1
|
|
38
|
+
}, V = b([]), H = b([]), ie = b({}), ae = b(!1), oe = 0, se = b(!1), U = b(""), W = b(!1), G = b(!1), K = b(null), q = y({}), ce = y({}), J = null, Y = y({
|
|
40
39
|
page: 1,
|
|
41
|
-
pageSize:
|
|
40
|
+
pageSize: ee,
|
|
42
41
|
rows: 0,
|
|
43
42
|
totalPages: 0
|
|
44
|
-
}), X =
|
|
43
|
+
}), X = y({
|
|
45
44
|
field: null,
|
|
46
45
|
order: 0
|
|
47
|
-
}), Z =
|
|
48
|
-
function
|
|
49
|
-
return
|
|
46
|
+
}), Z = y({});
|
|
47
|
+
function le() {
|
|
48
|
+
return u(x);
|
|
50
49
|
}
|
|
51
|
-
let
|
|
52
|
-
for (let e of Object.keys(
|
|
53
|
-
let Q =
|
|
50
|
+
let ue = le();
|
|
51
|
+
for (let e of Object.keys(ue)) q[e] = ue[e];
|
|
52
|
+
let Q = h(() => K.value !== null && !G.value), de = h(() => G.value), fe = h(() => G.value ? z.viewTitle ?? "Visualizar Registro" : Q.value ? z.editTitle : z.createTitle), pe = h(() => Y.page <= 1), me = h(() => Y.page >= Y.totalPages), he = null;
|
|
54
53
|
async function $(e = {}) {
|
|
55
|
-
let t = ++
|
|
56
|
-
|
|
54
|
+
let t = ++oe;
|
|
55
|
+
ae.value = !0;
|
|
57
56
|
try {
|
|
58
57
|
let n = {
|
|
59
58
|
page: Y.page,
|
|
60
59
|
page_size: Y.pageSize,
|
|
61
60
|
...e
|
|
62
61
|
};
|
|
63
|
-
U.value && (n.search = U.value), X.field && X.order !== 0 && (n.ordering = X.order === -1 ? `-${X.field}` : X.field),
|
|
62
|
+
U.value && (n.search = U.value), X.field && X.order !== 0 && (n.ordering = X.order === -1 ? `-${X.field}` : X.field), O && Object.assign(n, O());
|
|
64
63
|
for (let [e, t] of Object.entries(Z)) t != null && t !== "" && (n[e] = t);
|
|
65
|
-
let r = await
|
|
66
|
-
if (t !==
|
|
67
|
-
V.value =
|
|
64
|
+
let r = await L.list(v, n);
|
|
65
|
+
if (t !== oe) return;
|
|
66
|
+
V.value = A ? A(r.data) : r.data, H.value = [], Y.rows = r.rows, ie.value = r.extras ?? {}, r.page && (Y.page = r.page), r.page_size && (Y.pageSize = r.page_size), Y.totalPages = Math.ceil(Y.rows / Y.pageSize) || 0;
|
|
68
67
|
} finally {
|
|
69
|
-
t ===
|
|
68
|
+
t === oe && (ae.value = !1);
|
|
70
69
|
}
|
|
71
70
|
}
|
|
72
|
-
async function
|
|
71
|
+
async function ge() {
|
|
73
72
|
await $();
|
|
74
73
|
}
|
|
75
|
-
async function
|
|
74
|
+
async function _e() {
|
|
76
75
|
await $();
|
|
77
76
|
}
|
|
78
|
-
async function
|
|
77
|
+
async function ve(e = 200) {
|
|
79
78
|
let t = {};
|
|
80
|
-
U.value && (t.search = U.value), X.field && X.order !== 0 && (t.ordering = X.order === -1 ? `-${X.field}` : X.field),
|
|
79
|
+
U.value && (t.search = U.value), X.field && X.order !== 0 && (t.ordering = X.order === -1 ? `-${X.field}` : X.field), O && Object.assign(t, O());
|
|
81
80
|
for (let [e, n] of Object.entries(Z)) n != null && n !== "" && (t[e] = n);
|
|
82
81
|
let n = [], r = 1;
|
|
83
82
|
for (; r <= 1e4;) {
|
|
84
|
-
let i = await
|
|
83
|
+
let i = await L.list(v, {
|
|
85
84
|
...t,
|
|
86
85
|
page: r,
|
|
87
86
|
page_size: e
|
|
@@ -93,116 +92,120 @@ function M(h) {
|
|
|
93
92
|
}
|
|
94
93
|
return n;
|
|
95
94
|
}
|
|
96
|
-
function
|
|
97
|
-
U.value = e,
|
|
95
|
+
function ye(e) {
|
|
96
|
+
U.value = e, he && clearTimeout(he), he = setTimeout(() => {
|
|
98
97
|
Y.page = 1, $();
|
|
99
|
-
},
|
|
98
|
+
}, w);
|
|
100
99
|
}
|
|
101
|
-
function
|
|
100
|
+
function be(e) {
|
|
102
101
|
let t = e.target;
|
|
103
|
-
|
|
102
|
+
ye(t.value);
|
|
104
103
|
}
|
|
105
|
-
function
|
|
104
|
+
function xe(e) {
|
|
106
105
|
Y.page = e, $();
|
|
107
106
|
}
|
|
108
|
-
function
|
|
109
|
-
|
|
107
|
+
function Se() {
|
|
108
|
+
xe(1);
|
|
110
109
|
}
|
|
111
|
-
function
|
|
112
|
-
|
|
110
|
+
function Ce() {
|
|
111
|
+
xe(Y.totalPages);
|
|
113
112
|
}
|
|
114
|
-
function
|
|
113
|
+
function we(e) {
|
|
115
114
|
Y.page = e.page + 1, Y.pageSize = e.rows, $();
|
|
116
115
|
}
|
|
117
|
-
function
|
|
116
|
+
function Te(e) {
|
|
118
117
|
X.field = e.sortField ?? null, X.order = e.sortOrder ?? 0, Y.page = 1, $();
|
|
119
118
|
}
|
|
120
|
-
function
|
|
121
|
-
let e
|
|
119
|
+
function Ee() {
|
|
120
|
+
for (let e of Object.keys(ce)) delete ce[e];
|
|
121
|
+
}
|
|
122
|
+
function De() {
|
|
123
|
+
Ee();
|
|
124
|
+
let e = le();
|
|
122
125
|
for (let t of Object.keys(e)) q[t] = e[t];
|
|
123
126
|
}
|
|
124
|
-
function
|
|
127
|
+
function Oe(e, t) {
|
|
125
128
|
q[e] = t;
|
|
126
129
|
}
|
|
127
|
-
function
|
|
128
|
-
if (G.value = !1, K.value = null, J = null,
|
|
129
|
-
let e =
|
|
130
|
+
function ke() {
|
|
131
|
+
if (G.value = !1, K.value = null, J = null, De(), k) {
|
|
132
|
+
let e = k();
|
|
130
133
|
for (let [t, n] of Object.entries(e)) q[t] = n;
|
|
131
134
|
}
|
|
132
135
|
W.value = !0;
|
|
133
136
|
}
|
|
134
|
-
function
|
|
135
|
-
J =
|
|
137
|
+
function Ae(e) {
|
|
138
|
+
Ee(), J = a(e, x, q);
|
|
136
139
|
}
|
|
137
|
-
async function
|
|
140
|
+
async function je(e) {
|
|
138
141
|
try {
|
|
139
|
-
return (await
|
|
142
|
+
return (await L.get(v, e[S])).data;
|
|
140
143
|
} catch (e) {
|
|
141
|
-
return B.error(
|
|
144
|
+
return B.error(p(e, "Erro ao carregar registro")), null;
|
|
142
145
|
}
|
|
143
146
|
}
|
|
144
|
-
function
|
|
145
|
-
return
|
|
147
|
+
function Me(e, t) {
|
|
148
|
+
return D ? je(e).then((e) => {
|
|
146
149
|
e && t(e);
|
|
147
150
|
}) : t(e);
|
|
148
151
|
}
|
|
149
|
-
function
|
|
150
|
-
return
|
|
151
|
-
G.value = !1, K.value = e,
|
|
152
|
+
function Ne(e) {
|
|
153
|
+
return Me(e, (e) => {
|
|
154
|
+
G.value = !1, K.value = e, Ae(e), W.value = !0;
|
|
152
155
|
});
|
|
153
156
|
}
|
|
154
|
-
function
|
|
155
|
-
return
|
|
156
|
-
G.value = !0, K.value = e,
|
|
157
|
+
function Pe(e) {
|
|
158
|
+
return Me(e, (e) => {
|
|
159
|
+
G.value = !0, K.value = e, Ae(e), W.value = !0;
|
|
157
160
|
});
|
|
158
161
|
}
|
|
159
|
-
function
|
|
160
|
-
return
|
|
162
|
+
function Fe(e) {
|
|
163
|
+
return Me(e, (e) => Ie(e));
|
|
161
164
|
}
|
|
162
|
-
function
|
|
163
|
-
G.value = !1, K.value = null, J = null,
|
|
164
|
-
for (let t of
|
|
165
|
-
if (t.field ===
|
|
165
|
+
function Ie(e) {
|
|
166
|
+
G.value = !1, K.value = null, J = null, De();
|
|
167
|
+
for (let t of x) {
|
|
168
|
+
if (t.field === S) continue;
|
|
166
169
|
let n = e[t.field] === void 0 ? q[t.field] : e[t.field];
|
|
167
|
-
n && (t.type === "date" || t.type === "datetime") && typeof n == "string" && (n =
|
|
170
|
+
n && (t.type === "date" || t.type === "datetime") && typeof n == "string" && (n = d(n)), q[t.field] = n;
|
|
168
171
|
}
|
|
169
|
-
if (
|
|
170
|
-
let e =
|
|
172
|
+
if (k) {
|
|
173
|
+
let e = k();
|
|
171
174
|
for (let [t, n] of Object.entries(e)) q[t] = n;
|
|
172
175
|
}
|
|
173
176
|
W.value = !0;
|
|
174
177
|
}
|
|
175
|
-
let
|
|
176
|
-
|
|
177
|
-
e && (
|
|
178
|
+
let Le = "";
|
|
179
|
+
C(W, (e) => {
|
|
180
|
+
e && (Le = JSON.stringify(q));
|
|
178
181
|
}, { flush: "sync" });
|
|
179
|
-
let
|
|
180
|
-
|
|
181
|
-
function
|
|
182
|
-
return
|
|
182
|
+
let Re = h(() => W.value && !G.value && JSON.stringify(q) !== Le);
|
|
183
|
+
j(Re), n()?.registerCloseGuard(() => !Re.value || ne());
|
|
184
|
+
function ze(e) {
|
|
185
|
+
return i(e, x);
|
|
183
186
|
}
|
|
184
|
-
async function
|
|
185
|
-
let e =
|
|
187
|
+
async function Be() {
|
|
188
|
+
let e = o(x, q, Q.value);
|
|
186
189
|
if (e) return B.error(e), null;
|
|
187
|
-
|
|
190
|
+
Ee(), se.value = !0;
|
|
188
191
|
try {
|
|
189
|
-
let e =
|
|
190
|
-
if (!Q.value &&
|
|
191
|
-
let t =
|
|
192
|
+
let e = ze(q);
|
|
193
|
+
if (!Q.value && k) {
|
|
194
|
+
let t = k();
|
|
192
195
|
for (let [n, r] of Object.entries(t)) {
|
|
193
196
|
let t = e[n];
|
|
194
197
|
(t == null || t === "") && (e[n] = r);
|
|
195
198
|
}
|
|
196
199
|
}
|
|
197
|
-
if (Q.value &&
|
|
200
|
+
if (Q.value && T && J && (e = M(ze(J), e), Object.keys(e).length === 0 && !N)) {
|
|
198
201
|
W.value = !1;
|
|
199
202
|
let e = K.value;
|
|
200
203
|
return K.value = null, J = null, e;
|
|
201
204
|
}
|
|
202
|
-
|
|
203
|
-
let t =
|
|
205
|
+
N && (e = N(e, Q.value));
|
|
206
|
+
let t = x.some((t) => t.type === "image" && e[t.field] instanceof File), n = e, r;
|
|
204
207
|
if (t) {
|
|
205
|
-
let t = new Set(
|
|
208
|
+
let t = new Set(x.filter((e) => e.type === "image").map((e) => e.field)), i = new FormData();
|
|
206
209
|
for (let [n, r] of Object.entries(e)) if (r != null) {
|
|
207
210
|
if (r instanceof File) i.append(n, r);
|
|
208
211
|
else if (t.has(n)) continue;
|
|
@@ -212,53 +215,55 @@ function M(h) {
|
|
|
212
215
|
}
|
|
213
216
|
let i = r ? { headers: r } : void 0, a;
|
|
214
217
|
if (Q.value && K.value) {
|
|
215
|
-
let e = K.value[
|
|
216
|
-
if (a = await
|
|
217
|
-
let t = V.value.findIndex((t) => t[
|
|
218
|
+
let e = K.value[S];
|
|
219
|
+
if (a = await L.update(v, e, n, i), !E) {
|
|
220
|
+
let t = V.value.findIndex((t) => t[S] === e);
|
|
218
221
|
t !== -1 && (V.value[t] = a.data);
|
|
219
222
|
}
|
|
220
223
|
B.success(z.successUpdate);
|
|
221
|
-
} else a = await
|
|
222
|
-
return W.value = !1, K.value = null, J = null,
|
|
224
|
+
} else a = await L.create(v, n, i), E || (V.value.unshift(a.data), Y.rows++), B.success(z.successCreate);
|
|
225
|
+
return W.value = !1, K.value = null, J = null, E && await $(), P && P(a.data, Q.value), a.data;
|
|
223
226
|
} catch (e) {
|
|
224
|
-
|
|
227
|
+
let t = new Set(x.map((e) => e.field));
|
|
228
|
+
for (let [n, r] of Object.entries(l(e))) t.has(n) && (ce[n] = r);
|
|
229
|
+
return B.error(p(e, "Erro ao salvar registro")), null;
|
|
225
230
|
} finally {
|
|
226
|
-
|
|
231
|
+
se.value = !1;
|
|
227
232
|
}
|
|
228
233
|
}
|
|
229
|
-
async function
|
|
230
|
-
let
|
|
231
|
-
|
|
234
|
+
async function Ve(e, t, n) {
|
|
235
|
+
let r = e[S], i = x.find((e) => e.field === t), a = n;
|
|
236
|
+
i?.type === "date" && a instanceof Date ? a = c(a) : i?.type === "datetime" && a instanceof Date && (a = s(a));
|
|
232
237
|
try {
|
|
233
|
-
let e = await
|
|
238
|
+
let e = await L.update(v, r, { [t]: a }), n = V.value.findIndex((e) => e[S] === r);
|
|
234
239
|
n !== -1 && (V.value[n] = {
|
|
235
240
|
...V.value[n],
|
|
236
241
|
...e.data
|
|
237
242
|
}), B.success(z.successUpdate);
|
|
238
243
|
} catch (e) {
|
|
239
|
-
B.error(
|
|
244
|
+
B.error(p(e, "Erro ao salvar o campo"));
|
|
240
245
|
}
|
|
241
246
|
}
|
|
242
|
-
async function
|
|
247
|
+
async function He(e) {
|
|
243
248
|
try {
|
|
244
|
-
let t = e[
|
|
245
|
-
await
|
|
246
|
-
let n = V.value.findIndex((e) => e[
|
|
247
|
-
n !== -1 && (V.value.splice(n, 1), Y.rows--), B.success(z.successDelete),
|
|
249
|
+
let t = e[S];
|
|
250
|
+
await L.delete(v, t);
|
|
251
|
+
let n = V.value.findIndex((e) => e[S] === t);
|
|
252
|
+
n !== -1 && (V.value.splice(n, 1), Y.rows--), B.success(z.successDelete), F && F(e);
|
|
248
253
|
} catch (e) {
|
|
249
|
-
B.error(
|
|
254
|
+
B.error(p(e, "Erro ao excluir registro"));
|
|
250
255
|
}
|
|
251
256
|
}
|
|
252
|
-
function
|
|
253
|
-
|
|
257
|
+
function Ue(e) {
|
|
258
|
+
te(() => He(e), z.deleteConfirmMessage);
|
|
254
259
|
}
|
|
255
|
-
function
|
|
260
|
+
function We() {
|
|
256
261
|
H.value = [];
|
|
257
262
|
}
|
|
258
|
-
function
|
|
263
|
+
function Ge(e, t) {
|
|
259
264
|
t == null || t === "" ? delete Z[e] : Z[e] = t, Y.page = 1, $();
|
|
260
265
|
}
|
|
261
|
-
function
|
|
266
|
+
function Ke() {
|
|
262
267
|
for (let e of Object.keys(Z)) delete Z[e];
|
|
263
268
|
Y.page = 1, $();
|
|
264
269
|
}
|
|
@@ -266,107 +271,107 @@ function M(h) {
|
|
|
266
271
|
items: V,
|
|
267
272
|
selectedItems: H,
|
|
268
273
|
columnFilters: Z,
|
|
269
|
-
extras:
|
|
270
|
-
loading:
|
|
271
|
-
saving:
|
|
274
|
+
extras: ie,
|
|
275
|
+
loading: ae,
|
|
276
|
+
saving: se,
|
|
272
277
|
search: U,
|
|
273
278
|
dialogVisible: W,
|
|
274
|
-
isDirty:
|
|
279
|
+
isDirty: Re,
|
|
275
280
|
editingItem: K,
|
|
276
281
|
formData: q,
|
|
282
|
+
fieldErrors: ce,
|
|
277
283
|
pagination: Y,
|
|
278
284
|
sort: X,
|
|
279
285
|
isEditing: Q,
|
|
280
|
-
isViewing:
|
|
286
|
+
isViewing: de,
|
|
281
287
|
viewMode: G,
|
|
282
|
-
dialogTitle:
|
|
283
|
-
isFirstPage:
|
|
284
|
-
isLastPage:
|
|
285
|
-
init:
|
|
288
|
+
dialogTitle: fe,
|
|
289
|
+
isFirstPage: pe,
|
|
290
|
+
isLastPage: me,
|
|
291
|
+
init: ge,
|
|
286
292
|
fetchItems: $,
|
|
287
|
-
fetchAll:
|
|
288
|
-
refresh:
|
|
289
|
-
setSearch:
|
|
290
|
-
onSearch:
|
|
291
|
-
onPage:
|
|
292
|
-
onSort:
|
|
293
|
-
openCreateDialog:
|
|
294
|
-
openEditDialog:
|
|
295
|
-
openViewDialog:
|
|
296
|
-
openDuplicateDialog:
|
|
297
|
-
save:
|
|
298
|
-
updateField:
|
|
299
|
-
confirmDelete:
|
|
300
|
-
performDelete:
|
|
301
|
-
setFormField:
|
|
302
|
-
resetForm:
|
|
303
|
-
goToPage:
|
|
304
|
-
firstPage:
|
|
305
|
-
lastPage:
|
|
306
|
-
clearSelection:
|
|
307
|
-
setColumnFilter:
|
|
308
|
-
clearColumnFilters:
|
|
309
|
-
config:
|
|
293
|
+
fetchAll: ve,
|
|
294
|
+
refresh: _e,
|
|
295
|
+
setSearch: ye,
|
|
296
|
+
onSearch: be,
|
|
297
|
+
onPage: we,
|
|
298
|
+
onSort: Te,
|
|
299
|
+
openCreateDialog: ke,
|
|
300
|
+
openEditDialog: Ne,
|
|
301
|
+
openViewDialog: Pe,
|
|
302
|
+
openDuplicateDialog: Fe,
|
|
303
|
+
save: Be,
|
|
304
|
+
updateField: Ve,
|
|
305
|
+
confirmDelete: Ue,
|
|
306
|
+
performDelete: He,
|
|
307
|
+
setFormField: Oe,
|
|
308
|
+
resetForm: De,
|
|
309
|
+
goToPage: xe,
|
|
310
|
+
firstPage: Se,
|
|
311
|
+
lastPage: Ce,
|
|
312
|
+
clearSelection: We,
|
|
313
|
+
setColumnFilter: Ge,
|
|
314
|
+
clearColumnFilters: Ke,
|
|
315
|
+
config: re
|
|
310
316
|
};
|
|
311
317
|
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
...
|
|
317
|
-
|
|
318
|
-
}, C = a(), { confirmDelete: w } = e(), T = m(() => i() ?? []), E = y(!1), D = y(!1), O = y(null), k = y(-1), A = v({}), j = t(s);
|
|
318
|
+
// src/composables/useSubviewCrud.ts
|
|
319
|
+
function P(e) {
|
|
320
|
+
let { rows: t, onChange: n, form: s, createDefaults: c = void 0, transformPayload: l = void 0, uniqueBy: d = void 0, uniqueMessage: p = "Este item já está na lista.", toForm: g = void 0, onAfterSave: _ = void 0, onAfterDelete: v = void 0, toast: x = !1 } = e, S = {
|
|
321
|
+
...r,
|
|
322
|
+
...e.labels
|
|
323
|
+
}, C = m(), { confirmDelete: w } = f(), T = h(() => t() ?? []), E = b(!1), D = b(!1), O = b(null), k = b(-1), A = y({}), j = u(s);
|
|
319
324
|
for (let e of Object.keys(j)) A[e] = j[e];
|
|
320
|
-
let M =
|
|
325
|
+
let M = h(() => k.value >= 0), N = h(() => M.value ? S.editTitle : S.createTitle);
|
|
321
326
|
function P() {
|
|
322
|
-
let e =
|
|
327
|
+
let e = u(s);
|
|
323
328
|
for (let t of Object.keys(e)) A[t] = e[t];
|
|
324
329
|
}
|
|
325
330
|
function F(e, t) {
|
|
326
331
|
A[e] = t;
|
|
327
332
|
}
|
|
328
333
|
function I() {
|
|
329
|
-
if (
|
|
334
|
+
if (c) for (let [e, t] of Object.entries(c())) A[e] = t;
|
|
330
335
|
}
|
|
331
336
|
function L() {
|
|
332
337
|
O.value = null, k.value = -1, P(), I(), D.value = !0;
|
|
333
338
|
}
|
|
334
339
|
function R(e) {
|
|
335
|
-
if (
|
|
340
|
+
if (a(e, s, A), g) for (let [t, n] of Object.entries(g(e))) A[t] = n;
|
|
336
341
|
}
|
|
337
|
-
function
|
|
342
|
+
function ee(e, t) {
|
|
338
343
|
O.value = e, k.value = t, R(e), D.value = !0;
|
|
339
344
|
}
|
|
340
|
-
function
|
|
345
|
+
function z(e) {
|
|
341
346
|
O.value = null, k.value = -1, P(), R(e), I(), D.value = !0;
|
|
342
347
|
}
|
|
343
|
-
function
|
|
344
|
-
if (!
|
|
345
|
-
let t = typeof
|
|
348
|
+
function B(e) {
|
|
349
|
+
if (!d) return;
|
|
350
|
+
let t = typeof d == "function" ? d(e) : e[d];
|
|
346
351
|
if (t != null && t !== "") return String(t);
|
|
347
352
|
}
|
|
348
353
|
function te() {
|
|
349
|
-
let e =
|
|
354
|
+
let e = o(s, A, M.value);
|
|
350
355
|
if (e) return C.error(e), null;
|
|
351
|
-
let t =
|
|
352
|
-
if (!M.value &&
|
|
356
|
+
let t = i(A, s);
|
|
357
|
+
if (!M.value && c) for (let [e, n] of Object.entries(c())) {
|
|
353
358
|
let r = t[e];
|
|
354
359
|
(r == null || r === "") && (t[e] = n);
|
|
355
360
|
}
|
|
356
|
-
|
|
357
|
-
let r = T.value,
|
|
358
|
-
...r[
|
|
361
|
+
l && (t = l(t, M.value));
|
|
362
|
+
let r = T.value, a = k.value, u = a >= 0, d = u ? {
|
|
363
|
+
...r[a],
|
|
359
364
|
...t
|
|
360
|
-
} : { ...t }, f =
|
|
361
|
-
if (f !== void 0 && r.some((e, t) => t !==
|
|
362
|
-
let
|
|
363
|
-
return
|
|
365
|
+
} : { ...t }, f = B(d);
|
|
366
|
+
if (f !== void 0 && r.some((e, t) => t !== a && B(e) === f)) return C.error(p), null;
|
|
367
|
+
let m = u ? r.map((e, t) => t === a ? d : e) : [...r, d];
|
|
368
|
+
return n(m), x && C.success(u ? S.successUpdate : S.successCreate), _?.(d, u), D.value = !1, O.value = null, k.value = -1, d;
|
|
364
369
|
}
|
|
365
370
|
function ne(e) {
|
|
366
|
-
let t = T.value,
|
|
367
|
-
|
|
371
|
+
let t = T.value, r = t[e];
|
|
372
|
+
r !== void 0 && (n(t.filter((t, n) => n !== e)), x && C.success(S.successDelete), v?.(r, e));
|
|
368
373
|
}
|
|
369
|
-
function
|
|
374
|
+
function re(e, t) {
|
|
370
375
|
w(() => ne(t), S.deleteConfirmMessage);
|
|
371
376
|
}
|
|
372
377
|
return {
|
|
@@ -379,59 +384,57 @@ function N(r) {
|
|
|
379
384
|
isEditing: M,
|
|
380
385
|
dialogTitle: N,
|
|
381
386
|
openCreateDialog: L,
|
|
382
|
-
openEditDialog:
|
|
383
|
-
openDuplicateDialog:
|
|
387
|
+
openEditDialog: ee,
|
|
388
|
+
openDuplicateDialog: z,
|
|
384
389
|
save: te,
|
|
385
|
-
confirmDelete:
|
|
390
|
+
confirmDelete: re,
|
|
386
391
|
performDelete: ne,
|
|
387
392
|
setFormField: F,
|
|
388
393
|
resetForm: P,
|
|
389
394
|
labels: S,
|
|
390
|
-
config:
|
|
395
|
+
config: e
|
|
391
396
|
};
|
|
392
397
|
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
function P(e) {
|
|
398
|
+
// src/composables/defineCrudConfig.ts
|
|
399
|
+
function F(e) {
|
|
396
400
|
return e;
|
|
397
401
|
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
let a = i, o = g(d), s = e.pageSize ?? o?.defaultPageSize ?? 20, c = y([]), l = y(!1), f = y(""), p = y({}), m = v({}), h = v({
|
|
402
|
+
// src/composables/useApi.ts
|
|
403
|
+
function I(n) {
|
|
404
|
+
let { endpoint: r, searchDebounce: i = 300, immediate: a = !1 } = n, o = _(e);
|
|
405
|
+
if (!o) throw Error("[wPrimeVueComponents] dataProvider não encontrado. Registre o WPrimeVuePlugin antes de usar useApi.");
|
|
406
|
+
let s = o, c = _(t), l = n.pageSize ?? c?.defaultPageSize ?? 20, u = b([]), d = b(!1), f = b(""), p = b({}), m = y({}), h = y({
|
|
404
407
|
page: 1,
|
|
405
|
-
pageSize:
|
|
408
|
+
pageSize: l,
|
|
406
409
|
rows: 0,
|
|
407
410
|
totalPages: 0
|
|
408
|
-
}),
|
|
411
|
+
}), g = y({
|
|
409
412
|
field: null,
|
|
410
413
|
order: 0
|
|
411
|
-
}),
|
|
414
|
+
}), v = null;
|
|
412
415
|
async function x(e = {}) {
|
|
413
|
-
|
|
416
|
+
d.value = !0;
|
|
414
417
|
try {
|
|
415
|
-
let
|
|
418
|
+
let t = {
|
|
416
419
|
page: h.page,
|
|
417
420
|
page_size: h.pageSize,
|
|
418
421
|
...e
|
|
419
422
|
};
|
|
420
|
-
f.value && (
|
|
421
|
-
for (let [e,
|
|
422
|
-
let
|
|
423
|
-
|
|
423
|
+
f.value && (t.search = f.value), g.field && g.order !== 0 && (t.ordering = g.order === -1 ? `-${g.field}` : g.field);
|
|
424
|
+
for (let [e, n] of Object.entries(m)) n != null && n !== "" && (t[e] = n);
|
|
425
|
+
let n = await s.list(r, t);
|
|
426
|
+
u.value = n.data, h.rows = n.rows, n.page && (h.page = n.page), n.page_size && (h.pageSize = n.page_size), h.totalPages = Math.ceil(h.rows / h.pageSize) || 0, p.value = n.extras ?? {};
|
|
424
427
|
} finally {
|
|
425
|
-
|
|
428
|
+
d.value = !1;
|
|
426
429
|
}
|
|
427
430
|
}
|
|
428
431
|
async function S() {
|
|
429
432
|
await x();
|
|
430
433
|
}
|
|
431
434
|
function C(e) {
|
|
432
|
-
f.value = e,
|
|
435
|
+
f.value = e, v && clearTimeout(v), v = setTimeout(() => {
|
|
433
436
|
h.page = 1, x();
|
|
434
|
-
},
|
|
437
|
+
}, i);
|
|
435
438
|
}
|
|
436
439
|
function w(e, t) {
|
|
437
440
|
m[e] = t, h.page = 1, x();
|
|
@@ -444,14 +447,14 @@ function F(e) {
|
|
|
444
447
|
h.page = e.page + 1, h.pageSize = e.rows, x();
|
|
445
448
|
}
|
|
446
449
|
function D(e) {
|
|
447
|
-
|
|
450
|
+
g.field = e.sortField ?? null, g.order = e.sortOrder ?? 0, h.page = 1, x();
|
|
448
451
|
}
|
|
449
|
-
return
|
|
450
|
-
items:
|
|
451
|
-
loading:
|
|
452
|
+
return a && x(), {
|
|
453
|
+
items: u,
|
|
454
|
+
loading: d,
|
|
452
455
|
search: f,
|
|
453
456
|
pagination: h,
|
|
454
|
-
sort:
|
|
457
|
+
sort: g,
|
|
455
458
|
extras: p,
|
|
456
459
|
fetchItems: x,
|
|
457
460
|
refresh: S,
|
|
@@ -462,9 +465,8 @@ function F(e) {
|
|
|
462
465
|
onSort: D
|
|
463
466
|
};
|
|
464
467
|
}
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
function I(e) {
|
|
468
|
+
// src/composables/useRouteTabs.ts
|
|
469
|
+
function L(e) {
|
|
468
470
|
return {
|
|
469
471
|
fullPath: e.fullPath,
|
|
470
472
|
path: e.path,
|
|
@@ -477,18 +479,18 @@ function I(e) {
|
|
|
477
479
|
redirectedFrom: e.redirectedFrom
|
|
478
480
|
};
|
|
479
481
|
}
|
|
480
|
-
function
|
|
482
|
+
function R(e) {
|
|
481
483
|
let t = e.matched[e.matched.length - 1]?.props?.default;
|
|
482
484
|
return t === !0 ? { ...e.params } : typeof t == "function" ? t(e) ?? {} : t && typeof t == "object" ? { ...t } : {};
|
|
483
485
|
}
|
|
484
|
-
function
|
|
486
|
+
function ee(e) {
|
|
485
487
|
let t = e.matched[e.matched.length - 1]?.components?.default;
|
|
486
488
|
return t && typeof t != "function" ? t : null;
|
|
487
489
|
}
|
|
488
490
|
function z(e) {
|
|
489
491
|
let { router: t, mode: n = "screen", moduleRoot: r, shouldRemount: i, resolveTabMeta: a = () => ({}), isTabRoute: o = () => !0, storage: s = typeof localStorage > "u" ? null : localStorage, storageKey: c = "w-route-tabs", homePath: l = "/", maxTabs: u } = e;
|
|
490
492
|
if (n === "module" && !r) throw Error("[useRouteTabs] mode \"module\" exige a opção moduleRoot(route).");
|
|
491
|
-
let d = (e) => n === "module" && r?.(e) || e.path, f =
|
|
493
|
+
let d = (e) => n === "module" && r?.(e) || e.path, f = b([]), p = b(null), m = /* @__PURE__ */ new Map(), h = !1, g = null;
|
|
492
494
|
function _() {
|
|
493
495
|
return typeof c == "function" ? c() : c;
|
|
494
496
|
}
|
|
@@ -511,7 +513,7 @@ function z(e) {
|
|
|
511
513
|
s.setItem(_(), JSON.stringify(e));
|
|
512
514
|
} catch {}
|
|
513
515
|
}
|
|
514
|
-
function
|
|
516
|
+
function y() {
|
|
515
517
|
if (h = !0, g = _(), f.value = [], p.value = null, m.clear(), s) try {
|
|
516
518
|
let e = s.getItem(_());
|
|
517
519
|
if (!e) return;
|
|
@@ -555,16 +557,16 @@ function z(e) {
|
|
|
555
557
|
let n = a(t);
|
|
556
558
|
e.title = n.title ?? T(t), n.icon && (e.icon = n.icon);
|
|
557
559
|
}
|
|
558
|
-
if (r) r.component =
|
|
560
|
+
if (r) r.component = ee(t), r.props = R(t), Object.assign(r.route, L(t));
|
|
559
561
|
else {
|
|
560
562
|
if (e.fullPath.split(/[?#]/)[0] !== t.path) {
|
|
561
563
|
let n = a(t);
|
|
562
564
|
e.title = n.title ?? T(t), n.icon && (e.icon = n.icon);
|
|
563
565
|
}
|
|
564
566
|
r = {
|
|
565
|
-
component:
|
|
566
|
-
props:
|
|
567
|
-
route:
|
|
567
|
+
component: ee(t),
|
|
568
|
+
props: R(t),
|
|
569
|
+
route: x(L(t)),
|
|
568
570
|
closeGuards: [],
|
|
569
571
|
activatedHooks: [],
|
|
570
572
|
deactivatedHooks: [],
|
|
@@ -584,7 +586,7 @@ function z(e) {
|
|
|
584
586
|
return n !== p.value || n !== d(t) || t.path === e.path || await k(n);
|
|
585
587
|
}), t.afterEach((e, t, n) => {
|
|
586
588
|
if (n) return;
|
|
587
|
-
if ((!h || s && _() !== g) &&
|
|
589
|
+
if ((!h || s && _() !== g) && y(), !o(e)) {
|
|
588
590
|
p.value = null;
|
|
589
591
|
return;
|
|
590
592
|
}
|
|
@@ -607,7 +609,7 @@ function z(e) {
|
|
|
607
609
|
});
|
|
608
610
|
async function O(e) {
|
|
609
611
|
let n = C(e);
|
|
610
|
-
|
|
612
|
+
n && e !== p.value && await t.push(n.fullPath);
|
|
611
613
|
}
|
|
612
614
|
async function k(e) {
|
|
613
615
|
let t = m.get(e);
|
|
@@ -635,13 +637,7 @@ function z(e) {
|
|
|
635
637
|
}
|
|
636
638
|
async function N() {
|
|
637
639
|
let e = !1;
|
|
638
|
-
for (let t of [...f.value])
|
|
639
|
-
if (!t.closable || !await k(t.key)) {
|
|
640
|
-
e ||= t.key === p.value;
|
|
641
|
-
continue;
|
|
642
|
-
}
|
|
643
|
-
A(t.key);
|
|
644
|
-
}
|
|
640
|
+
for (let t of [...f.value]) !t.closable || !await k(t.key) ? e ||= t.key === p.value : A(t.key);
|
|
645
641
|
if (v(), !e && p.value) {
|
|
646
642
|
let e = f.value[0];
|
|
647
643
|
p.value = null, await t.push(e ? e.fullPath : l);
|
|
@@ -657,7 +653,7 @@ function z(e) {
|
|
|
657
653
|
let n = C(e);
|
|
658
654
|
n && (n.title = t ?? m.get(e)?.defaultTitle ?? n.title, v());
|
|
659
655
|
}
|
|
660
|
-
function
|
|
656
|
+
function I(e) {
|
|
661
657
|
return C(typeof e == "string" ? e : d(e))?.hydrated ?? !1;
|
|
662
658
|
}
|
|
663
659
|
return {
|
|
@@ -669,13 +665,12 @@ function z(e) {
|
|
|
669
665
|
closeAll: N,
|
|
670
666
|
reload: P,
|
|
671
667
|
setTitle: F,
|
|
672
|
-
isLive:
|
|
668
|
+
isLive: I,
|
|
673
669
|
runtime: (e) => m.get(e)
|
|
674
670
|
};
|
|
675
671
|
}
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
var B = 6e4, ee = 3e5, te = /Failed to fetch dynamically imported module|Importing a module script failed|error loading dynamically imported module|Unable to preload CSS/i, ne = (e) => te.test(String(e?.message ?? e ?? "")), V = "w-chunk-reload";
|
|
672
|
+
// src/composables/usePublishedVersion.ts
|
|
673
|
+
var B = 6e4, te = 3e5, ne = /Failed to fetch dynamically imported module|Importing a module script failed|error loading dynamically imported module|Unable to preload CSS/i, re = (e) => ne.test(String(e?.message ?? e ?? "")), V = "w-chunk-reload";
|
|
679
674
|
function H(e) {
|
|
680
675
|
let t = !1, n = -Infinity, r = -Infinity, i = null, a = !1, o = !1;
|
|
681
676
|
async function s() {
|
|
@@ -720,14 +715,14 @@ function H(e) {
|
|
|
720
715
|
}
|
|
721
716
|
};
|
|
722
717
|
}
|
|
723
|
-
function
|
|
718
|
+
function ie(e, t) {
|
|
724
719
|
if (t.enabled === !1 || typeof window > "u") return null;
|
|
725
720
|
let n = H({
|
|
726
721
|
currentBuild: t.buildId,
|
|
727
722
|
fetchVersion: () => fetch(t.versionUrl ?? "/version.json", { cache: "no-store" }),
|
|
728
723
|
now: () => Date.now(),
|
|
729
724
|
online: () => navigator.onLine !== !1,
|
|
730
|
-
pending: t.pending ??
|
|
725
|
+
pending: t.pending ?? k,
|
|
731
726
|
reload: () => window.location.reload(),
|
|
732
727
|
goTo: (e) => window.location.assign(e),
|
|
733
728
|
storage: (() => {
|
|
@@ -754,10 +749,9 @@ function re(e, t) {
|
|
|
754
749
|
n.onChunkError(r) && e.preventDefault();
|
|
755
750
|
}), e.onError((t, i) => {
|
|
756
751
|
let a = i?.fullPath ? e.resolve(i.fullPath).href : r;
|
|
757
|
-
r = void 0,
|
|
752
|
+
r = void 0, re(t) && n.onChunkError(a);
|
|
758
753
|
}), n;
|
|
759
754
|
}
|
|
760
|
-
|
|
761
|
-
export { ne as a, P as c, O as d, k as f, re as i, N as l, ee as n, z as o, A as p, H as r, F as s, B as t, M as u };
|
|
755
|
+
export { re as a, F as c, k as d, A as f, ie as i, P as l, te as n, z as o, j as p, H as r, I as s, B as t, N as u };
|
|
762
756
|
|
|
763
|
-
//# sourceMappingURL=composables-
|
|
757
|
+
//# sourceMappingURL=composables-BYOQ7IBQ.js.map
|