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