@wgalleti/primevue-components 0.22.3 → 0.24.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/dist/components/form/WFormRenderer.vue.d.ts +5 -0
- package/dist/components/ui/WMapSelect.vue.d.ts +26 -3
- package/dist/components/ui/WTabNav.vue.d.ts +6 -3
- package/dist/{components-CYjLRDxm.js → components-Cq58gFKG.js} +1881 -1764
- package/dist/components-Cq58gFKG.js.map +1 -0
- package/dist/components-DfzS276S.cjs +25 -0
- package/dist/components-DfzS276S.cjs.map +1 -0
- package/dist/components.cjs +1 -1
- package/dist/components.js +1 -1
- package/dist/{composables-B-LVf35N.js → composables-D5lRsZJQ.js} +104 -142
- package/dist/composables-D5lRsZJQ.js.map +1 -0
- package/dist/composables-DuOYSFox.cjs +2 -0
- package/dist/composables-DuOYSFox.cjs.map +1 -0
- package/dist/composables.cjs +1 -1
- package/dist/composables.js +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.js +4 -4
- package/dist/primevue-components.css +1 -1
- package/dist/routeTabs-BnVpnSeJ.cjs.map +1 -1
- package/dist/routeTabs-D6m8PuP6.js.map +1 -1
- package/dist/types/mapSelect.d.ts +6 -1
- package/dist/types/routeTabs.d.ts +7 -0
- package/dist/{useFormKeyboardNav-Brgrjxu-.js → useFormKeyboardNav-DGbCVk4F.js} +64 -21
- package/dist/useFormKeyboardNav-DGbCVk4F.js.map +1 -0
- package/dist/{useFormKeyboardNav-HoSmQwuv.cjs → useFormKeyboardNav-pw3m7oX4.cjs} +3 -3
- package/dist/useFormKeyboardNav-pw3m7oX4.cjs.map +1 -0
- package/dist/utils/formRecord.d.ts +6 -1
- package/dist/utils/mapLabels.d.ts +33 -0
- package/package.json +1 -1
- package/dist/components--YULeZoE.cjs +0 -25
- package/dist/components--YULeZoE.cjs.map +0 -1
- package/dist/components-CYjLRDxm.js.map +0 -1
- package/dist/composables-B-LVf35N.js.map +0 -1
- package/dist/composables-BqRASiBc.cjs +0 -2
- package/dist/composables-BqRASiBc.cjs.map +0 -1
- package/dist/useFormKeyboardNav-Brgrjxu-.js.map +0 -1
- package/dist/useFormKeyboardNav-HoSmQwuv.cjs.map +0 -1
package/dist/components.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./components
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./components-DfzS276S.cjs");exports.WActionBar=e.h,exports.WAutoCompleteFK=e.U,exports.WChart=e.T,exports.WCheckList=e.u,exports.WCrudColumnRenderer=e.J,exports.WCrudFormDialog=e.L,exports.WCrudSubview=e.M,exports.WCrudView=e.P,exports.WDatePicker=e.H,exports.WDateRange=e.j,exports.WDetailHeader=e.x,exports.WDialog=e.a,exports.WEditableTable=e.N,exports.WEmptyState=e.S,exports.WFileUpload=e.A,exports.WFormRenderer=e.R,exports.WFormSection=e.g,exports.WImageCropper=e.B,exports.WInfoCard=e.b,exports.WKanbanBoard=e.t,exports.WKpiCard=e.y,exports.WKpiGrid=e.v,exports.WMapSelect=e.l,exports.WMarkdownEditor=e.s,exports.WMarkdownToc=e.o,exports.WMarkdownView=e.c,exports.WMoneyInput=e.V,exports.WPageHeader=e.C,exports.WProgressFlow=e.m,exports.WSectionHeader=e._,exports.WStatusTag=e.w,exports.WStepFlow=e.f,exports.WStepSection=e.d,exports.WTabBar=e.i,exports.WTabNav=e.r,exports.WTabViewport=e.n,exports.WTransferList=e.z,exports.WTreeSelect=e.k;
|
package/dist/components.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as e, B as t, C as n, H as r, J as i, L as a, M as o, N as s, P as c, R as l, S as u, T as d, U as f, V as p, _ as m, a as h, b as g, c as _, d as v, f as y, g as b, h as x, i as S, j as C, k as w, l as T, m as E, n as D, o as O, r as k, s as A, t as j, u as M, v as N, w as P, x as F, y as I, z as L } from "./components-
|
|
1
|
+
import { A as e, B as t, C as n, H as r, J as i, L as a, M as o, N as s, P as c, R as l, S as u, T as d, U as f, V as p, _ as m, a as h, b as g, c as _, d as v, f as y, g as b, h as x, i as S, j as C, k as w, l as T, m as E, n as D, o as O, r as k, s as A, t as j, u as M, v as N, w as P, x as F, y as I, z as L } from "./components-Cq58gFKG.js";
|
|
2
2
|
export { x as WActionBar, f as WAutoCompleteFK, d as WChart, M as WCheckList, i as WCrudColumnRenderer, a as WCrudFormDialog, o as WCrudSubview, c as WCrudView, r as WDatePicker, C as WDateRange, F as WDetailHeader, h as WDialog, s as WEditableTable, u as WEmptyState, e as WFileUpload, l as WFormRenderer, b as WFormSection, t as WImageCropper, g as WInfoCard, j as WKanbanBoard, I as WKpiCard, N as WKpiGrid, T as WMapSelect, A as WMarkdownEditor, O as WMarkdownToc, _ as WMarkdownView, p as WMoneyInput, n as WPageHeader, E as WProgressFlow, m as WSectionHeader, P as WStatusTag, y as WStepFlow, v as WStepSection, S as WTabBar, k as WTabNav, D as WTabViewport, L as WTransferList, w as WTreeSelect };
|
|
@@ -1,74 +1,34 @@
|
|
|
1
|
-
import { a as e, c as t, d as n,
|
|
2
|
-
import { a as
|
|
3
|
-
import { t as
|
|
4
|
-
import { computed as
|
|
5
|
-
//#region src/utils/formRecord.ts
|
|
6
|
-
function h(e) {
|
|
7
|
-
let t = {};
|
|
8
|
-
for (let n of e) t[n.field] = n.defaultValue === void 0 ? null : typeof n.defaultValue == "function" ? n.defaultValue() : n.defaultValue;
|
|
9
|
-
return t;
|
|
10
|
-
}
|
|
11
|
-
function g(e, t, n) {
|
|
12
|
-
let i = {};
|
|
13
|
-
for (let a of t) {
|
|
14
|
-
let t = e[a.field] === void 0 ? null : e[a.field];
|
|
15
|
-
t && (a.type === "date" || a.type === "datetime") && typeof t == "string" && (t = r(t)), n[a.field] = t, i[a.field] = t;
|
|
16
|
-
}
|
|
17
|
-
return i;
|
|
18
|
-
}
|
|
19
|
-
function _(e, r) {
|
|
20
|
-
let i = { ...e };
|
|
21
|
-
for (let e of r) {
|
|
22
|
-
let r = i[e.field];
|
|
23
|
-
if (e.type === "date" && r instanceof Date ? i[e.field] = o(r) : e.type === "datetime" && r instanceof Date && (i[e.field] = n(r)), e.type === "fk" && typeof r == "object" && r) {
|
|
24
|
-
let t = e.optionValue || "id";
|
|
25
|
-
i[e.field] = r[t] ?? r;
|
|
26
|
-
}
|
|
27
|
-
(e.type === "mask" || e.type === "cpf_cnpj") && typeof r == "string" && (i[e.field] = t(r));
|
|
28
|
-
}
|
|
29
|
-
return i;
|
|
30
|
-
}
|
|
31
|
-
function v(e, t) {
|
|
32
|
-
for (let n of e) {
|
|
33
|
-
if (n.validate) {
|
|
34
|
-
let e = n.validate(t[n.field]);
|
|
35
|
-
if (e) return e;
|
|
36
|
-
}
|
|
37
|
-
if (n.required) {
|
|
38
|
-
let e = t[n.field];
|
|
39
|
-
if (e == null || e === "") return `${n.label} é obrigatório`;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
//#endregion
|
|
1
|
+
import { a as e, c as t, d as n, h as r, m as i, o as a, p as o, r as s, s as c, u as l } from "./useFormKeyboardNav-DGbCVk4F.js";
|
|
2
|
+
import { a as u, i as d } from "./routeTabs-D6m8PuP6.js";
|
|
3
|
+
import { t as f } from "./labels-CXBhCk2N.js";
|
|
4
|
+
import { computed as p, inject as m, reactive as h, ref as g, shallowReactive as _ } from "vue";
|
|
45
5
|
//#region src/composables/useCrudManager.ts
|
|
46
|
-
function
|
|
6
|
+
function v(e, t) {
|
|
47
7
|
let n = {};
|
|
48
8
|
for (let r of Object.keys(t)) JSON.stringify(e[r]) !== JSON.stringify(t[r]) && (n[r] = t[r]);
|
|
49
9
|
return n;
|
|
50
10
|
}
|
|
51
|
-
function
|
|
52
|
-
let { endpoint:
|
|
11
|
+
function y(_) {
|
|
12
|
+
let { endpoint: y, form: b, pk: x = "id", searchDebounce: S = 300, partialUpdate: C = !0, refetchOnSave: w = !0, fetchDetailOnEdit: T = !1, filterParams: E = void 0, createDefaults: D = void 0, transformItems: O = void 0, transformPayload: k = void 0, onAfterSave: A = void 0, onAfterDelete: j = void 0 } = _, M = m(u);
|
|
53
13
|
if (!M) throw Error("[wPrimeVueComponents] dataProvider não encontrado. Registre o WPrimeVuePlugin antes de usar useCrudManager.");
|
|
54
|
-
let N = M, P = d
|
|
55
|
-
...
|
|
56
|
-
...
|
|
57
|
-
}, I =
|
|
14
|
+
let N = M, P = m(d), ee = _.pageSize ?? P?.defaultPageSize ?? 20, F = {
|
|
15
|
+
...f,
|
|
16
|
+
..._.labels
|
|
17
|
+
}, I = a(), { confirmDelete: te } = e(), L = g([]), R = g([]), z = g({}), B = g(!1), V = 0, H = g(!1), U = g(""), W = g(!1), G = g(!1), K = g(null), q = h({}), J = null, Y = h({
|
|
58
18
|
page: 1,
|
|
59
19
|
pageSize: ee,
|
|
60
20
|
rows: 0,
|
|
61
21
|
totalPages: 0
|
|
62
|
-
}), X =
|
|
22
|
+
}), X = h({
|
|
63
23
|
field: null,
|
|
64
24
|
order: 0
|
|
65
|
-
}), Z =
|
|
25
|
+
}), Z = h({});
|
|
66
26
|
function ne() {
|
|
67
|
-
return
|
|
27
|
+
return t(b);
|
|
68
28
|
}
|
|
69
29
|
let re = ne();
|
|
70
30
|
for (let e of Object.keys(re)) q[e] = re[e];
|
|
71
|
-
let Q =
|
|
31
|
+
let Q = p(() => K.value !== null && !G.value), ie = p(() => G.value), ae = p(() => G.value ? F.viewTitle ?? "Visualizar Registro" : Q.value ? F.editTitle : F.createTitle), oe = p(() => Y.page <= 1), se = p(() => Y.page >= Y.totalPages), ce = null;
|
|
72
32
|
async function $(e = {}) {
|
|
73
33
|
let t = ++V;
|
|
74
34
|
B.value = !0;
|
|
@@ -80,7 +40,7 @@ function b(t) {
|
|
|
80
40
|
};
|
|
81
41
|
U.value && (n.search = U.value), X.field && X.order !== 0 && (n.ordering = X.order === -1 ? `-${X.field}` : X.field), E && Object.assign(n, E());
|
|
82
42
|
for (let [e, t] of Object.entries(Z)) t != null && t !== "" && (n[e] = t);
|
|
83
|
-
let r = await N.list(
|
|
43
|
+
let r = await N.list(y, n);
|
|
84
44
|
if (t !== V) return;
|
|
85
45
|
L.value = O ? O(r.data) : r.data, R.value = [], Y.rows = r.rows, z.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;
|
|
86
46
|
} finally {
|
|
@@ -99,7 +59,7 @@ function b(t) {
|
|
|
99
59
|
for (let [e, n] of Object.entries(Z)) n != null && n !== "" && (t[e] = n);
|
|
100
60
|
let n = [], r = 1;
|
|
101
61
|
for (; r <= 1e4;) {
|
|
102
|
-
let i = await N.list(
|
|
62
|
+
let i = await N.list(y, {
|
|
103
63
|
...t,
|
|
104
64
|
page: r,
|
|
105
65
|
page_size: e
|
|
@@ -150,13 +110,13 @@ function b(t) {
|
|
|
150
110
|
W.value = !0;
|
|
151
111
|
}
|
|
152
112
|
function Se(e) {
|
|
153
|
-
J =
|
|
113
|
+
J = l(e, b, q);
|
|
154
114
|
}
|
|
155
115
|
async function Ce(e) {
|
|
156
116
|
try {
|
|
157
|
-
return (await N.get(
|
|
117
|
+
return (await N.get(y, e[x])).data;
|
|
158
118
|
} catch (e) {
|
|
159
|
-
return I.error(
|
|
119
|
+
return I.error(s(e, "Erro ao carregar registro")), null;
|
|
160
120
|
}
|
|
161
121
|
}
|
|
162
122
|
function we(e, t) {
|
|
@@ -182,7 +142,7 @@ function b(t) {
|
|
|
182
142
|
for (let t of b) {
|
|
183
143
|
if (t.field === x) continue;
|
|
184
144
|
let n = e[t.field] === void 0 ? q[t.field] : e[t.field];
|
|
185
|
-
n && (t.type === "date" || t.type === "datetime") && typeof n == "string" && (n =
|
|
145
|
+
n && (t.type === "date" || t.type === "datetime") && typeof n == "string" && (n = o(n)), q[t.field] = n;
|
|
186
146
|
}
|
|
187
147
|
if (D) {
|
|
188
148
|
let e = D();
|
|
@@ -191,10 +151,10 @@ function b(t) {
|
|
|
191
151
|
W.value = !0;
|
|
192
152
|
}
|
|
193
153
|
function ke(e) {
|
|
194
|
-
return
|
|
154
|
+
return c(e, b);
|
|
195
155
|
}
|
|
196
156
|
async function Ae() {
|
|
197
|
-
let e =
|
|
157
|
+
let e = n(b, q, Q.value);
|
|
198
158
|
if (e) return I.error(e), null;
|
|
199
159
|
H.value = !0;
|
|
200
160
|
try {
|
|
@@ -206,7 +166,7 @@ function b(t) {
|
|
|
206
166
|
(t == null || t === "") && (e[n] = r);
|
|
207
167
|
}
|
|
208
168
|
}
|
|
209
|
-
if (Q.value && C && J && (e =
|
|
169
|
+
if (Q.value && C && J && (e = v(ke(J), e), Object.keys(e).length === 0 && !k)) {
|
|
210
170
|
W.value = !1;
|
|
211
171
|
let e = K.value;
|
|
212
172
|
return K.value = null, J = null, e;
|
|
@@ -225,40 +185,40 @@ function b(t) {
|
|
|
225
185
|
let i = r ? { headers: r } : void 0, a;
|
|
226
186
|
if (Q.value && K.value) {
|
|
227
187
|
let e = K.value[x];
|
|
228
|
-
if (a = await N.update(
|
|
188
|
+
if (a = await N.update(y, e, n, i), !w) {
|
|
229
189
|
let t = L.value.findIndex((t) => t[x] === e);
|
|
230
190
|
t !== -1 && (L.value[t] = a.data);
|
|
231
191
|
}
|
|
232
192
|
I.success(F.successUpdate);
|
|
233
|
-
} else a = await N.create(
|
|
193
|
+
} else a = await N.create(y, n, i), w || (L.value.unshift(a.data), Y.rows++), I.success(F.successCreate);
|
|
234
194
|
return W.value = !1, K.value = null, J = null, w && await $(), A && A(a.data, Q.value), a.data;
|
|
235
195
|
} catch (e) {
|
|
236
|
-
return I.error(
|
|
196
|
+
return I.error(s(e, "Erro ao salvar registro")), null;
|
|
237
197
|
} finally {
|
|
238
198
|
H.value = !1;
|
|
239
199
|
}
|
|
240
200
|
}
|
|
241
|
-
async function je(e, t,
|
|
242
|
-
let
|
|
243
|
-
|
|
201
|
+
async function je(e, t, n) {
|
|
202
|
+
let a = e[x], o = b.find((e) => e.field === t), c = n;
|
|
203
|
+
o?.type === "date" && c instanceof Date ? c = i(c) : o?.type === "datetime" && c instanceof Date && (c = r(c));
|
|
244
204
|
try {
|
|
245
|
-
let e = await N.update(
|
|
205
|
+
let e = await N.update(y, a, { [t]: c }), n = L.value.findIndex((e) => e[x] === a);
|
|
246
206
|
n !== -1 && (L.value[n] = {
|
|
247
207
|
...L.value[n],
|
|
248
208
|
...e.data
|
|
249
209
|
}), I.success(F.successUpdate);
|
|
250
210
|
} catch (e) {
|
|
251
|
-
I.error(
|
|
211
|
+
I.error(s(e, "Erro ao salvar o campo"));
|
|
252
212
|
}
|
|
253
213
|
}
|
|
254
214
|
async function Me(e) {
|
|
255
215
|
try {
|
|
256
216
|
let t = e[x];
|
|
257
|
-
await N.delete(
|
|
217
|
+
await N.delete(y, t);
|
|
258
218
|
let n = L.value.findIndex((e) => e[x] === t);
|
|
259
219
|
n !== -1 && (L.value.splice(n, 1), Y.rows--), I.success(F.successDelete), j && j(e);
|
|
260
220
|
} catch (e) {
|
|
261
|
-
I.error(
|
|
221
|
+
I.error(s(e, "Erro ao excluir registro"));
|
|
262
222
|
}
|
|
263
223
|
}
|
|
264
224
|
function Ne(e) {
|
|
@@ -317,33 +277,33 @@ function b(t) {
|
|
|
317
277
|
clearSelection: Pe,
|
|
318
278
|
setColumnFilter: Fe,
|
|
319
279
|
clearColumnFilters: Ie,
|
|
320
|
-
config:
|
|
280
|
+
config: _
|
|
321
281
|
};
|
|
322
282
|
}
|
|
323
283
|
//#endregion
|
|
324
284
|
//#region src/composables/useSubviewCrud.ts
|
|
325
|
-
function
|
|
326
|
-
let { rows:
|
|
327
|
-
...
|
|
328
|
-
...
|
|
329
|
-
}, C =
|
|
285
|
+
function b(r) {
|
|
286
|
+
let { rows: i, onChange: o, form: s, createDefaults: u = void 0, transformPayload: d = void 0, uniqueBy: m = void 0, uniqueMessage: _ = "Este item já está na lista.", toForm: v = void 0, onAfterSave: y = void 0, onAfterDelete: b = void 0, toast: x = !1 } = r, S = {
|
|
287
|
+
...f,
|
|
288
|
+
...r.labels
|
|
289
|
+
}, C = a(), { confirmDelete: w } = e(), T = p(() => i() ?? []), E = g(!1), D = g(!1), O = g(null), k = g(-1), A = h({}), j = t(s);
|
|
330
290
|
for (let e of Object.keys(j)) A[e] = j[e];
|
|
331
|
-
let M =
|
|
291
|
+
let M = p(() => k.value >= 0), N = p(() => M.value ? S.editTitle : S.createTitle);
|
|
332
292
|
function P() {
|
|
333
|
-
let e =
|
|
293
|
+
let e = t(s);
|
|
334
294
|
for (let t of Object.keys(e)) A[t] = e[t];
|
|
335
295
|
}
|
|
336
296
|
function ee(e, t) {
|
|
337
297
|
A[e] = t;
|
|
338
298
|
}
|
|
339
299
|
function F() {
|
|
340
|
-
if (
|
|
300
|
+
if (u) for (let [e, t] of Object.entries(u())) A[e] = t;
|
|
341
301
|
}
|
|
342
302
|
function I() {
|
|
343
303
|
O.value = null, k.value = -1, P(), F(), D.value = !0;
|
|
344
304
|
}
|
|
345
305
|
function te(e) {
|
|
346
|
-
if (
|
|
306
|
+
if (l(e, s, A), v) for (let [t, n] of Object.entries(v(e))) A[t] = n;
|
|
347
307
|
}
|
|
348
308
|
function L(e, t) {
|
|
349
309
|
O.value = e, k.value = t, te(e), D.value = !0;
|
|
@@ -352,30 +312,30 @@ function x(t) {
|
|
|
352
312
|
O.value = null, k.value = -1, P(), te(e), F(), D.value = !0;
|
|
353
313
|
}
|
|
354
314
|
function z(e) {
|
|
355
|
-
if (!
|
|
356
|
-
let t = typeof
|
|
315
|
+
if (!m) return;
|
|
316
|
+
let t = typeof m == "function" ? m(e) : e[m];
|
|
357
317
|
if (t != null && t !== "") return String(t);
|
|
358
318
|
}
|
|
359
319
|
function B() {
|
|
360
|
-
let e =
|
|
320
|
+
let e = n(s, A, M.value);
|
|
361
321
|
if (e) return C.error(e), null;
|
|
362
|
-
let t =
|
|
363
|
-
if (!M.value &&
|
|
322
|
+
let t = c(A, s);
|
|
323
|
+
if (!M.value && u) for (let [e, n] of Object.entries(u())) {
|
|
364
324
|
let r = t[e];
|
|
365
325
|
(r == null || r === "") && (t[e] = n);
|
|
366
326
|
}
|
|
367
|
-
|
|
368
|
-
let
|
|
369
|
-
...
|
|
327
|
+
d && (t = d(t, M.value));
|
|
328
|
+
let r = T.value, i = k.value, a = i >= 0, l = a ? {
|
|
329
|
+
...r[i],
|
|
370
330
|
...t
|
|
371
|
-
} : { ...t },
|
|
372
|
-
if (
|
|
373
|
-
let
|
|
374
|
-
return
|
|
331
|
+
} : { ...t }, f = z(l);
|
|
332
|
+
if (f !== void 0 && r.some((e, t) => t !== i && z(e) === f)) return C.error(_), null;
|
|
333
|
+
let p = a ? r.map((e, t) => t === i ? l : e) : [...r, l];
|
|
334
|
+
return o(p), x && C.success(a ? S.successUpdate : S.successCreate), y?.(l, a), D.value = !1, O.value = null, k.value = -1, l;
|
|
375
335
|
}
|
|
376
336
|
function V(e) {
|
|
377
337
|
let t = T.value, n = t[e];
|
|
378
|
-
n !== void 0 && (
|
|
338
|
+
n !== void 0 && (o(t.filter((t, n) => n !== e)), x && C.success(S.successDelete), b?.(n, e));
|
|
379
339
|
}
|
|
380
340
|
function H(e, t) {
|
|
381
341
|
w(() => V(t), S.deleteConfirmMessage);
|
|
@@ -398,49 +358,49 @@ function x(t) {
|
|
|
398
358
|
setFormField: ee,
|
|
399
359
|
resetForm: P,
|
|
400
360
|
labels: S,
|
|
401
|
-
config:
|
|
361
|
+
config: r
|
|
402
362
|
};
|
|
403
363
|
}
|
|
404
364
|
//#endregion
|
|
405
365
|
//#region src/composables/defineCrudConfig.ts
|
|
406
|
-
function
|
|
366
|
+
function x(e) {
|
|
407
367
|
return e;
|
|
408
368
|
}
|
|
409
369
|
//#endregion
|
|
410
370
|
//#region src/composables/useApi.ts
|
|
411
|
-
function
|
|
412
|
-
let { endpoint: t, searchDebounce: n = 300, immediate: r = !1 } = e, i =
|
|
371
|
+
function S(e) {
|
|
372
|
+
let { endpoint: t, searchDebounce: n = 300, immediate: r = !1 } = e, i = m(u);
|
|
413
373
|
if (!i) throw Error("[wPrimeVueComponents] dataProvider não encontrado. Registre o WPrimeVuePlugin antes de usar useApi.");
|
|
414
|
-
let a = i, o = d
|
|
374
|
+
let a = i, o = m(d), s = e.pageSize ?? o?.defaultPageSize ?? 20, c = g([]), l = g(!1), f = g(""), p = g({}), _ = h({}), v = h({
|
|
415
375
|
page: 1,
|
|
416
|
-
pageSize:
|
|
376
|
+
pageSize: s,
|
|
417
377
|
rows: 0,
|
|
418
378
|
totalPages: 0
|
|
419
|
-
}), y =
|
|
379
|
+
}), y = h({
|
|
420
380
|
field: null,
|
|
421
381
|
order: 0
|
|
422
382
|
}), b = null;
|
|
423
383
|
async function x(e = {}) {
|
|
424
|
-
|
|
384
|
+
l.value = !0;
|
|
425
385
|
try {
|
|
426
386
|
let n = {
|
|
427
387
|
page: v.page,
|
|
428
388
|
page_size: v.pageSize,
|
|
429
389
|
...e
|
|
430
390
|
};
|
|
431
|
-
|
|
391
|
+
f.value && (n.search = f.value), y.field && y.order !== 0 && (n.ordering = y.order === -1 ? `-${y.field}` : y.field);
|
|
432
392
|
for (let [e, t] of Object.entries(_)) t != null && t !== "" && (n[e] = t);
|
|
433
393
|
let r = await a.list(t, n);
|
|
434
|
-
|
|
394
|
+
c.value = r.data, v.rows = r.rows, r.page && (v.page = r.page), r.page_size && (v.pageSize = r.page_size), v.totalPages = Math.ceil(v.rows / v.pageSize) || 0, p.value = r.extras ?? {};
|
|
435
395
|
} finally {
|
|
436
|
-
|
|
396
|
+
l.value = !1;
|
|
437
397
|
}
|
|
438
398
|
}
|
|
439
399
|
async function S() {
|
|
440
400
|
await x();
|
|
441
401
|
}
|
|
442
402
|
function C(e) {
|
|
443
|
-
|
|
403
|
+
f.value = e, b && clearTimeout(b), b = setTimeout(() => {
|
|
444
404
|
v.page = 1, x();
|
|
445
405
|
}, n);
|
|
446
406
|
}
|
|
@@ -458,12 +418,12 @@ function C(e) {
|
|
|
458
418
|
y.field = e.sortField ?? null, y.order = e.sortOrder ?? 0, v.page = 1, x();
|
|
459
419
|
}
|
|
460
420
|
return r && x(), {
|
|
461
|
-
items:
|
|
462
|
-
loading:
|
|
463
|
-
search:
|
|
421
|
+
items: c,
|
|
422
|
+
loading: l,
|
|
423
|
+
search: f,
|
|
464
424
|
pagination: v,
|
|
465
425
|
sort: y,
|
|
466
|
-
extras:
|
|
426
|
+
extras: p,
|
|
467
427
|
fetchItems: x,
|
|
468
428
|
refresh: S,
|
|
469
429
|
setSearch: C,
|
|
@@ -475,7 +435,7 @@ function C(e) {
|
|
|
475
435
|
}
|
|
476
436
|
//#endregion
|
|
477
437
|
//#region src/composables/useRouteTabs.ts
|
|
478
|
-
function
|
|
438
|
+
function C(e) {
|
|
479
439
|
return {
|
|
480
440
|
fullPath: e.fullPath,
|
|
481
441
|
path: e.path,
|
|
@@ -488,18 +448,18 @@ function w(e) {
|
|
|
488
448
|
redirectedFrom: e.redirectedFrom
|
|
489
449
|
};
|
|
490
450
|
}
|
|
491
|
-
function
|
|
451
|
+
function w(e) {
|
|
492
452
|
let t = e.matched[e.matched.length - 1]?.props?.default;
|
|
493
453
|
return t === !0 ? { ...e.params } : typeof t == "function" ? t(e) ?? {} : t && typeof t == "object" ? { ...t } : {};
|
|
494
454
|
}
|
|
495
|
-
function
|
|
455
|
+
function T(e) {
|
|
496
456
|
let t = e.matched[e.matched.length - 1]?.components?.default;
|
|
497
457
|
return t && typeof t != "function" ? t : null;
|
|
498
458
|
}
|
|
499
|
-
function
|
|
459
|
+
function E(e) {
|
|
500
460
|
let { router: t, mode: n = "screen", moduleRoot: r, resolveTabMeta: i = () => ({}), isTabRoute: a = () => !0, storage: o = typeof localStorage > "u" ? null : localStorage, storageKey: s = "w-route-tabs", homePath: c = "/", maxTabs: l } = e;
|
|
501
461
|
if (n === "module" && !r) throw Error("[useRouteTabs] mode \"module\" exige a opção moduleRoot(route).");
|
|
502
|
-
let u = (e) => n === "module" && r?.(e) || e.path, d =
|
|
462
|
+
let u = (e) => n === "module" && r?.(e) || e.path, d = g([]), f = g(null), p = /* @__PURE__ */ new Map(), m = !1, h = null;
|
|
503
463
|
function v() {
|
|
504
464
|
return typeof s == "function" ? s() : s;
|
|
505
465
|
}
|
|
@@ -508,13 +468,14 @@ function D(e) {
|
|
|
508
468
|
let e = {
|
|
509
469
|
v: 1,
|
|
510
470
|
activeKey: f.value,
|
|
511
|
-
tabs: d.value.map(({ key: e, fullPath: t, title: n, icon: r, closable: i, group: a }) => ({
|
|
471
|
+
tabs: d.value.map(({ key: e, fullPath: t, title: n, icon: r, closable: i, group: a, color: o }) => ({
|
|
512
472
|
key: e,
|
|
513
473
|
fullPath: t,
|
|
514
474
|
title: n,
|
|
515
475
|
icon: r,
|
|
516
476
|
closable: i,
|
|
517
|
-
group: a
|
|
477
|
+
group: a,
|
|
478
|
+
color: o
|
|
518
479
|
}))
|
|
519
480
|
};
|
|
520
481
|
try {
|
|
@@ -522,7 +483,7 @@ function D(e) {
|
|
|
522
483
|
} catch {}
|
|
523
484
|
}
|
|
524
485
|
function b() {
|
|
525
|
-
if (
|
|
486
|
+
if (m = !0, h = v(), d.value = [], f.value = null, p.clear(), o) try {
|
|
526
487
|
let e = o.getItem(v());
|
|
527
488
|
if (!e) return;
|
|
528
489
|
let t = JSON.parse(e);
|
|
@@ -546,32 +507,32 @@ function D(e) {
|
|
|
546
507
|
}
|
|
547
508
|
d.value.push(e);
|
|
548
509
|
}
|
|
549
|
-
function
|
|
510
|
+
function E(e) {
|
|
550
511
|
let t = i(e);
|
|
551
512
|
return t.title ? t.title : typeof e.name == "string" ? e.name : e.path;
|
|
552
513
|
}
|
|
553
514
|
function D(e, t) {
|
|
554
|
-
let r =
|
|
515
|
+
let r = p.get(e.key);
|
|
555
516
|
if (r && n === "module" && r.route.path !== t.path) {
|
|
556
|
-
|
|
517
|
+
p.delete(e.key), r = void 0, e.remount += 1;
|
|
557
518
|
let n = i(t);
|
|
558
|
-
e.title = n.title ??
|
|
519
|
+
e.title = n.title ?? E(t), n.icon && (e.icon = n.icon);
|
|
559
520
|
}
|
|
560
|
-
if (r) r.component =
|
|
521
|
+
if (r) r.component = T(t), r.props = w(t), Object.assign(r.route, C(t));
|
|
561
522
|
else {
|
|
562
523
|
if (e.fullPath.split(/[?#]/)[0] !== t.path) {
|
|
563
524
|
let n = i(t);
|
|
564
|
-
e.title = n.title ??
|
|
525
|
+
e.title = n.title ?? E(t), n.icon && (e.icon = n.icon);
|
|
565
526
|
}
|
|
566
527
|
r = {
|
|
567
|
-
component:
|
|
568
|
-
props:
|
|
569
|
-
route:
|
|
528
|
+
component: T(t),
|
|
529
|
+
props: w(t),
|
|
530
|
+
route: _(C(t)),
|
|
570
531
|
closeGuards: [],
|
|
571
532
|
activatedHooks: [],
|
|
572
533
|
deactivatedHooks: [],
|
|
573
|
-
defaultTitle:
|
|
574
|
-
},
|
|
534
|
+
defaultTitle: E(t)
|
|
535
|
+
}, p.set(e.key, r);
|
|
575
536
|
}
|
|
576
537
|
e.fullPath = t.fullPath, e.hydrated = !0;
|
|
577
538
|
}
|
|
@@ -581,12 +542,12 @@ function D(e) {
|
|
|
581
542
|
e && M(e.key);
|
|
582
543
|
}
|
|
583
544
|
n === "module" && t.beforeEach(async (e, t) => {
|
|
584
|
-
if (!
|
|
545
|
+
if (!m || !a(e) || !a(t)) return !0;
|
|
585
546
|
let n = u(e);
|
|
586
547
|
return n !== f.value || n !== u(t) || t.path === e.path || await A(n);
|
|
587
548
|
}), t.afterEach((e, t, n) => {
|
|
588
549
|
if (n) return;
|
|
589
|
-
if ((!
|
|
550
|
+
if ((!m || o && v() !== h) && b(), !a(e)) {
|
|
590
551
|
f.value = null;
|
|
591
552
|
return;
|
|
592
553
|
}
|
|
@@ -596,10 +557,11 @@ function D(e) {
|
|
|
596
557
|
s = {
|
|
597
558
|
key: r,
|
|
598
559
|
fullPath: e.fullPath,
|
|
599
|
-
title: t.title ??
|
|
560
|
+
title: t.title ?? E(e),
|
|
600
561
|
icon: t.icon,
|
|
601
562
|
closable: t.closable ?? !0,
|
|
602
563
|
group: t.group,
|
|
564
|
+
color: t.color,
|
|
603
565
|
hydrated: !1,
|
|
604
566
|
remount: 0
|
|
605
567
|
}, S(s);
|
|
@@ -611,13 +573,13 @@ function D(e) {
|
|
|
611
573
|
!n || e === f.value || await t.push(n.fullPath);
|
|
612
574
|
}
|
|
613
575
|
async function A(e) {
|
|
614
|
-
let t =
|
|
576
|
+
let t = p.get(e);
|
|
615
577
|
if (!t) return !0;
|
|
616
578
|
for (let e of [...t.closeGuards]) if (!await e()) return !1;
|
|
617
579
|
return !0;
|
|
618
580
|
}
|
|
619
581
|
function j(e) {
|
|
620
|
-
d.value = d.value.filter((t) => t.key !== e),
|
|
582
|
+
d.value = d.value.filter((t) => t.key !== e), p.delete(e);
|
|
621
583
|
}
|
|
622
584
|
async function M(e) {
|
|
623
585
|
let n = x(e);
|
|
@@ -651,12 +613,12 @@ function D(e) {
|
|
|
651
613
|
function ee(e) {
|
|
652
614
|
let t = x(e);
|
|
653
615
|
if (!t?.hydrated) return;
|
|
654
|
-
let n =
|
|
616
|
+
let n = p.get(e);
|
|
655
617
|
n && (n.closeGuards = [], n.activatedHooks = [], n.deactivatedHooks = []), t.remount += 1;
|
|
656
618
|
}
|
|
657
619
|
function F(e, t) {
|
|
658
620
|
let n = x(e);
|
|
659
|
-
n && (n.title = t ??
|
|
621
|
+
n && (n.title = t ?? p.get(e)?.defaultTitle ?? n.title, y());
|
|
660
622
|
}
|
|
661
623
|
function I(e) {
|
|
662
624
|
return x(typeof e == "string" ? e : u(e))?.hydrated ?? !1;
|
|
@@ -671,10 +633,10 @@ function D(e) {
|
|
|
671
633
|
reload: ee,
|
|
672
634
|
setTitle: F,
|
|
673
635
|
isLive: I,
|
|
674
|
-
runtime: (e) =>
|
|
636
|
+
runtime: (e) => p.get(e)
|
|
675
637
|
};
|
|
676
638
|
}
|
|
677
639
|
//#endregion
|
|
678
|
-
export {
|
|
640
|
+
export { y as a, b as i, S as n, x as r, E as t };
|
|
679
641
|
|
|
680
|
-
//# sourceMappingURL=composables-
|
|
642
|
+
//# sourceMappingURL=composables-D5lRsZJQ.js.map
|