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