@wgalleti/primevue-components 0.6.0 → 0.7.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/dist/WProgressFlow.vue_vue_type_script_setup_true_lang-B70Uk-1x.cjs +12 -0
- package/dist/WProgressFlow.vue_vue_type_script_setup_true_lang-B70Uk-1x.cjs.map +1 -0
- package/dist/WProgressFlow.vue_vue_type_script_setup_true_lang-BVlG1in1.js +3024 -0
- package/dist/WProgressFlow.vue_vue_type_script_setup_true_lang-BVlG1in1.js.map +1 -0
- package/dist/components/crud/WCrudColumnRenderer.vue.d.ts +1 -1
- package/dist/components/crud/WCrudFormDialog.vue.d.ts +7 -11
- package/dist/components/crud/WCrudView.vue.d.ts +7 -2
- package/dist/components/form/WAutoCompleteFK.vue.d.ts +2 -1
- package/dist/components/form/WFormRenderer.vue.d.ts +1 -1
- package/dist/components/form/WImageCropper.vue.d.ts +57 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/ui/WKpiGrid.vue.d.ts +1 -1
- package/dist/components.cjs +2 -0
- package/dist/components.cjs.map +1 -0
- package/dist/components.d.ts +2 -0
- package/dist/components.js +23 -0
- package/dist/components.js.map +1 -0
- package/dist/composables/useCrudManager.d.ts +1 -1
- package/dist/composables.cjs +2 -0
- package/dist/composables.cjs.map +1 -0
- package/dist/composables.d.ts +2 -0
- package/dist/composables.js +12 -0
- package/dist/composables.js.map +1 -0
- package/dist/index.cjs +1 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +122 -3541
- package/dist/index.js.map +1 -1
- package/dist/plugin-BKa0eSEM.js +7 -0
- package/dist/plugin-BKa0eSEM.js.map +1 -0
- package/dist/plugin-D1YvyKXX.cjs +2 -0
- package/dist/plugin-D1YvyKXX.cjs.map +1 -0
- package/dist/primevue-components.css +1 -1
- package/dist/types/action.d.ts +19 -0
- package/dist/types/column.d.ts +30 -0
- package/dist/types/componentMeta.d.ts +33 -0
- package/dist/types/field.d.ts +95 -0
- package/dist/types/index.d.ts +11 -14
- package/dist/types/kpi.d.ts +13 -0
- package/dist/types/labels.d.ts +17 -0
- package/dist/types/manager.d.ts +93 -0
- package/dist/types/plugin.d.ts +24 -2
- package/dist/types.cjs +2 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.js +23 -0
- package/dist/types.js.map +1 -0
- package/dist/useApi-B692TOWz.js +383 -0
- package/dist/useApi-B692TOWz.js.map +1 -0
- package/dist/useApi-BIlKLud-.cjs +2 -0
- package/dist/useApi-BIlKLud-.cjs.map +1 -0
- package/dist/useApiError-BEbEk2Kq.cjs +3 -0
- package/dist/useApiError-BEbEk2Kq.cjs.map +1 -0
- package/dist/useApiError-C7rPzGrF.js +375 -0
- package/dist/useApiError-C7rPzGrF.js.map +1 -0
- package/dist/utils/csv.d.ts +1 -1
- package/dist/utils/fieldMapper.d.ts +2 -1
- package/package.json +49 -12
- package/dist/types/components/crud/WCrudColumnRenderer.vue.d.ts +0 -8
- package/dist/types/components/crud/WCrudFormDialog.vue.d.ts +0 -52
- package/dist/types/components/crud/WCrudView.vue.d.ts +0 -127
- package/dist/types/components/form/WAutoCompleteFK.vue.d.ts +0 -54
- package/dist/types/components/form/WFormRenderer.vue.d.ts +0 -44
- package/dist/types/components/form/WMoneyInput.vue.d.ts +0 -28
- package/dist/types/components/form/WTransferList.vue.d.ts +0 -25
- package/dist/types/components/index.d.ts +0 -18
- package/dist/types/components/ui/WActionBar.vue.d.ts +0 -25
- package/dist/types/components/ui/WDetailHeader.vue.d.ts +0 -24
- package/dist/types/components/ui/WEmptyState.vue.d.ts +0 -13
- package/dist/types/components/ui/WFormSection.vue.d.ts +0 -19
- package/dist/types/components/ui/WInfoCard.vue.d.ts +0 -11
- package/dist/types/components/ui/WKpiCard.vue.d.ts +0 -32
- package/dist/types/components/ui/WKpiGrid.vue.d.ts +0 -31
- package/dist/types/components/ui/WPageHeader.vue.d.ts +0 -22
- package/dist/types/components/ui/WProgressFlow.vue.d.ts +0 -28
- package/dist/types/components/ui/WSectionHeader.vue.d.ts +0 -22
- package/dist/types/components/ui/WStatusTag.vue.d.ts +0 -10
- package/dist/types/composables/index.d.ts +0 -6
- package/dist/types/composables/useApi.d.ts +0 -2
- package/dist/types/composables/useApiError.d.ts +0 -4
- package/dist/types/composables/useAppConfirm.d.ts +0 -4
- package/dist/types/composables/useAppToast.d.ts +0 -6
- package/dist/types/composables/useCrudManager.d.ts +0 -2
- package/dist/types/composables/useFormatters.d.ts +0 -19
- package/dist/types/crud.d.ts +0 -221
- package/dist/types/data-providers/axiosDataProvider.d.ts +0 -3
- package/dist/types/data-providers/index.d.ts +0 -2
- package/dist/types/data-providers/supabaseDataProvider.d.ts +0 -54
- package/dist/types/types/api.d.ts +0 -60
- package/dist/types/types/crud.d.ts +0 -221
- package/dist/types/types/dataProvider.d.ts +0 -28
- package/dist/types/types/index.d.ts +0 -6
- package/dist/types/types/plugin.d.ts +0 -24
- package/dist/types/utils/cep.d.ts +0 -14
- package/dist/types/utils/csv.d.ts +0 -13
- package/dist/types/utils/dates.d.ts +0 -5
- package/dist/types/utils/fieldMapper.d.ts +0 -20
- package/dist/types/utils/masks.d.ts +0 -8
package/dist/index.js
CHANGED
|
@@ -1,3053 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
import { useToast as aa } from "primevue/usetoast";
|
|
22
|
-
import { useConfirm as na } from "primevue/useconfirm";
|
|
23
|
-
import oa from "primevue/inputgroup";
|
|
24
|
-
import ht from "primevue/inputgroupaddon";
|
|
25
|
-
import Ze from "primevue/skeleton";
|
|
26
|
-
const la = Symbol("w-axios"), at = Symbol("w-data-provider"), nt = Symbol("w-config");
|
|
27
|
-
function sa(e) {
|
|
28
|
-
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
29
|
-
}
|
|
30
|
-
var _e = { exports: {} }, ia = _e.exports, yt;
|
|
31
|
-
function ra() {
|
|
32
|
-
return yt || (yt = 1, (function(e, a) {
|
|
33
|
-
(function(t, n) {
|
|
34
|
-
e.exports = n();
|
|
35
|
-
})(ia, (function() {
|
|
36
|
-
var t = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, n = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, s = /\d/, r = /\d\d/, u = /\d\d?/, b = /\d*[^-_:/,()\s\d]+/, d = {}, x = function(v) {
|
|
37
|
-
return (v = +v) + (v > 68 ? 1900 : 2e3);
|
|
38
|
-
}, F = function(v) {
|
|
39
|
-
return function(D) {
|
|
40
|
-
this[v] = +D;
|
|
41
|
-
};
|
|
42
|
-
}, E = [/[+-]\d\d:?(\d\d)?|Z/, function(v) {
|
|
43
|
-
(this.zone || (this.zone = {})).offset = (function(D) {
|
|
44
|
-
if (!D || D === "Z") return 0;
|
|
45
|
-
var P = D.match(/([+-]|\d\d)/g), V = 60 * P[1] + (+P[2] || 0);
|
|
46
|
-
return V === 0 ? 0 : P[0] === "+" ? -V : V;
|
|
47
|
-
})(v);
|
|
48
|
-
}], z = function(v) {
|
|
49
|
-
var D = d[v];
|
|
50
|
-
return D && (D.indexOf ? D : D.s.concat(D.f));
|
|
51
|
-
}, I = function(v, D) {
|
|
52
|
-
var P, V = d.meridiem;
|
|
53
|
-
if (V) {
|
|
54
|
-
for (var Z = 1; Z <= 24; Z += 1) if (v.indexOf(V(Z, 0, D)) > -1) {
|
|
55
|
-
P = Z > 12;
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
} else P = v === (D ? "pm" : "PM");
|
|
59
|
-
return P;
|
|
60
|
-
}, G = { A: [b, function(v) {
|
|
61
|
-
this.afternoon = I(v, !1);
|
|
62
|
-
}], a: [b, function(v) {
|
|
63
|
-
this.afternoon = I(v, !0);
|
|
64
|
-
}], Q: [s, function(v) {
|
|
65
|
-
this.month = 3 * (v - 1) + 1;
|
|
66
|
-
}], S: [s, function(v) {
|
|
67
|
-
this.milliseconds = 100 * +v;
|
|
68
|
-
}], SS: [r, function(v) {
|
|
69
|
-
this.milliseconds = 10 * +v;
|
|
70
|
-
}], SSS: [/\d{3}/, function(v) {
|
|
71
|
-
this.milliseconds = +v;
|
|
72
|
-
}], s: [u, F("seconds")], ss: [u, F("seconds")], m: [u, F("minutes")], mm: [u, F("minutes")], H: [u, F("hours")], h: [u, F("hours")], HH: [u, F("hours")], hh: [u, F("hours")], D: [u, F("day")], DD: [r, F("day")], Do: [b, function(v) {
|
|
73
|
-
var D = d.ordinal, P = v.match(/\d+/);
|
|
74
|
-
if (this.day = P[0], D) for (var V = 1; V <= 31; V += 1) D(V).replace(/\[|\]/g, "") === v && (this.day = V);
|
|
75
|
-
}], w: [u, F("week")], ww: [r, F("week")], M: [u, F("month")], MM: [r, F("month")], MMM: [b, function(v) {
|
|
76
|
-
var D = z("months"), P = (z("monthsShort") || D.map((function(V) {
|
|
77
|
-
return V.slice(0, 3);
|
|
78
|
-
}))).indexOf(v) + 1;
|
|
79
|
-
if (P < 1) throw new Error();
|
|
80
|
-
this.month = P % 12 || P;
|
|
81
|
-
}], MMMM: [b, function(v) {
|
|
82
|
-
var D = z("months").indexOf(v) + 1;
|
|
83
|
-
if (D < 1) throw new Error();
|
|
84
|
-
this.month = D % 12 || D;
|
|
85
|
-
}], Y: [/[+-]?\d+/, F("year")], YY: [r, function(v) {
|
|
86
|
-
this.year = x(v);
|
|
87
|
-
}], YYYY: [/\d{4}/, F("year")], Z: E, ZZ: E };
|
|
88
|
-
function J(v) {
|
|
89
|
-
var D, P;
|
|
90
|
-
D = v, P = d && d.formats;
|
|
91
|
-
for (var V = (v = D.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (function(oe, te, le) {
|
|
92
|
-
var W = le && le.toUpperCase();
|
|
93
|
-
return te || P[le] || t[le] || P[W].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (function(H, c, p) {
|
|
94
|
-
return c || p.slice(1);
|
|
95
|
-
}));
|
|
96
|
-
}))).match(n), Z = V.length, X = 0; X < Z; X += 1) {
|
|
97
|
-
var B = V[X], q = G[B], j = q && q[0], ee = q && q[1];
|
|
98
|
-
V[X] = ee ? { regex: j, parser: ee } : B.replace(/^\[|\]$/g, "");
|
|
99
|
-
}
|
|
100
|
-
return function(oe) {
|
|
101
|
-
for (var te = {}, le = 0, W = 0; le < Z; le += 1) {
|
|
102
|
-
var H = V[le];
|
|
103
|
-
if (typeof H == "string") W += H.length;
|
|
104
|
-
else {
|
|
105
|
-
var c = H.regex, p = H.parser, U = oe.slice(W), l = c.exec(U)[0];
|
|
106
|
-
p.call(te, l), oe = oe.replace(l, "");
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
return (function(f) {
|
|
110
|
-
var k = f.afternoon;
|
|
111
|
-
if (k !== void 0) {
|
|
112
|
-
var o = f.hours;
|
|
113
|
-
k ? o < 12 && (f.hours += 12) : o === 12 && (f.hours = 0), delete f.afternoon;
|
|
114
|
-
}
|
|
115
|
-
})(te), te;
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
return function(v, D, P) {
|
|
119
|
-
P.p.customParseFormat = !0, v && v.parseTwoDigitYear && (x = v.parseTwoDigitYear);
|
|
120
|
-
var V = D.prototype, Z = V.parse;
|
|
121
|
-
V.parse = function(X) {
|
|
122
|
-
var B = X.date, q = X.utc, j = X.args;
|
|
123
|
-
this.$u = q;
|
|
124
|
-
var ee = j[1];
|
|
125
|
-
if (typeof ee == "string") {
|
|
126
|
-
var oe = j[2] === !0, te = j[3] === !0, le = oe || te, W = j[2];
|
|
127
|
-
te && (W = j[2]), d = this.$locale(), !oe && W && (d = P.Ls[W]), this.$d = (function(U, l, f, k) {
|
|
128
|
-
try {
|
|
129
|
-
if (["x", "X"].indexOf(l) > -1) return new Date((l === "X" ? 1e3 : 1) * U);
|
|
130
|
-
var o = J(l)(U), $ = o.year, ue = o.month, me = o.day, ke = o.hours, ne = o.minutes, de = o.seconds, pe = o.milliseconds, De = o.zone, Ne = o.week, Re = /* @__PURE__ */ new Date(), be = me || ($ || ue ? 1 : Re.getDate()), Se = $ || Re.getFullYear(), ve = 0;
|
|
131
|
-
$ && !ue || (ve = ue > 0 ? ue - 1 : Re.getMonth());
|
|
132
|
-
var ge, Pe = ke || 0, Ie = ne || 0, Te = de || 0, Ve = pe || 0;
|
|
133
|
-
return De ? new Date(Date.UTC(Se, ve, be, Pe, Ie, Te, Ve + 60 * De.offset * 1e3)) : f ? new Date(Date.UTC(Se, ve, be, Pe, Ie, Te, Ve)) : (ge = new Date(Se, ve, be, Pe, Ie, Te, Ve), Ne && (ge = k(ge).week(Ne).toDate()), ge);
|
|
134
|
-
} catch {
|
|
135
|
-
return /* @__PURE__ */ new Date("");
|
|
136
|
-
}
|
|
137
|
-
})(B, ee, q, P), this.init(), W && W !== !0 && (this.$L = this.locale(W).$L), le && B != this.format(ee) && (this.$d = /* @__PURE__ */ new Date("")), d = {};
|
|
138
|
-
} else if (ee instanceof Array) for (var H = ee.length, c = 1; c <= H; c += 1) {
|
|
139
|
-
j[1] = ee[c - 1];
|
|
140
|
-
var p = P.apply(this, j);
|
|
141
|
-
if (p.isValid()) {
|
|
142
|
-
this.$d = p.$d, this.$L = p.$L, this.init();
|
|
143
|
-
break;
|
|
144
|
-
}
|
|
145
|
-
c === H && (this.$d = /* @__PURE__ */ new Date(""));
|
|
146
|
-
}
|
|
147
|
-
else Z.call(this, X);
|
|
148
|
-
};
|
|
149
|
-
};
|
|
150
|
-
}));
|
|
151
|
-
})(_e)), _e.exports;
|
|
152
|
-
}
|
|
153
|
-
var ua = ra();
|
|
154
|
-
const da = /* @__PURE__ */ sa(ua);
|
|
155
|
-
ze.extend(da);
|
|
156
|
-
function ft(e) {
|
|
157
|
-
if (!e) return null;
|
|
158
|
-
if (e instanceof Date) return e;
|
|
159
|
-
const a = ze(e, "YYYY-MM-DD", !0);
|
|
160
|
-
return a.isValid() ? a.toDate() : ze(e).toDate();
|
|
161
|
-
}
|
|
162
|
-
function Et(e) {
|
|
163
|
-
return e ? typeof e == "string" ? e : ze(e).format("YYYY-MM-DD") : null;
|
|
164
|
-
}
|
|
165
|
-
function Ft(e) {
|
|
166
|
-
return e ? typeof e == "string" ? e : ze(e).toISOString() : null;
|
|
167
|
-
}
|
|
168
|
-
function ca(e, a = "DD/MM/YYYY") {
|
|
169
|
-
return e ? ze(e).format(a) : "—";
|
|
170
|
-
}
|
|
171
|
-
function fa(e) {
|
|
172
|
-
return e ? ze(e).format("DD/MM/YYYY HH:mm") : "—";
|
|
173
|
-
}
|
|
174
|
-
function Ae(e) {
|
|
175
|
-
return e.replace(/\D/g, "");
|
|
176
|
-
}
|
|
177
|
-
function At(e) {
|
|
178
|
-
if (!e) return "—";
|
|
179
|
-
const a = Ae(e);
|
|
180
|
-
return a.length !== 11 ? e : a.replace(/^(\d{3})(\d{3})(\d{3})(\d{2})$/, "$1.$2.$3-$4");
|
|
181
|
-
}
|
|
182
|
-
function Rt(e) {
|
|
183
|
-
if (!e) return "—";
|
|
184
|
-
const a = Ae(e);
|
|
185
|
-
return a.length !== 14 ? e : a.replace(
|
|
186
|
-
/^(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})$/,
|
|
187
|
-
"$1.$2.$3/$4-$5"
|
|
188
|
-
);
|
|
189
|
-
}
|
|
190
|
-
function ma(e) {
|
|
191
|
-
if (!e) return "—";
|
|
192
|
-
const a = Ae(e);
|
|
193
|
-
return a.length === 11 ? At(e) : a.length === 14 ? Rt(e) : e;
|
|
194
|
-
}
|
|
195
|
-
function pa(e) {
|
|
196
|
-
if (!e) return "—";
|
|
197
|
-
const a = Ae(e);
|
|
198
|
-
return a.length === 11 ? a.replace(/^(\d{2})(\d{5})(\d{4})$/, "($1) $2-$3") : a.length === 10 ? a.replace(/^(\d{2})(\d{4})(\d{4})$/, "($1) $2-$3") : e;
|
|
199
|
-
}
|
|
200
|
-
function It(e) {
|
|
201
|
-
if (!e) return null;
|
|
202
|
-
const a = Ae(e);
|
|
203
|
-
if (a.length !== 11) return "CPF deve ter 11 dígitos.";
|
|
204
|
-
if (/^(\d)\1{10}$/.test(a)) return "CPF inválido.";
|
|
205
|
-
let t = 0;
|
|
206
|
-
for (let u = 0; u < 9; u++) t += parseInt(a[u]) * (10 - u);
|
|
207
|
-
let n = t % 11;
|
|
208
|
-
const s = n < 2 ? 0 : 11 - n;
|
|
209
|
-
if (parseInt(a[9]) !== s) return "CPF inválido.";
|
|
210
|
-
t = 0;
|
|
211
|
-
for (let u = 0; u < 10; u++) t += parseInt(a[u]) * (11 - u);
|
|
212
|
-
n = t % 11;
|
|
213
|
-
const r = n < 2 ? 0 : 11 - n;
|
|
214
|
-
return parseInt(a[10]) !== r ? "CPF inválido." : null;
|
|
215
|
-
}
|
|
216
|
-
function Tt(e) {
|
|
217
|
-
if (!e) return null;
|
|
218
|
-
const a = Ae(e);
|
|
219
|
-
if (a.length !== 14) return "CNPJ deve ter 14 dígitos.";
|
|
220
|
-
if (/^(\d)\1{13}$/.test(a)) return "CNPJ inválido.";
|
|
221
|
-
const t = [5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2];
|
|
222
|
-
let n = 0;
|
|
223
|
-
for (let d = 0; d < 12; d++) n += parseInt(a[d]) * t[d];
|
|
224
|
-
let s = n % 11;
|
|
225
|
-
const r = s < 2 ? 0 : 11 - s;
|
|
226
|
-
if (parseInt(a[12]) !== r) return "CNPJ inválido.";
|
|
227
|
-
const u = [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2];
|
|
228
|
-
n = 0;
|
|
229
|
-
for (let d = 0; d < 13; d++) n += parseInt(a[d]) * u[d];
|
|
230
|
-
s = n % 11;
|
|
231
|
-
const b = s < 2 ? 0 : 11 - s;
|
|
232
|
-
return parseInt(a[13]) !== b ? "CNPJ inválido." : null;
|
|
233
|
-
}
|
|
234
|
-
function va(e) {
|
|
235
|
-
if (!e) return null;
|
|
236
|
-
const a = Ae(e);
|
|
237
|
-
return a.length === 11 ? It(e) : a.length === 14 ? Tt(e) : "CPF deve ter 11 dígitos ou CNPJ deve ter 14 dígitos.";
|
|
238
|
-
}
|
|
239
|
-
const et = /* @__PURE__ */ new Map();
|
|
240
|
-
function bt(e, a) {
|
|
241
|
-
const t = `${e}-${a}`;
|
|
242
|
-
let n = et.get(t);
|
|
243
|
-
return n || (n = new Intl.NumberFormat(e, {
|
|
244
|
-
minimumFractionDigits: a,
|
|
245
|
-
maximumFractionDigits: a
|
|
246
|
-
}), et.set(t, n)), n;
|
|
247
|
-
}
|
|
248
|
-
function ga(e, a) {
|
|
249
|
-
const t = `${e}-${a}`;
|
|
250
|
-
let n = et.get(t);
|
|
251
|
-
return n || (n = new Intl.NumberFormat(e, {
|
|
252
|
-
style: "currency",
|
|
253
|
-
currency: a
|
|
254
|
-
}), et.set(t, n)), n;
|
|
255
|
-
}
|
|
256
|
-
function mt() {
|
|
257
|
-
const e = Le(nt, {
|
|
258
|
-
defaultPageSize: 20,
|
|
259
|
-
dateFormat: "DD/MM/YYYY",
|
|
260
|
-
dateTimeFormat: "DD/MM/YYYY HH:mm",
|
|
261
|
-
locale: "pt-BR",
|
|
262
|
-
currency: "BRL"
|
|
263
|
-
}), a = (e == null ? void 0 : e.locale) ?? "pt-BR", t = (e == null ? void 0 : e.currency) ?? "BRL";
|
|
264
|
-
function n(d) {
|
|
265
|
-
return d == null ? "—" : ga(a, t).format(d);
|
|
266
|
-
}
|
|
267
|
-
function s(d, x = 2) {
|
|
268
|
-
return d == null ? "—" : bt(a, x).format(d);
|
|
269
|
-
}
|
|
270
|
-
function r(d, x) {
|
|
271
|
-
return ca(d, x ?? (e == null ? void 0 : e.dateFormat) ?? "DD/MM/YYYY");
|
|
272
|
-
}
|
|
273
|
-
function u(d) {
|
|
274
|
-
return fa(d);
|
|
275
|
-
}
|
|
276
|
-
function b(d) {
|
|
277
|
-
return d == null ? "—" : `${bt(a, 2).format(d)}%`;
|
|
278
|
-
}
|
|
279
|
-
return {
|
|
280
|
-
formatCurrency: n,
|
|
281
|
-
formatNumber: s,
|
|
282
|
-
formatDate: r,
|
|
283
|
-
formatDateTime: u,
|
|
284
|
-
formatPercent: b,
|
|
285
|
-
formatCpf: At,
|
|
286
|
-
formatCnpj: Rt,
|
|
287
|
-
formatCpfCnpj: ma,
|
|
288
|
-
formatTelefone: pa,
|
|
289
|
-
validateCpf: It,
|
|
290
|
-
validateCnpj: Tt,
|
|
291
|
-
validateCpfCnpj: va,
|
|
292
|
-
parseDate: ft,
|
|
293
|
-
toDateString: Et,
|
|
294
|
-
toDateTimeString: Ft
|
|
295
|
-
};
|
|
296
|
-
}
|
|
297
|
-
const ha = {
|
|
298
|
-
key: 0,
|
|
299
|
-
class: "text-muted-color text-xs"
|
|
300
|
-
}, ya = ["src", "alt"], ba = {
|
|
301
|
-
key: 3,
|
|
302
|
-
class: "text-muted-color tabular-nums text-[0.8125rem]"
|
|
303
|
-
}, wa = {
|
|
304
|
-
key: 4,
|
|
305
|
-
class: "text-muted-color tabular-nums text-[0.8125rem]"
|
|
306
|
-
}, ka = {
|
|
307
|
-
key: 5,
|
|
308
|
-
class: "font-semibold tabular-nums text-[0.8125rem]"
|
|
309
|
-
}, $a = {
|
|
310
|
-
key: 6,
|
|
311
|
-
class: "font-semibold tabular-nums text-[0.8125rem]"
|
|
312
|
-
}, Ca = {
|
|
313
|
-
key: 7,
|
|
314
|
-
class: "text-[0.8125rem]"
|
|
315
|
-
}, tt = /* @__PURE__ */ fe({
|
|
316
|
-
__name: "WCrudColumnRenderer",
|
|
317
|
-
props: {
|
|
318
|
-
column: {},
|
|
319
|
-
value: {},
|
|
320
|
-
rowData: {}
|
|
321
|
-
},
|
|
322
|
-
setup(e) {
|
|
323
|
-
const { formatDate: a, formatDateTime: t, formatCurrency: n, formatNumber: s } = mt();
|
|
324
|
-
return (r, u) => e.value == null ? (i(), m("span", ha, "—")) : e.column.type === "image" ? (i(), m("img", {
|
|
325
|
-
key: 1,
|
|
326
|
-
src: String(e.value),
|
|
327
|
-
alt: e.column.header,
|
|
328
|
-
class: "size-9 rounded-lg object-cover ring-1 ring-surface-200 dark:ring-surface-700"
|
|
329
|
-
}, null, 8, ya)) : e.column.type === "boolean" ? (i(), A(g(Pt), {
|
|
330
|
-
key: 2,
|
|
331
|
-
value: e.column.tagValue ? e.column.tagValue(e.value, e.rowData) : e.value ? "Ativo" : "Inativo",
|
|
332
|
-
severity: e.column.tagSeverity ? e.column.tagSeverity(e.value, e.rowData) : e.value ? "success" : "danger",
|
|
333
|
-
class: "text-xs"
|
|
334
|
-
}, null, 8, ["value", "severity"])) : e.column.type === "date" ? (i(), m("span", ba, T(g(a)(e.value)), 1)) : e.column.type === "datetime" ? (i(), m("span", wa, T(g(t)(e.value)), 1)) : e.column.type === "currency" ? (i(), m("span", ka, T(g(n)(e.value)), 1)) : e.column.type === "number" ? (i(), m("span", $a, T(e.column.format ? e.column.format(e.value, e.rowData) : g(s)(e.value, e.column.decimals ?? 0)), 1)) : (i(), m("span", Ca, T(e.column.format ? e.column.format(e.value, e.rowData) : e.value), 1));
|
|
335
|
-
}
|
|
336
|
-
});
|
|
337
|
-
var Da = Object.defineProperty, xa = (e, a, t) => a in e ? Da(e, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[a] = t, Ue = (e, a, t) => xa(e, typeof a != "symbol" ? a + "" : a, t);
|
|
338
|
-
const wt = {
|
|
339
|
-
"#": { pattern: /[0-9]/ },
|
|
340
|
-
"@": { pattern: /[a-zA-Z]/ },
|
|
341
|
-
"*": { pattern: /[a-zA-Z0-9]/ }
|
|
342
|
-
}, kt = (e, a, t) => e.replaceAll(a, "").replace(t, ".").replace("..", ".").replace(/[^.\d]/g, ""), $t = (e, a, t) => {
|
|
343
|
-
var n;
|
|
344
|
-
return new Intl.NumberFormat(((n = t.number) == null ? void 0 : n.locale) ?? "en", {
|
|
345
|
-
minimumFractionDigits: e,
|
|
346
|
-
maximumFractionDigits: a,
|
|
347
|
-
roundingMode: "trunc"
|
|
348
|
-
});
|
|
349
|
-
}, Sa = (e, a = !0, t) => {
|
|
350
|
-
var n, s, r, u;
|
|
351
|
-
const b = ((n = t.number) == null ? void 0 : n.unsigned) !== !0 && e.startsWith("-") ? "-" : "", d = ((s = t.number) == null ? void 0 : s.fraction) ?? 0;
|
|
352
|
-
let x = $t(0, d, t);
|
|
353
|
-
const F = x.formatToParts(1000.12), E = ((r = F.find((v) => v.type === "group")) == null ? void 0 : r.value) ?? " ", z = ((u = F.find((v) => v.type === "decimal")) == null ? void 0 : u.value) ?? ".", I = kt(e, E, z);
|
|
354
|
-
if (Number.isNaN(parseFloat(I))) return b;
|
|
355
|
-
const G = I.split(".");
|
|
356
|
-
if (G[1] != null && G[1].length >= 1) {
|
|
357
|
-
const v = G[1].length <= d ? G[1].length : d;
|
|
358
|
-
x = $t(v, d, t);
|
|
359
|
-
}
|
|
360
|
-
let J = x.format(parseFloat(I));
|
|
361
|
-
return a ? d > 0 && I.endsWith(".") && !I.slice(0, -1).includes(".") && (J += z) : J = kt(J, E, z), b + J;
|
|
362
|
-
}, Lt = (e) => JSON.parse(e.replaceAll("'", '"')), Pa = (e, a = {}) => {
|
|
363
|
-
const t = { ...a };
|
|
364
|
-
e.dataset.maska != null && e.dataset.maska !== "" && (t.mask = Va(e.dataset.maska)), e.dataset.maskaEager != null && (t.eager = Xe(e.dataset.maskaEager)), e.dataset.maskaReversed != null && (t.reversed = Xe(e.dataset.maskaReversed)), e.dataset.maskaTokensReplace != null && (t.tokensReplace = Xe(e.dataset.maskaTokensReplace)), e.dataset.maskaTokens != null && (t.tokens = Ma(e.dataset.maskaTokens));
|
|
365
|
-
const n = {};
|
|
366
|
-
return e.dataset.maskaNumberLocale != null && (n.locale = e.dataset.maskaNumberLocale), e.dataset.maskaNumberFraction != null && (n.fraction = parseInt(e.dataset.maskaNumberFraction)), e.dataset.maskaNumberUnsigned != null && (n.unsigned = Xe(e.dataset.maskaNumberUnsigned)), (e.dataset.maskaNumber != null || Object.values(n).length > 0) && (t.number = n), t;
|
|
367
|
-
}, Xe = (e) => e !== "" ? !!JSON.parse(e) : !0, Va = (e) => e.startsWith("[") && e.endsWith("]") ? Lt(e) : e, Ma = (e) => {
|
|
368
|
-
if (e.startsWith("{") && e.endsWith("}"))
|
|
369
|
-
return Lt(e);
|
|
370
|
-
const a = {};
|
|
371
|
-
return e.split("|").forEach((t) => {
|
|
372
|
-
const n = t.split(":");
|
|
373
|
-
a[n[0]] = {
|
|
374
|
-
pattern: zt() ? new RegExp(n[1], "u") : new RegExp(n[1]),
|
|
375
|
-
optional: n[2] === "optional",
|
|
376
|
-
multiple: n[2] === "multiple",
|
|
377
|
-
repeated: n[2] === "repeated"
|
|
378
|
-
};
|
|
379
|
-
}), a;
|
|
380
|
-
}, zt = () => {
|
|
381
|
-
try {
|
|
382
|
-
return new RegExp("\\p{L}", "u"), !0;
|
|
383
|
-
} catch {
|
|
384
|
-
return !1;
|
|
385
|
-
}
|
|
386
|
-
};
|
|
387
|
-
class Ea {
|
|
388
|
-
constructor(a = {}) {
|
|
389
|
-
Ue(this, "opts", {}), Ue(this, "memo", /* @__PURE__ */ new Map());
|
|
390
|
-
const t = { ...a };
|
|
391
|
-
if (t.tokens != null) {
|
|
392
|
-
t.tokens = t.tokensReplace ? { ...t.tokens } : { ...wt, ...t.tokens };
|
|
393
|
-
for (const n of Object.values(t.tokens))
|
|
394
|
-
typeof n.pattern == "string" && (n.pattern = zt() ? new RegExp(n.pattern, "u") : new RegExp(n.pattern));
|
|
395
|
-
} else
|
|
396
|
-
t.tokens = wt;
|
|
397
|
-
Array.isArray(t.mask) && (t.mask.length > 1 ? t.mask = [...t.mask].sort((n, s) => n.length - s.length) : t.mask = t.mask[0] ?? ""), t.mask === "" && (t.mask = null), this.opts = t;
|
|
398
|
-
}
|
|
399
|
-
masked(a) {
|
|
400
|
-
return this.process(String(a), this.findMask(String(a)));
|
|
401
|
-
}
|
|
402
|
-
unmasked(a) {
|
|
403
|
-
return this.process(String(a), this.findMask(String(a)), !1);
|
|
404
|
-
}
|
|
405
|
-
isEager() {
|
|
406
|
-
return this.opts.eager === !0;
|
|
407
|
-
}
|
|
408
|
-
isReversed() {
|
|
409
|
-
return this.opts.reversed === !0;
|
|
410
|
-
}
|
|
411
|
-
completed(a) {
|
|
412
|
-
const t = this.findMask(String(a));
|
|
413
|
-
if (this.opts.mask == null || t == null) return !1;
|
|
414
|
-
const n = this.process(String(a), t).length;
|
|
415
|
-
return typeof this.opts.mask == "string" ? n >= this.opts.mask.length : n >= t.length;
|
|
416
|
-
}
|
|
417
|
-
findMask(a) {
|
|
418
|
-
const t = this.opts.mask;
|
|
419
|
-
if (t == null)
|
|
420
|
-
return null;
|
|
421
|
-
if (typeof t == "string")
|
|
422
|
-
return t;
|
|
423
|
-
if (typeof t == "function")
|
|
424
|
-
return t(a);
|
|
425
|
-
const n = this.process(a, t.slice(-1).pop() ?? "", !1);
|
|
426
|
-
return t.find((s) => this.process(a, s, !1).length >= n.length) ?? "";
|
|
427
|
-
}
|
|
428
|
-
escapeMask(a) {
|
|
429
|
-
const t = [], n = [];
|
|
430
|
-
return a.split("").forEach((s, r) => {
|
|
431
|
-
s === "!" && a[r - 1] !== "!" ? n.push(r - n.length) : t.push(s);
|
|
432
|
-
}), { mask: t.join(""), escaped: n };
|
|
433
|
-
}
|
|
434
|
-
process(a, t, n = !0) {
|
|
435
|
-
if (this.opts.number != null) return Sa(a, n, this.opts);
|
|
436
|
-
if (t == null) return a;
|
|
437
|
-
const s = `v=${a},mr=${t},m=${n ? 1 : 0}`;
|
|
438
|
-
if (this.memo.has(s)) return this.memo.get(s);
|
|
439
|
-
const { mask: r, escaped: u } = this.escapeMask(t), b = [], d = this.opts.tokens != null ? this.opts.tokens : {}, x = this.isReversed() ? -1 : 1, F = this.isReversed() ? "unshift" : "push", E = this.isReversed() ? 0 : r.length - 1, z = this.isReversed() ? () => v > -1 && D > -1 : () => v < r.length && D < a.length, I = (V) => !this.isReversed() && V <= E || this.isReversed() && V >= E;
|
|
440
|
-
let G, J = -1, v = this.isReversed() ? r.length - 1 : 0, D = this.isReversed() ? a.length - 1 : 0, P = !1;
|
|
441
|
-
for (; z(); ) {
|
|
442
|
-
const V = r.charAt(v), Z = d[V], X = (Z == null ? void 0 : Z.transform) != null ? Z.transform(a.charAt(D)) : a.charAt(D);
|
|
443
|
-
if (!u.includes(v) && Z != null ? (X.match(Z.pattern) != null ? (b[F](X), Z.repeated ? (J === -1 ? J = v : v === E && v !== J && (v = J - x), E === J && (v -= x)) : Z.multiple && (P = !0, v -= x), v += x) : Z.multiple ? P && (v += x, D -= x, P = !1) : X === G ? G = void 0 : Z.optional && (v += x, D -= x), D += x) : (n && !this.isEager() && b[F](V), X === V && !this.isEager() ? D += x : G = V, this.isEager() || (v += x)), this.isEager())
|
|
444
|
-
for (; I(v) && (d[r.charAt(v)] == null || u.includes(v)); ) {
|
|
445
|
-
if (n) {
|
|
446
|
-
if (b[F](r.charAt(v)), a.charAt(D) === r.charAt(v)) {
|
|
447
|
-
v += x, D += x;
|
|
448
|
-
continue;
|
|
449
|
-
}
|
|
450
|
-
} else r.charAt(v) === a.charAt(D) && (D += x);
|
|
451
|
-
v += x;
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
return this.memo.set(s, b.join("")), this.memo.get(s);
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
class Fa {
|
|
458
|
-
constructor(a, t = {}) {
|
|
459
|
-
Ue(this, "items", /* @__PURE__ */ new Map()), Ue(this, "eventAbortController"), Ue(this, "onInput", (n) => {
|
|
460
|
-
if (n instanceof CustomEvent && n.type === "input" && !n.isTrusted && !n.bubbles)
|
|
461
|
-
return;
|
|
462
|
-
const s = n.target, r = this.items.get(s);
|
|
463
|
-
if (r === void 0) return;
|
|
464
|
-
const u = "inputType" in n && n.inputType.startsWith("delete"), b = r.isEager(), d = u && b && r.unmasked(s.value) === "" ? "" : s.value;
|
|
465
|
-
this.fixCursor(s, u, () => this.setValue(s, d));
|
|
466
|
-
}), this.options = t, this.eventAbortController = new AbortController(), this.init(this.getInputs(a));
|
|
467
|
-
}
|
|
468
|
-
update(a = {}) {
|
|
469
|
-
this.options = { ...a }, this.init(Array.from(this.items.keys()));
|
|
470
|
-
}
|
|
471
|
-
updateValue(a) {
|
|
472
|
-
var t;
|
|
473
|
-
a.value !== "" && a.value !== ((t = this.processInput(a)) == null ? void 0 : t.masked) && this.setValue(a, a.value);
|
|
474
|
-
}
|
|
475
|
-
destroy() {
|
|
476
|
-
this.eventAbortController.abort(), this.items.clear();
|
|
477
|
-
}
|
|
478
|
-
init(a) {
|
|
479
|
-
const t = this.getOptions(this.options);
|
|
480
|
-
for (const n of a) {
|
|
481
|
-
if (!this.items.has(n)) {
|
|
482
|
-
const { signal: r } = this.eventAbortController;
|
|
483
|
-
n.addEventListener("input", this.onInput, { capture: !0, signal: r });
|
|
484
|
-
}
|
|
485
|
-
const s = new Ea(Pa(n, t));
|
|
486
|
-
this.items.set(n, s), queueMicrotask(() => this.updateValue(n)), n.selectionStart === null && s.isEager() && console.warn("Maska: input of `%s` type is not supported", n.type);
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
getInputs(a) {
|
|
490
|
-
return typeof a == "string" ? Array.from(document.querySelectorAll(a)) : "length" in a ? Array.from(a) : [a];
|
|
491
|
-
}
|
|
492
|
-
getOptions(a) {
|
|
493
|
-
const { onMaska: t, preProcess: n, postProcess: s, ...r } = a;
|
|
494
|
-
return r;
|
|
495
|
-
}
|
|
496
|
-
fixCursor(a, t, n) {
|
|
497
|
-
var s, r;
|
|
498
|
-
const u = a.selectionStart, b = a.value;
|
|
499
|
-
if (n(), u === null || u === b.length && !t) return;
|
|
500
|
-
const d = a.value, x = b.slice(0, u), F = d.slice(0, u), E = (s = this.processInput(a, x)) == null ? void 0 : s.unmasked, z = (r = this.processInput(a, F)) == null ? void 0 : r.unmasked;
|
|
501
|
-
if (E === void 0 || z === void 0) return;
|
|
502
|
-
let I = u;
|
|
503
|
-
x !== F && (I += t ? d.length - b.length : E.length - z.length), a.setSelectionRange(I, I);
|
|
504
|
-
}
|
|
505
|
-
setValue(a, t) {
|
|
506
|
-
const n = this.processInput(a, t);
|
|
507
|
-
n !== void 0 && (a.value = n.masked, this.options.onMaska != null && (Array.isArray(this.options.onMaska) ? this.options.onMaska.forEach((s) => s(n)) : this.options.onMaska(n)), a.dispatchEvent(new CustomEvent("maska", { detail: n })), a.dispatchEvent(new CustomEvent("input", { detail: n.masked })));
|
|
508
|
-
}
|
|
509
|
-
processInput(a, t) {
|
|
510
|
-
const n = this.items.get(a);
|
|
511
|
-
if (n === void 0) return;
|
|
512
|
-
let s = t ?? a.value;
|
|
513
|
-
this.options.preProcess != null && (s = this.options.preProcess(s));
|
|
514
|
-
let r = n.masked(s);
|
|
515
|
-
return this.options.postProcess != null && (r = this.options.postProcess(r)), {
|
|
516
|
-
masked: r,
|
|
517
|
-
unmasked: n.unmasked(s),
|
|
518
|
-
completed: n.completed(s)
|
|
519
|
-
};
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
const it = /* @__PURE__ */ new WeakMap(), Aa = (e, a) => {
|
|
523
|
-
if (e.arg == null || e.instance == null) return;
|
|
524
|
-
const t = "setup" in e.instance.$.type;
|
|
525
|
-
e.arg in e.instance ? e.instance[e.arg] = a : t && console.warn("Maska: please expose `%s` using defineExpose", e.arg);
|
|
526
|
-
}, rt = (e, a) => {
|
|
527
|
-
var t;
|
|
528
|
-
const n = e instanceof HTMLInputElement ? e : e.querySelector("input");
|
|
529
|
-
if (n == null || (n == null ? void 0 : n.type) === "file") return;
|
|
530
|
-
let s = {};
|
|
531
|
-
if (a.value != null && (s = typeof a.value == "string" ? { mask: a.value } : { ...a.value }), a.arg != null) {
|
|
532
|
-
const r = (u) => {
|
|
533
|
-
const b = a.modifiers.unmasked ? u.unmasked : a.modifiers.completed ? u.completed : u.masked;
|
|
534
|
-
Aa(a, b);
|
|
535
|
-
};
|
|
536
|
-
s.onMaska = s.onMaska == null ? r : Array.isArray(s.onMaska) ? [...s.onMaska, r] : [s.onMaska, r];
|
|
537
|
-
}
|
|
538
|
-
it.has(n) ? (t = it.get(n)) == null || t.update(s) : it.set(n, new Fa(n, s));
|
|
539
|
-
}, Ra = {
|
|
540
|
-
string: "text",
|
|
541
|
-
integer: "number",
|
|
542
|
-
decimal: "number",
|
|
543
|
-
float: "number",
|
|
544
|
-
boolean: "switch",
|
|
545
|
-
choice: "select",
|
|
546
|
-
fk: "fk",
|
|
547
|
-
date: "date",
|
|
548
|
-
datetime: "datetime",
|
|
549
|
-
email: "email",
|
|
550
|
-
url: "text",
|
|
551
|
-
slug: "text",
|
|
552
|
-
text: "textarea"
|
|
553
|
-
};
|
|
554
|
-
function Ia(e) {
|
|
555
|
-
var n;
|
|
556
|
-
const a = Ra[e.type] ?? "text", t = {
|
|
557
|
-
field: e.name,
|
|
558
|
-
label: e.label,
|
|
559
|
-
type: a,
|
|
560
|
-
required: e.required ?? !1
|
|
561
|
-
};
|
|
562
|
-
return (e.type === "decimal" || e.type === "float") && (t.minFractionDigits = 2, t.maxFractionDigits = 2), e.type === "boolean" && (t.defaultValue = !1), e.type === "choice" && ((n = e.choices) != null && n.length) && (t.options = e.choices.map((s) => ({
|
|
563
|
-
label: s.label,
|
|
564
|
-
value: s.value
|
|
565
|
-
}))), e.type === "fk" && (t.endpoint = e.endpoint, e.option_label && (t.optionLabel = e.option_label), e.option_value && (t.optionValue = e.option_value)), t;
|
|
566
|
-
}
|
|
567
|
-
function Ta(e) {
|
|
568
|
-
return e.filter((a) => !a.read_only && a.name !== "id").map(Ia);
|
|
569
|
-
}
|
|
570
|
-
const La = {
|
|
571
|
-
boolean: "boolean",
|
|
572
|
-
date: "date",
|
|
573
|
-
datetime: "datetime",
|
|
574
|
-
decimal: "number",
|
|
575
|
-
float: "number",
|
|
576
|
-
integer: "number"
|
|
577
|
-
};
|
|
578
|
-
function za(e) {
|
|
579
|
-
return {
|
|
580
|
-
field: e.type === "fk" ? `${e.name}_nome` : e.name,
|
|
581
|
-
header: e.label,
|
|
582
|
-
type: La[e.type],
|
|
583
|
-
sortable: !0
|
|
584
|
-
};
|
|
585
|
-
}
|
|
586
|
-
function Na(e, a = 6) {
|
|
587
|
-
return e.filter((t) => !t.read_only && t.name !== "id").slice(0, a).map(za);
|
|
588
|
-
}
|
|
589
|
-
function Nt() {
|
|
590
|
-
const e = aa();
|
|
591
|
-
function a(r, u = "Sucesso") {
|
|
592
|
-
e.add({ severity: "success", summary: u, detail: r, life: 3e3 });
|
|
593
|
-
}
|
|
594
|
-
function t(r, u = "Erro") {
|
|
595
|
-
e.add({ severity: "error", summary: u, detail: r, life: 5e3 });
|
|
596
|
-
}
|
|
597
|
-
function n(r, u = "Atenção") {
|
|
598
|
-
e.add({ severity: "warn", summary: u, detail: r, life: 4e3 });
|
|
599
|
-
}
|
|
600
|
-
function s(r, u = "Info") {
|
|
601
|
-
e.add({ severity: "info", summary: u, detail: r, life: 3e3 });
|
|
602
|
-
}
|
|
603
|
-
return { success: a, error: t, warn: n, info: s };
|
|
604
|
-
}
|
|
605
|
-
function Yt() {
|
|
606
|
-
const e = na();
|
|
607
|
-
function a(n, s = "Deseja realmente excluir este registro?") {
|
|
608
|
-
e.require({
|
|
609
|
-
message: s,
|
|
610
|
-
header: "Confirmar Exclusão",
|
|
611
|
-
icon: "pi pi-trash",
|
|
612
|
-
rejectLabel: "Cancelar",
|
|
613
|
-
rejectProps: {
|
|
614
|
-
severity: "secondary",
|
|
615
|
-
text: !0
|
|
616
|
-
},
|
|
617
|
-
acceptLabel: "Excluir",
|
|
618
|
-
acceptProps: {
|
|
619
|
-
severity: "danger"
|
|
620
|
-
},
|
|
621
|
-
accept: n
|
|
622
|
-
});
|
|
623
|
-
}
|
|
624
|
-
function t(n, s, r = "Confirmação") {
|
|
625
|
-
e.require({
|
|
626
|
-
message: n,
|
|
627
|
-
header: r,
|
|
628
|
-
icon: "pi pi-question-circle",
|
|
629
|
-
rejectLabel: "Cancelar",
|
|
630
|
-
rejectProps: {
|
|
631
|
-
severity: "secondary",
|
|
632
|
-
text: !0
|
|
633
|
-
},
|
|
634
|
-
acceptLabel: "Confirmar",
|
|
635
|
-
accept: s
|
|
636
|
-
});
|
|
637
|
-
}
|
|
638
|
-
return { confirmDelete: a, confirmAction: t };
|
|
639
|
-
}
|
|
640
|
-
function Ya(e) {
|
|
641
|
-
return e.replace(/_/g, " ").replace(/^\w/, (a) => a.toUpperCase());
|
|
642
|
-
}
|
|
643
|
-
function Oa(e) {
|
|
644
|
-
if (typeof e == "string")
|
|
645
|
-
return e;
|
|
646
|
-
if (Array.isArray(e)) {
|
|
647
|
-
const a = e.filter((t) => typeof t == "string");
|
|
648
|
-
return a.length > 0 ? a.join(" ") : null;
|
|
649
|
-
}
|
|
650
|
-
if (typeof e == "object" && e !== null) {
|
|
651
|
-
const a = e;
|
|
652
|
-
if (Array.isArray(a.non_field_errors) && a.non_field_errors.length > 0)
|
|
653
|
-
return a.non_field_errors.filter((n) => typeof n == "string").join(" ");
|
|
654
|
-
const t = [];
|
|
655
|
-
for (const [n, s] of Object.entries(a)) {
|
|
656
|
-
if (n === "non_field_errors") continue;
|
|
657
|
-
const r = Ya(n);
|
|
658
|
-
if (Array.isArray(s)) {
|
|
659
|
-
const u = s.filter((b) => typeof b == "string");
|
|
660
|
-
u.length > 0 && t.push(`${r}: ${u.join(" ")}`);
|
|
661
|
-
} else typeof s == "string" && t.push(`${r}: ${s}`);
|
|
662
|
-
}
|
|
663
|
-
return t.length > 0 ? t.join(`
|
|
664
|
-
`) : null;
|
|
665
|
-
}
|
|
666
|
-
return null;
|
|
667
|
-
}
|
|
668
|
-
function Ke(e, a = "Erro inesperado") {
|
|
669
|
-
var r;
|
|
670
|
-
if (!e || typeof e != "object") return a;
|
|
671
|
-
const t = e, n = (r = t.response) == null ? void 0 : r.data;
|
|
672
|
-
if (!n || typeof n != "object")
|
|
673
|
-
return t.message || a;
|
|
674
|
-
const s = n.detail ?? n;
|
|
675
|
-
return Oa(s) || a;
|
|
676
|
-
}
|
|
677
|
-
function ql() {
|
|
678
|
-
return { extractApiError: Ke };
|
|
679
|
-
}
|
|
680
|
-
const Ba = { class: "w-autocompletefk" }, ja = ["disabled"], Wa = { class: "w-autocompletefk-toolbar" }, Ua = { class: "w-autocompletefk-toolbar-actions" }, qa = { class: "flex items-center justify-end gap-1" }, Ha = { class: "w-autocompletefk-footer" }, Ot = /* @__PURE__ */ fe({
|
|
681
|
-
__name: "WAutoCompleteFK",
|
|
682
|
-
props: {
|
|
683
|
-
modelValue: {},
|
|
684
|
-
endpoint: {},
|
|
685
|
-
endpointParams: {},
|
|
686
|
-
drilldown: {},
|
|
687
|
-
optionLabel: { default: "nome" },
|
|
688
|
-
optionValue: { default: "id" },
|
|
689
|
-
placeholder: { default: "Buscar..." },
|
|
690
|
-
blockedPlaceholder: {},
|
|
691
|
-
disabled: { type: Boolean, default: !1 },
|
|
692
|
-
showClear: { type: Boolean, default: !0 },
|
|
693
|
-
forceSelection: { type: Boolean, default: !0 },
|
|
694
|
-
columns: {},
|
|
695
|
-
minLength: { default: 0 },
|
|
696
|
-
dialogHeader: {},
|
|
697
|
-
canCreate: { type: Boolean, default: void 0 },
|
|
698
|
-
canEdit: { type: Boolean, default: void 0 },
|
|
699
|
-
canDelete: { type: Boolean, default: void 0 },
|
|
700
|
-
crudFields: {},
|
|
701
|
-
crudColumns: {},
|
|
702
|
-
dialogWidth: { default: "480px" }
|
|
703
|
-
},
|
|
704
|
-
emits: ["update:modelValue"],
|
|
705
|
-
setup(e, { emit: a }) {
|
|
706
|
-
const t = e, n = a, s = Le(at);
|
|
707
|
-
if (!s)
|
|
708
|
-
throw new Error(
|
|
709
|
-
"[wPrimeVueComponents] dataProvider não encontrado. Registre o WPrimeVuePlugin."
|
|
710
|
-
);
|
|
711
|
-
const r = s, u = Nt(), { confirmDelete: b } = Yt(), d = K(null), x = K([]), F = K(!1);
|
|
712
|
-
let E = null;
|
|
713
|
-
function z(y) {
|
|
714
|
-
return y == null || y === "";
|
|
715
|
-
}
|
|
716
|
-
function I(y) {
|
|
717
|
-
if (y && typeof y == "object") {
|
|
718
|
-
const C = y;
|
|
719
|
-
return C.id ?? C.value ?? C;
|
|
720
|
-
}
|
|
721
|
-
return y;
|
|
722
|
-
}
|
|
723
|
-
const G = O(() => {
|
|
724
|
-
const y = t.drilldown;
|
|
725
|
-
return y ? Array.isArray(y) ? y : [y] : [];
|
|
726
|
-
}), J = O(
|
|
727
|
-
() => G.value.some(
|
|
728
|
-
(y) => (y.required ?? !0) && z(I(y.value))
|
|
729
|
-
)
|
|
730
|
-
);
|
|
731
|
-
function v() {
|
|
732
|
-
const y = {};
|
|
733
|
-
for (const C of G.value) {
|
|
734
|
-
const Q = I(C.value);
|
|
735
|
-
z(Q) || (y[C.field] = Q);
|
|
736
|
-
}
|
|
737
|
-
return y;
|
|
738
|
-
}
|
|
739
|
-
const D = O(
|
|
740
|
-
() => J.value && t.blockedPlaceholder ? t.blockedPlaceholder : t.placeholder
|
|
741
|
-
);
|
|
742
|
-
async function P(y) {
|
|
743
|
-
try {
|
|
744
|
-
const C = await r.get(t.endpoint, y);
|
|
745
|
-
d.value = C.data;
|
|
746
|
-
} catch {
|
|
747
|
-
d.value = null;
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
async function V(y) {
|
|
751
|
-
if (J.value) {
|
|
752
|
-
x.value = [];
|
|
753
|
-
return;
|
|
754
|
-
}
|
|
755
|
-
F.value = !0;
|
|
756
|
-
try {
|
|
757
|
-
const C = {
|
|
758
|
-
page_size: 20,
|
|
759
|
-
...t.endpointParams,
|
|
760
|
-
...v()
|
|
761
|
-
};
|
|
762
|
-
y && (C.search = y);
|
|
763
|
-
const Q = await r.list(t.endpoint, C);
|
|
764
|
-
x.value = Q.data;
|
|
765
|
-
} catch {
|
|
766
|
-
x.value = [];
|
|
767
|
-
} finally {
|
|
768
|
-
F.value = !1;
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
function Z(y) {
|
|
772
|
-
const C = y.query || "";
|
|
773
|
-
if (C.length < t.minLength) {
|
|
774
|
-
x.value = [];
|
|
775
|
-
return;
|
|
776
|
-
}
|
|
777
|
-
E && clearTimeout(E), E = setTimeout(() => V(C), 300);
|
|
778
|
-
}
|
|
779
|
-
function X(y) {
|
|
780
|
-
d.value = y.value, n("update:modelValue", y.value);
|
|
781
|
-
}
|
|
782
|
-
function B() {
|
|
783
|
-
d.value = null, n("update:modelValue", null);
|
|
784
|
-
}
|
|
785
|
-
Qe(
|
|
786
|
-
() => t.modelValue,
|
|
787
|
-
async (y) => {
|
|
788
|
-
if (y != null) {
|
|
789
|
-
if (typeof y == "object" && y !== null && t.optionLabel in y) {
|
|
790
|
-
d.value = y;
|
|
791
|
-
return;
|
|
792
|
-
}
|
|
793
|
-
(!d.value || d.value[t.optionValue] !== y) && await P(y);
|
|
794
|
-
} else
|
|
795
|
-
d.value = null;
|
|
796
|
-
},
|
|
797
|
-
{ immediate: !0 }
|
|
798
|
-
);
|
|
799
|
-
const q = K(!1), j = K([]), ee = K(!1), oe = K(""), te = K(1), le = K(15), W = K(0), H = K(null), c = K(null), p = K(0);
|
|
800
|
-
let U = null;
|
|
801
|
-
const l = K([]), f = O(() => {
|
|
802
|
-
var y;
|
|
803
|
-
return (y = t.crudFields) != null && y.length ? !0 : l.value.length > 0;
|
|
804
|
-
}), k = O(() => t.canCreate ?? f.value), o = O(() => t.canEdit ?? f.value), $ = O(() => t.canDelete ?? f.value), ue = O(() => o.value || $.value), me = O(() => {
|
|
805
|
-
var y;
|
|
806
|
-
return (y = t.crudFields) != null && y.length ? t.crudFields : Ta(l.value);
|
|
807
|
-
}), ke = O(() => {
|
|
808
|
-
var y, C;
|
|
809
|
-
return (y = t.crudColumns) != null && y.length ? t.crudColumns : (C = t.columns) != null && C.length ? t.columns.map((Q) => ({
|
|
810
|
-
field: Q.field,
|
|
811
|
-
header: Q.header,
|
|
812
|
-
sortable: !0
|
|
813
|
-
})) : l.value.length ? Na(l.value) : [
|
|
814
|
-
{ field: t.optionLabel, header: t.optionLabel, sortable: !0 }
|
|
815
|
-
];
|
|
816
|
-
});
|
|
817
|
-
async function ne() {
|
|
818
|
-
var y, C, Q;
|
|
819
|
-
if (J.value) {
|
|
820
|
-
j.value = [], W.value = 0;
|
|
821
|
-
return;
|
|
822
|
-
}
|
|
823
|
-
ee.value = !0;
|
|
824
|
-
try {
|
|
825
|
-
const L = {
|
|
826
|
-
page: te.value,
|
|
827
|
-
page_size: le.value,
|
|
828
|
-
...t.endpointParams,
|
|
829
|
-
...v()
|
|
830
|
-
};
|
|
831
|
-
oe.value && (L.search = oe.value), c.value && p.value !== 0 && (L.ordering = p.value === -1 ? `-${c.value}` : c.value);
|
|
832
|
-
const w = await r.list(t.endpoint, L);
|
|
833
|
-
j.value = w.data, W.value = w.rows, (y = w.extras) != null && y.fields && !((C = t.columns) != null && C.length) && !((Q = t.crudFields) != null && Q.length) && (l.value = w.extras.fields);
|
|
834
|
-
} catch {
|
|
835
|
-
j.value = [], W.value = 0;
|
|
836
|
-
} finally {
|
|
837
|
-
ee.value = !1;
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
function de() {
|
|
841
|
-
t.disabled || (oe.value = "", te.value = 1, c.value = null, p.value = 0, H.value = null, q.value = !0, ne());
|
|
842
|
-
}
|
|
843
|
-
function pe(y) {
|
|
844
|
-
te.value = y.page + 1, le.value = y.rows, ne();
|
|
845
|
-
}
|
|
846
|
-
function De(y) {
|
|
847
|
-
c.value = y.sortField ?? null, p.value = y.sortOrder ?? 0, te.value = 1, ne();
|
|
848
|
-
}
|
|
849
|
-
function Ne() {
|
|
850
|
-
H.value && (d.value = H.value, n("update:modelValue", H.value), q.value = !1);
|
|
851
|
-
}
|
|
852
|
-
function Re(y) {
|
|
853
|
-
d.value = y.data, n("update:modelValue", y.data), q.value = !1;
|
|
854
|
-
}
|
|
855
|
-
Qe(oe, () => {
|
|
856
|
-
U && clearTimeout(U), U = setTimeout(() => {
|
|
857
|
-
te.value = 1, ne();
|
|
858
|
-
}, 300);
|
|
859
|
-
}), Qe(
|
|
860
|
-
() => G.value.map((y) => I(y.value)),
|
|
861
|
-
(y, C) => {
|
|
862
|
-
if (q.value && (te.value = 1, ne()), !C) return;
|
|
863
|
-
const Q = y.some((w, M) => w !== C[M]), L = C.some((w) => !z(w));
|
|
864
|
-
Q && L && d.value && (d.value = null, n("update:modelValue", null));
|
|
865
|
-
}
|
|
866
|
-
);
|
|
867
|
-
const be = K(!1), Se = K(!1), ve = K(null), ge = we({}), Pe = O(() => ve.value !== null), Ie = O(
|
|
868
|
-
() => Pe.value ? "Editar Registro" : "Novo Registro"
|
|
869
|
-
);
|
|
870
|
-
function Te() {
|
|
871
|
-
const y = {};
|
|
872
|
-
for (const C of me.value)
|
|
873
|
-
y[C.field] = C.defaultValue !== void 0 ? typeof C.defaultValue == "function" ? C.defaultValue() : C.defaultValue : null;
|
|
874
|
-
return y;
|
|
875
|
-
}
|
|
876
|
-
function Ve() {
|
|
877
|
-
const y = Te();
|
|
878
|
-
for (const C of Object.keys(ge))
|
|
879
|
-
delete ge[C];
|
|
880
|
-
for (const [C, Q] of Object.entries(y))
|
|
881
|
-
ge[C] = Q;
|
|
882
|
-
}
|
|
883
|
-
function Ge() {
|
|
884
|
-
ve.value = null, Ve(), be.value = !0;
|
|
885
|
-
}
|
|
886
|
-
function ot(y) {
|
|
887
|
-
ve.value = y;
|
|
888
|
-
for (const C of me.value)
|
|
889
|
-
ge[C.field] = y[C.field] !== void 0 ? y[C.field] : null;
|
|
890
|
-
be.value = !0;
|
|
891
|
-
}
|
|
892
|
-
function Je(y, C) {
|
|
893
|
-
ge[y] = C;
|
|
894
|
-
}
|
|
895
|
-
async function lt() {
|
|
896
|
-
Se.value = !0;
|
|
897
|
-
try {
|
|
898
|
-
const y = { ...ge };
|
|
899
|
-
for (const Q of me.value) {
|
|
900
|
-
const L = y[Q.field];
|
|
901
|
-
if (Q.type === "fk" && L !== null && typeof L == "object") {
|
|
902
|
-
const w = Q.optionValue || "id";
|
|
903
|
-
y[Q.field] = L[w] ?? L;
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
let C;
|
|
907
|
-
if (Pe.value && ve.value) {
|
|
908
|
-
const Q = ve.value[t.optionValue];
|
|
909
|
-
C = await r.update(
|
|
910
|
-
t.endpoint,
|
|
911
|
-
Q,
|
|
912
|
-
y
|
|
913
|
-
);
|
|
914
|
-
const L = j.value.findIndex((w) => w[t.optionValue] === Q);
|
|
915
|
-
L !== -1 && (j.value[L] = C.data), u.success("Registro atualizado com sucesso");
|
|
916
|
-
} else
|
|
917
|
-
C = await r.create(t.endpoint, y), j.value.unshift(C.data), W.value++, u.success("Registro criado com sucesso");
|
|
918
|
-
be.value = !1, ve.value = null, H.value = C.data;
|
|
919
|
-
} catch (y) {
|
|
920
|
-
u.error(Ke(y, "Erro ao salvar registro"));
|
|
921
|
-
} finally {
|
|
922
|
-
Se.value = !1;
|
|
923
|
-
}
|
|
924
|
-
}
|
|
925
|
-
function st(y) {
|
|
926
|
-
b(async () => {
|
|
927
|
-
try {
|
|
928
|
-
const C = y[t.optionValue];
|
|
929
|
-
await r.delete(t.endpoint, C);
|
|
930
|
-
const Q = j.value.findIndex((L) => L[t.optionValue] === C);
|
|
931
|
-
Q !== -1 && (j.value.splice(Q, 1), W.value--), d.value && d.value[t.optionValue] === C && (d.value = null, n("update:modelValue", null)), H.value && H.value[t.optionValue] === C && (H.value = null), u.success("Registro excluído com sucesso");
|
|
932
|
-
} catch (C) {
|
|
933
|
-
u.error(Ke(C, "Erro ao excluir registro"));
|
|
934
|
-
}
|
|
935
|
-
});
|
|
936
|
-
}
|
|
937
|
-
return (y, C) => {
|
|
938
|
-
const Q = xt("tooltip");
|
|
939
|
-
return i(), m(ie, null, [
|
|
940
|
-
h("div", Ba, [
|
|
941
|
-
Y(g(Mt), {
|
|
942
|
-
"model-value": d.value,
|
|
943
|
-
suggestions: x.value,
|
|
944
|
-
"option-label": e.optionLabel,
|
|
945
|
-
placeholder: D.value,
|
|
946
|
-
disabled: e.disabled,
|
|
947
|
-
"force-selection": e.forceSelection,
|
|
948
|
-
loading: F.value,
|
|
949
|
-
fluid: "",
|
|
950
|
-
onComplete: Z,
|
|
951
|
-
onItemSelect: X,
|
|
952
|
-
onClear: B
|
|
953
|
-
}, null, 8, ["model-value", "suggestions", "option-label", "placeholder", "disabled", "force-selection", "loading"]),
|
|
954
|
-
he((i(), m("button", {
|
|
955
|
-
type: "button",
|
|
956
|
-
disabled: e.disabled,
|
|
957
|
-
class: "w-autocompletefk-trigger",
|
|
958
|
-
onClick: de
|
|
959
|
-
}, [...C[6] || (C[6] = [
|
|
960
|
-
h("i", { class: "pi pi-search" }, null, -1)
|
|
961
|
-
])], 8, ja)), [
|
|
962
|
-
[
|
|
963
|
-
Q,
|
|
964
|
-
"Pesquisar",
|
|
965
|
-
void 0,
|
|
966
|
-
{ top: !0 }
|
|
967
|
-
]
|
|
968
|
-
])
|
|
969
|
-
]),
|
|
970
|
-
Y(g(Vt), {
|
|
971
|
-
visible: q.value,
|
|
972
|
-
"onUpdate:visible": C[4] || (C[4] = (L) => q.value = L),
|
|
973
|
-
header: e.dialogHeader || "Pesquisar",
|
|
974
|
-
style: { width: "80vw" },
|
|
975
|
-
modal: "",
|
|
976
|
-
draggable: !1,
|
|
977
|
-
class: "w-autocompletefk-dialog"
|
|
978
|
-
}, {
|
|
979
|
-
footer: se(() => [
|
|
980
|
-
h("div", Ha, [
|
|
981
|
-
Y(g(ae), {
|
|
982
|
-
label: "Cancelar",
|
|
983
|
-
severity: "secondary",
|
|
984
|
-
text: "",
|
|
985
|
-
onClick: C[3] || (C[3] = (L) => q.value = !1)
|
|
986
|
-
}),
|
|
987
|
-
Y(g(ae), {
|
|
988
|
-
label: "Selecionar",
|
|
989
|
-
icon: "pi pi-check",
|
|
990
|
-
disabled: !H.value,
|
|
991
|
-
onClick: Ne
|
|
992
|
-
}, null, 8, ["disabled"])
|
|
993
|
-
])
|
|
994
|
-
]),
|
|
995
|
-
default: se(() => [
|
|
996
|
-
h("div", Wa, [
|
|
997
|
-
Y(g(qe), { class: "w-autocompletefk-toolbar-search" }, {
|
|
998
|
-
default: se(() => [
|
|
999
|
-
Y(g(He), { class: "pi pi-search" }),
|
|
1000
|
-
Y(g(ye), {
|
|
1001
|
-
modelValue: oe.value,
|
|
1002
|
-
"onUpdate:modelValue": C[0] || (C[0] = (L) => oe.value = L),
|
|
1003
|
-
placeholder: "Pesquisar...",
|
|
1004
|
-
class: "w-full"
|
|
1005
|
-
}, null, 8, ["modelValue"])
|
|
1006
|
-
]),
|
|
1007
|
-
_: 1
|
|
1008
|
-
}),
|
|
1009
|
-
h("div", Ua, [
|
|
1010
|
-
k.value ? (i(), A(g(ae), {
|
|
1011
|
-
key: 0,
|
|
1012
|
-
label: "Novo",
|
|
1013
|
-
icon: "pi pi-plus",
|
|
1014
|
-
size: "small",
|
|
1015
|
-
onClick: Ge
|
|
1016
|
-
})) : S("", !0)
|
|
1017
|
-
])
|
|
1018
|
-
]),
|
|
1019
|
-
Y(g(St), {
|
|
1020
|
-
selection: H.value,
|
|
1021
|
-
"onUpdate:selection": C[1] || (C[1] = (L) => H.value = L),
|
|
1022
|
-
value: j.value,
|
|
1023
|
-
loading: ee.value,
|
|
1024
|
-
paginator: "",
|
|
1025
|
-
lazy: "",
|
|
1026
|
-
"striped-rows": "",
|
|
1027
|
-
"removable-sort": "",
|
|
1028
|
-
size: "small",
|
|
1029
|
-
rows: le.value,
|
|
1030
|
-
"total-records": W.value,
|
|
1031
|
-
"sort-field": c.value ?? void 0,
|
|
1032
|
-
"sort-order": p.value,
|
|
1033
|
-
"selection-mode": "single",
|
|
1034
|
-
"data-key": e.optionValue,
|
|
1035
|
-
onPage: pe,
|
|
1036
|
-
onSort: C[2] || (C[2] = (L) => De({ sortField: L.sortField, sortOrder: L.sortOrder })),
|
|
1037
|
-
onRowDblclick: Re
|
|
1038
|
-
}, {
|
|
1039
|
-
empty: se(() => [...C[7] || (C[7] = [
|
|
1040
|
-
h("div", { class: "w-autocompletefk-empty" }, "Nenhum registro encontrado", -1)
|
|
1041
|
-
])]),
|
|
1042
|
-
default: se(() => [
|
|
1043
|
-
Y(g(Oe), {
|
|
1044
|
-
"selection-mode": "single",
|
|
1045
|
-
"header-style": "width: 3rem"
|
|
1046
|
-
}),
|
|
1047
|
-
(i(!0), m(ie, null, ce(ke.value, (L) => (i(), A(g(Oe), {
|
|
1048
|
-
key: L.field,
|
|
1049
|
-
field: L.field,
|
|
1050
|
-
header: L.header,
|
|
1051
|
-
sortable: L.sortable ?? !0,
|
|
1052
|
-
style: Ce(L.style)
|
|
1053
|
-
}, {
|
|
1054
|
-
body: se(({ data: w }) => [
|
|
1055
|
-
L.type ? (i(), A(tt, {
|
|
1056
|
-
key: 0,
|
|
1057
|
-
column: L,
|
|
1058
|
-
value: w[L.field],
|
|
1059
|
-
"row-data": w
|
|
1060
|
-
}, null, 8, ["column", "value", "row-data"])) : (i(), m(ie, { key: 1 }, [
|
|
1061
|
-
Fe(T(w[L.field]), 1)
|
|
1062
|
-
], 64))
|
|
1063
|
-
]),
|
|
1064
|
-
_: 2
|
|
1065
|
-
}, 1032, ["field", "header", "sortable", "style"]))), 128)),
|
|
1066
|
-
ue.value ? (i(), A(g(Oe), {
|
|
1067
|
-
key: 0,
|
|
1068
|
-
header: "",
|
|
1069
|
-
style: { width: "6rem" }
|
|
1070
|
-
}, {
|
|
1071
|
-
body: se(({ data: L }) => [
|
|
1072
|
-
h("div", qa, [
|
|
1073
|
-
o.value ? he((i(), A(g(ae), {
|
|
1074
|
-
key: 0,
|
|
1075
|
-
icon: "pi pi-pencil",
|
|
1076
|
-
text: "",
|
|
1077
|
-
rounded: "",
|
|
1078
|
-
size: "small",
|
|
1079
|
-
onClick: (w) => ot(L)
|
|
1080
|
-
}, null, 8, ["onClick"])), [
|
|
1081
|
-
[
|
|
1082
|
-
Q,
|
|
1083
|
-
"Editar",
|
|
1084
|
-
void 0,
|
|
1085
|
-
{ top: !0 }
|
|
1086
|
-
]
|
|
1087
|
-
]) : S("", !0),
|
|
1088
|
-
$.value ? he((i(), A(g(ae), {
|
|
1089
|
-
key: 1,
|
|
1090
|
-
icon: "pi pi-trash",
|
|
1091
|
-
text: "",
|
|
1092
|
-
rounded: "",
|
|
1093
|
-
size: "small",
|
|
1094
|
-
severity: "danger",
|
|
1095
|
-
onClick: (w) => st(L)
|
|
1096
|
-
}, null, 8, ["onClick"])), [
|
|
1097
|
-
[
|
|
1098
|
-
Q,
|
|
1099
|
-
"Excluir",
|
|
1100
|
-
void 0,
|
|
1101
|
-
{ top: !0 }
|
|
1102
|
-
]
|
|
1103
|
-
]) : S("", !0)
|
|
1104
|
-
])
|
|
1105
|
-
]),
|
|
1106
|
-
_: 1
|
|
1107
|
-
})) : S("", !0)
|
|
1108
|
-
]),
|
|
1109
|
-
_: 1
|
|
1110
|
-
}, 8, ["selection", "value", "loading", "rows", "total-records", "sort-field", "sort-order", "data-key"])
|
|
1111
|
-
]),
|
|
1112
|
-
_: 1
|
|
1113
|
-
}, 8, ["visible", "header"]),
|
|
1114
|
-
f.value ? (i(), A(pt, {
|
|
1115
|
-
key: 0,
|
|
1116
|
-
visible: be.value,
|
|
1117
|
-
title: Ie.value,
|
|
1118
|
-
fields: me.value,
|
|
1119
|
-
"form-data": ge,
|
|
1120
|
-
"is-editing": Pe.value,
|
|
1121
|
-
saving: Se.value,
|
|
1122
|
-
width: e.dialogWidth,
|
|
1123
|
-
"onUpdate:visible": C[5] || (C[5] = (L) => {
|
|
1124
|
-
be.value = L, L || (ve.value = null);
|
|
1125
|
-
}),
|
|
1126
|
-
"onUpdate:field": Je,
|
|
1127
|
-
onSave: lt
|
|
1128
|
-
}, null, 8, ["visible", "title", "fields", "form-data", "is-editing", "saving", "width"])) : S("", !0)
|
|
1129
|
-
], 64);
|
|
1130
|
-
};
|
|
1131
|
-
}
|
|
1132
|
-
}), Bt = /* @__PURE__ */ fe({
|
|
1133
|
-
__name: "WMoneyInput",
|
|
1134
|
-
props: {
|
|
1135
|
-
modelValue: {},
|
|
1136
|
-
decimals: { default: 2 },
|
|
1137
|
-
currency: { type: Boolean, default: !1 },
|
|
1138
|
-
prefix: {},
|
|
1139
|
-
suffix: {},
|
|
1140
|
-
locale: { default: "pt-BR" },
|
|
1141
|
-
disabled: { type: Boolean, default: !1 },
|
|
1142
|
-
placeholder: {},
|
|
1143
|
-
invalid: { type: Boolean }
|
|
1144
|
-
},
|
|
1145
|
-
emits: ["update:modelValue"],
|
|
1146
|
-
setup(e, { emit: a }) {
|
|
1147
|
-
const t = e, n = a, s = O(
|
|
1148
|
-
() => t.prefix ?? (t.currency ? "R$" : void 0)
|
|
1149
|
-
), r = O(() => !!s.value || !!t.suffix), u = O(() => {
|
|
1150
|
-
const d = t.modelValue;
|
|
1151
|
-
return d == null || Number.isNaN(d) ? "" : new Intl.NumberFormat(t.locale, {
|
|
1152
|
-
minimumFractionDigits: t.decimals,
|
|
1153
|
-
maximumFractionDigits: t.decimals
|
|
1154
|
-
}).format(d);
|
|
1155
|
-
});
|
|
1156
|
-
function b(d) {
|
|
1157
|
-
const x = d.target.value.replace(/\D/g, "");
|
|
1158
|
-
if (!x) {
|
|
1159
|
-
n("update:modelValue", null);
|
|
1160
|
-
return;
|
|
1161
|
-
}
|
|
1162
|
-
const F = Number(x) / Math.pow(10, t.decimals);
|
|
1163
|
-
n("update:modelValue", F);
|
|
1164
|
-
}
|
|
1165
|
-
return (d, x) => r.value ? (i(), A(g(oa), {
|
|
1166
|
-
key: 0,
|
|
1167
|
-
class: "w-money-input"
|
|
1168
|
-
}, {
|
|
1169
|
-
default: se(() => [
|
|
1170
|
-
s.value ? (i(), A(g(ht), { key: 0 }, {
|
|
1171
|
-
default: se(() => [
|
|
1172
|
-
Fe(T(s.value), 1)
|
|
1173
|
-
]),
|
|
1174
|
-
_: 1
|
|
1175
|
-
})) : S("", !0),
|
|
1176
|
-
Y(g(ye), {
|
|
1177
|
-
"model-value": u.value,
|
|
1178
|
-
inputmode: "numeric",
|
|
1179
|
-
class: "w-money-input__field",
|
|
1180
|
-
placeholder: e.placeholder,
|
|
1181
|
-
disabled: e.disabled,
|
|
1182
|
-
invalid: e.invalid,
|
|
1183
|
-
onInput: b
|
|
1184
|
-
}, null, 8, ["model-value", "placeholder", "disabled", "invalid"]),
|
|
1185
|
-
e.suffix ? (i(), A(g(ht), { key: 1 }, {
|
|
1186
|
-
default: se(() => [
|
|
1187
|
-
Fe(T(e.suffix), 1)
|
|
1188
|
-
]),
|
|
1189
|
-
_: 1
|
|
1190
|
-
})) : S("", !0)
|
|
1191
|
-
]),
|
|
1192
|
-
_: 1
|
|
1193
|
-
})) : (i(), A(g(ye), {
|
|
1194
|
-
key: 1,
|
|
1195
|
-
"model-value": u.value,
|
|
1196
|
-
inputmode: "numeric",
|
|
1197
|
-
fluid: "",
|
|
1198
|
-
class: "w-money-input__field",
|
|
1199
|
-
placeholder: e.placeholder,
|
|
1200
|
-
disabled: e.disabled,
|
|
1201
|
-
invalid: e.invalid,
|
|
1202
|
-
onInput: b
|
|
1203
|
-
}, null, 8, ["model-value", "placeholder", "disabled", "invalid"]));
|
|
1204
|
-
}
|
|
1205
|
-
}), Ka = { class: "w-transfer__pane" }, Ga = { class: "w-transfer__head" }, Ja = { class: "w-transfer__count" }, Za = { class: "w-transfer__list" }, Xa = ["onClick"], Qa = {
|
|
1206
|
-
key: 0,
|
|
1207
|
-
class: "w-transfer__empty"
|
|
1208
|
-
}, _a = { class: "w-transfer__controls" }, en = { class: "w-transfer__pane" }, tn = { class: "w-transfer__head" }, an = { class: "w-transfer__count" }, nn = { class: "w-transfer__list" }, on = ["onClick"], ln = {
|
|
1209
|
-
key: 0,
|
|
1210
|
-
class: "w-transfer__empty"
|
|
1211
|
-
}, jt = /* @__PURE__ */ fe({
|
|
1212
|
-
__name: "WTransferList",
|
|
1213
|
-
props: {
|
|
1214
|
-
source: {},
|
|
1215
|
-
selected: { default: () => [] },
|
|
1216
|
-
trackBy: { default: "id" },
|
|
1217
|
-
optionLabel: { default: "nome" },
|
|
1218
|
-
searchFields: {},
|
|
1219
|
-
disabled: { type: Boolean }
|
|
1220
|
-
},
|
|
1221
|
-
emits: ["update:selected"],
|
|
1222
|
-
setup(e, { emit: a }) {
|
|
1223
|
-
const t = e, n = a, s = K(""), r = K(""), u = O(() => new Set(t.selected)), b = O(() => t.searchFields ?? [t.optionLabel]);
|
|
1224
|
-
function d(D) {
|
|
1225
|
-
return D[t.trackBy];
|
|
1226
|
-
}
|
|
1227
|
-
function x(D) {
|
|
1228
|
-
return String(D[t.optionLabel] ?? "");
|
|
1229
|
-
}
|
|
1230
|
-
function F(D, P) {
|
|
1231
|
-
if (!P) return !0;
|
|
1232
|
-
const V = P.toLowerCase();
|
|
1233
|
-
return b.value.some(
|
|
1234
|
-
(Z) => String(D[Z] ?? "").toLowerCase().includes(V)
|
|
1235
|
-
);
|
|
1236
|
-
}
|
|
1237
|
-
const E = O(
|
|
1238
|
-
() => t.source.filter(
|
|
1239
|
-
(D) => !u.value.has(d(D)) && F(D, s.value)
|
|
1240
|
-
)
|
|
1241
|
-
), z = O(
|
|
1242
|
-
() => t.source.filter(
|
|
1243
|
-
(D) => u.value.has(d(D)) && F(D, r.value)
|
|
1244
|
-
)
|
|
1245
|
-
);
|
|
1246
|
-
function I(D) {
|
|
1247
|
-
t.disabled || n("update:selected", [...t.selected, d(D)]);
|
|
1248
|
-
}
|
|
1249
|
-
function G(D) {
|
|
1250
|
-
if (t.disabled) return;
|
|
1251
|
-
const P = d(D);
|
|
1252
|
-
n("update:selected", t.selected.filter((V) => V !== P));
|
|
1253
|
-
}
|
|
1254
|
-
function J() {
|
|
1255
|
-
t.disabled || n("update:selected", t.source.map(d));
|
|
1256
|
-
}
|
|
1257
|
-
function v() {
|
|
1258
|
-
t.disabled || n("update:selected", []);
|
|
1259
|
-
}
|
|
1260
|
-
return (D, P) => (i(), m("div", {
|
|
1261
|
-
class: re(["w-transfer", { "w-transfer--disabled": e.disabled }])
|
|
1262
|
-
}, [
|
|
1263
|
-
h("div", Ka, [
|
|
1264
|
-
h("div", Ga, [
|
|
1265
|
-
P[2] || (P[2] = h("span", { class: "w-transfer__title" }, "Disponíveis", -1)),
|
|
1266
|
-
h("span", Ja, T(E.value.length), 1)
|
|
1267
|
-
]),
|
|
1268
|
-
Y(g(qe), { class: "w-transfer__search" }, {
|
|
1269
|
-
default: se(() => [
|
|
1270
|
-
Y(g(He), { class: "pi pi-search" }),
|
|
1271
|
-
Y(g(ye), {
|
|
1272
|
-
modelValue: s.value,
|
|
1273
|
-
"onUpdate:modelValue": P[0] || (P[0] = (V) => s.value = V),
|
|
1274
|
-
placeholder: "Buscar...",
|
|
1275
|
-
fluid: ""
|
|
1276
|
-
}, null, 8, ["modelValue"])
|
|
1277
|
-
]),
|
|
1278
|
-
_: 1
|
|
1279
|
-
}),
|
|
1280
|
-
h("ul", Za, [
|
|
1281
|
-
(i(!0), m(ie, null, ce(E.value, (V) => (i(), m("li", {
|
|
1282
|
-
key: `a-${d(V)}`,
|
|
1283
|
-
class: "w-transfer__item",
|
|
1284
|
-
onClick: (Z) => I(V)
|
|
1285
|
-
}, [
|
|
1286
|
-
h("span", null, T(x(V)), 1),
|
|
1287
|
-
P[3] || (P[3] = h("i", { class: "pi pi-angle-right" }, null, -1))
|
|
1288
|
-
], 8, Xa))), 128)),
|
|
1289
|
-
E.value.length ? S("", !0) : (i(), m("li", Qa, "Nenhum item"))
|
|
1290
|
-
])
|
|
1291
|
-
]),
|
|
1292
|
-
h("div", _a, [
|
|
1293
|
-
Y(g(ae), {
|
|
1294
|
-
type: "button",
|
|
1295
|
-
icon: "pi pi-angle-double-right",
|
|
1296
|
-
text: "",
|
|
1297
|
-
rounded: "",
|
|
1298
|
-
disabled: e.disabled || !E.value.length,
|
|
1299
|
-
onClick: J
|
|
1300
|
-
}, null, 8, ["disabled"]),
|
|
1301
|
-
Y(g(ae), {
|
|
1302
|
-
type: "button",
|
|
1303
|
-
icon: "pi pi-angle-double-left",
|
|
1304
|
-
text: "",
|
|
1305
|
-
rounded: "",
|
|
1306
|
-
disabled: e.disabled || !e.selected.length,
|
|
1307
|
-
onClick: v
|
|
1308
|
-
}, null, 8, ["disabled"])
|
|
1309
|
-
]),
|
|
1310
|
-
h("div", en, [
|
|
1311
|
-
h("div", tn, [
|
|
1312
|
-
P[4] || (P[4] = h("span", { class: "w-transfer__title" }, "Selecionados", -1)),
|
|
1313
|
-
h("span", an, T(z.value.length), 1)
|
|
1314
|
-
]),
|
|
1315
|
-
Y(g(qe), { class: "w-transfer__search" }, {
|
|
1316
|
-
default: se(() => [
|
|
1317
|
-
Y(g(He), { class: "pi pi-search" }),
|
|
1318
|
-
Y(g(ye), {
|
|
1319
|
-
modelValue: r.value,
|
|
1320
|
-
"onUpdate:modelValue": P[1] || (P[1] = (V) => r.value = V),
|
|
1321
|
-
placeholder: "Buscar...",
|
|
1322
|
-
fluid: ""
|
|
1323
|
-
}, null, 8, ["modelValue"])
|
|
1324
|
-
]),
|
|
1325
|
-
_: 1
|
|
1326
|
-
}),
|
|
1327
|
-
h("ul", nn, [
|
|
1328
|
-
(i(!0), m(ie, null, ce(z.value, (V) => (i(), m("li", {
|
|
1329
|
-
key: `s-${d(V)}`,
|
|
1330
|
-
class: "w-transfer__item",
|
|
1331
|
-
onClick: (Z) => G(V)
|
|
1332
|
-
}, [
|
|
1333
|
-
P[5] || (P[5] = h("i", { class: "pi pi-angle-left" }, null, -1)),
|
|
1334
|
-
h("span", null, T(x(V)), 1)
|
|
1335
|
-
], 8, on))), 128)),
|
|
1336
|
-
z.value.length ? S("", !0) : (i(), m("li", ln, "Nenhum item"))
|
|
1337
|
-
])
|
|
1338
|
-
])
|
|
1339
|
-
], 2));
|
|
1340
|
-
}
|
|
1341
|
-
});
|
|
1342
|
-
async function sn(e) {
|
|
1343
|
-
const a = e.replace(/\D/g, "");
|
|
1344
|
-
if (a.length !== 8) return null;
|
|
1345
|
-
try {
|
|
1346
|
-
const t = await fetch(`https://viacep.com.br/ws/${a}/json/`);
|
|
1347
|
-
if (!t.ok) return null;
|
|
1348
|
-
const n = await t.json();
|
|
1349
|
-
return n.erro ? null : n;
|
|
1350
|
-
} catch {
|
|
1351
|
-
return null;
|
|
1352
|
-
}
|
|
1353
|
-
}
|
|
1354
|
-
const rn = { class: "w-crud-form" }, un = {
|
|
1355
|
-
key: 0,
|
|
1356
|
-
class: "w-crud-form-group-header"
|
|
1357
|
-
}, dn = { class: "w-crud-form-group-title" }, cn = {
|
|
1358
|
-
key: 0,
|
|
1359
|
-
class: "w-crud-form-group-desc"
|
|
1360
|
-
}, fn = { class: "w-crud-form-switch-label" }, mn = { class: "w-crud-form-label" }, pn = {
|
|
1361
|
-
key: 0,
|
|
1362
|
-
class: "w-crud-form-required"
|
|
1363
|
-
}, vn = { class: "w-crud-form-color-row" }, gn = { class: "w-crud-form-label" }, hn = ["accept", "disabled", "onChange"], yn = { class: "w-crud-form-label" }, bn = {
|
|
1364
|
-
key: 0,
|
|
1365
|
-
class: "w-crud-form-required"
|
|
1366
|
-
}, wn = { class: "w-crud-form-label" }, kn = {
|
|
1367
|
-
key: 0,
|
|
1368
|
-
class: "w-crud-form-required"
|
|
1369
|
-
}, $n = {
|
|
1370
|
-
key: 1,
|
|
1371
|
-
class: "pi pi-spin pi-spinner w-crud-form-cep-spinner"
|
|
1372
|
-
}, Cn = {
|
|
1373
|
-
key: 16,
|
|
1374
|
-
class: "w-crud-form-cep-error"
|
|
1375
|
-
}, Dn = {
|
|
1376
|
-
key: 17,
|
|
1377
|
-
class: "w-crud-form-error"
|
|
1378
|
-
}, xn = /* @__PURE__ */ fe({
|
|
1379
|
-
__name: "WFormRenderer",
|
|
1380
|
-
props: {
|
|
1381
|
-
fields: {},
|
|
1382
|
-
formData: {},
|
|
1383
|
-
isEditing: { type: Boolean },
|
|
1384
|
-
disabled: { type: Boolean, default: !1 },
|
|
1385
|
-
columns: { default: 2 }
|
|
1386
|
-
},
|
|
1387
|
-
emits: ["update:field"],
|
|
1388
|
-
setup(e, { expose: a, emit: t }) {
|
|
1389
|
-
const n = e, s = t, r = we({}), u = we({}), b = we({}), d = we({});
|
|
1390
|
-
function x(l, f) {
|
|
1391
|
-
const k = f.target.value, o = k.replace(/\D/g, "");
|
|
1392
|
-
s("update:field", l.field, k), b[l.field] = null, d[l.field] && (clearTimeout(d[l.field]), d[l.field] = null), o.length === 8 && (d[l.field] = setTimeout(async () => {
|
|
1393
|
-
u[l.field] = !0, b[l.field] = null;
|
|
1394
|
-
try {
|
|
1395
|
-
const $ = await sn(o);
|
|
1396
|
-
if (!$)
|
|
1397
|
-
b[l.field] = "CEP não encontrado. Preencha os campos manualmente.";
|
|
1398
|
-
else {
|
|
1399
|
-
const ue = l.cepFields || {}, me = Object.keys(ue);
|
|
1400
|
-
for (const ke of me) {
|
|
1401
|
-
const ne = ue[ke];
|
|
1402
|
-
if (!ne) continue;
|
|
1403
|
-
const de = n.formData[ne];
|
|
1404
|
-
(de == null || de === "") && s("update:field", ne, $[ke] ?? "");
|
|
1405
|
-
}
|
|
1406
|
-
}
|
|
1407
|
-
} finally {
|
|
1408
|
-
u[l.field] = !1;
|
|
1409
|
-
}
|
|
1410
|
-
}, 400));
|
|
1411
|
-
}
|
|
1412
|
-
const F = O(
|
|
1413
|
-
() => n.fields.filter((l) => l.visible === void 0 || l.visible === !0 ? !0 : typeof l.visible == "function" ? l.visible(n.formData, n.isEditing) : l.visible)
|
|
1414
|
-
);
|
|
1415
|
-
function E(l) {
|
|
1416
|
-
return n.disabled || l.disabledOnEdit && n.isEditing ? !0 : typeof l.disabled == "function" ? l.disabled(n.formData, n.isEditing) : !!l.disabled;
|
|
1417
|
-
}
|
|
1418
|
-
function z(l) {
|
|
1419
|
-
return Ut(l) ? l.value : l;
|
|
1420
|
-
}
|
|
1421
|
-
const I = O(() => {
|
|
1422
|
-
const l = n.isEditing ? "edit" : "create", f = n.fields.find(
|
|
1423
|
-
(o) => o.autofocus === !0 || o.autofocus === l
|
|
1424
|
-
);
|
|
1425
|
-
if (f) return f.field;
|
|
1426
|
-
const k = F.value.find((o) => !(o.type === "switch" || o.type === "fk" || o.type === "select" || o.type === "image" || o.disabled === !0 || o.disabledOnEdit && n.isEditing));
|
|
1427
|
-
return (k == null ? void 0 : k.field) ?? null;
|
|
1428
|
-
});
|
|
1429
|
-
function G(l) {
|
|
1430
|
-
return l.field === I.value;
|
|
1431
|
-
}
|
|
1432
|
-
function J(l) {
|
|
1433
|
-
if (l)
|
|
1434
|
-
return l.replace(/9/g, "#").replace(/a/g, "S").replace(/\*/g, "X");
|
|
1435
|
-
}
|
|
1436
|
-
function v(l) {
|
|
1437
|
-
if (!l) return "";
|
|
1438
|
-
const f = String(l).replace(/\D/g, "").slice(0, 14);
|
|
1439
|
-
return f.length <= 11 ? f.replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d{1,2})$/, "$1-$2") : f.replace(/(\d{2})(\d)/, "$1.$2").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d)/, "$1/$2").replace(/(\d{4})(\d{1,2})$/, "$1-$2");
|
|
1440
|
-
}
|
|
1441
|
-
function D(l, f) {
|
|
1442
|
-
const k = f.target.value.replace(/\D/g, "").slice(0, 14);
|
|
1443
|
-
s("update:field", l, k);
|
|
1444
|
-
}
|
|
1445
|
-
const P = we({});
|
|
1446
|
-
function V(l) {
|
|
1447
|
-
const f = n.formData[l.field];
|
|
1448
|
-
if (f == null) return null;
|
|
1449
|
-
const k = l.optionValue || "value";
|
|
1450
|
-
return (z(l.options) || []).find(
|
|
1451
|
-
($) => $[k] === f
|
|
1452
|
-
) ?? null;
|
|
1453
|
-
}
|
|
1454
|
-
function Z(l) {
|
|
1455
|
-
return P[l.field] || [];
|
|
1456
|
-
}
|
|
1457
|
-
function X(l, f) {
|
|
1458
|
-
const k = (f.query || "").toLowerCase(), o = z(l.options) || [], $ = l.optionLabel || "label";
|
|
1459
|
-
P[l.field] = o.filter(
|
|
1460
|
-
(ue) => String(ue[$] || "").toLowerCase().includes(k)
|
|
1461
|
-
);
|
|
1462
|
-
}
|
|
1463
|
-
function B(l, f) {
|
|
1464
|
-
const k = l.optionValue || "value";
|
|
1465
|
-
s("update:field", l.field, f.value[k]);
|
|
1466
|
-
}
|
|
1467
|
-
function q(l) {
|
|
1468
|
-
const f = n.formData[l.field];
|
|
1469
|
-
return f ? String(f).replace("#", "") : "FFFFFF";
|
|
1470
|
-
}
|
|
1471
|
-
function j(l, f) {
|
|
1472
|
-
s("update:field", l.field, `#${f}`);
|
|
1473
|
-
}
|
|
1474
|
-
function ee(l) {
|
|
1475
|
-
const f = l.dependsOn;
|
|
1476
|
-
return f ? (Array.isArray(f) ? f : [f]).map((o) => ({
|
|
1477
|
-
field: o.param || o.field,
|
|
1478
|
-
value: n.formData[o.field],
|
|
1479
|
-
required: o.required
|
|
1480
|
-
})) : void 0;
|
|
1481
|
-
}
|
|
1482
|
-
function oe(l) {
|
|
1483
|
-
if (typeof l.validate == "function") {
|
|
1484
|
-
const f = l.validate(n.formData[l.field]);
|
|
1485
|
-
r[l.field] = f || null;
|
|
1486
|
-
}
|
|
1487
|
-
}
|
|
1488
|
-
function te() {
|
|
1489
|
-
const l = [];
|
|
1490
|
-
for (const f of n.fields)
|
|
1491
|
-
if (typeof f.validate == "function") {
|
|
1492
|
-
const k = f.validate(n.formData[f.field]);
|
|
1493
|
-
r[f.field] = k || null, k && l.push(k);
|
|
1494
|
-
}
|
|
1495
|
-
return l;
|
|
1496
|
-
}
|
|
1497
|
-
function le() {
|
|
1498
|
-
Object.keys(r).forEach((l) => delete r[l]);
|
|
1499
|
-
}
|
|
1500
|
-
function W(l) {
|
|
1501
|
-
return Math.max(1, Math.floor(l.columns ?? n.columns));
|
|
1502
|
-
}
|
|
1503
|
-
function H(l, f) {
|
|
1504
|
-
const k = l.colSpan;
|
|
1505
|
-
return k == null || k === "full" ? f : k === 0.5 ? Math.max(1, Math.round(f / 2)) : Math.min(Math.max(1, Math.floor(k)), f);
|
|
1506
|
-
}
|
|
1507
|
-
function c(l, f) {
|
|
1508
|
-
return { "--w-col-span": H(l, W(f)) };
|
|
1509
|
-
}
|
|
1510
|
-
function p(l, f) {
|
|
1511
|
-
return H(l, W(f)) === W(f) ? "w-crud-form-col-full" : "w-crud-form-col-half";
|
|
1512
|
-
}
|
|
1513
|
-
const U = O(() => {
|
|
1514
|
-
var o, $, ue, me, ke;
|
|
1515
|
-
const l = /* @__PURE__ */ new Map(), f = [], k = /* @__PURE__ */ new Map();
|
|
1516
|
-
for (const ne of F.value) {
|
|
1517
|
-
const de = ((o = ne.fieldGroup) == null ? void 0 : o.id) ?? "__default__";
|
|
1518
|
-
l.has(de) || (l.set(de, {
|
|
1519
|
-
id: de,
|
|
1520
|
-
title: ($ = ne.fieldGroup) == null ? void 0 : $.title,
|
|
1521
|
-
description: (ue = ne.fieldGroup) == null ? void 0 : ue.description,
|
|
1522
|
-
columns: (me = ne.fieldGroup) == null ? void 0 : me.columns,
|
|
1523
|
-
fields: []
|
|
1524
|
-
}), f.push(de), ((ke = ne.fieldGroup) == null ? void 0 : ke.order) != null && k.set(de, ne.fieldGroup.order)), l.get(de).fields.push(ne);
|
|
1525
|
-
}
|
|
1526
|
-
return f.slice().sort((ne, de) => {
|
|
1527
|
-
const pe = k.get(ne), De = k.get(de);
|
|
1528
|
-
return pe != null && De != null ? pe - De : pe != null ? -1 : De != null ? 1 : f.indexOf(ne) - f.indexOf(de);
|
|
1529
|
-
}).map((ne) => l.get(ne));
|
|
1530
|
-
});
|
|
1531
|
-
return a({ validateAll: te, clearErrors: le }), (l, f) => (i(), m("div", rn, [
|
|
1532
|
-
(i(!0), m(ie, null, ce(U.value, (k) => (i(), m("div", {
|
|
1533
|
-
key: k.id,
|
|
1534
|
-
class: "w-crud-form-group"
|
|
1535
|
-
}, [
|
|
1536
|
-
k.title ? (i(), m("div", un, [
|
|
1537
|
-
h("h3", dn, T(k.title), 1),
|
|
1538
|
-
k.description ? (i(), m("p", cn, T(k.description), 1)) : S("", !0)
|
|
1539
|
-
])) : S("", !0),
|
|
1540
|
-
h("div", {
|
|
1541
|
-
class: "w-crud-form-fields",
|
|
1542
|
-
style: Ce({ "--w-form-cols": W(k) })
|
|
1543
|
-
}, [
|
|
1544
|
-
(i(!0), m(ie, null, ce(k.fields, (o) => N(l.$slots, `field-${o.field}`, {
|
|
1545
|
-
key: o.field,
|
|
1546
|
-
field: o,
|
|
1547
|
-
formData: e.formData,
|
|
1548
|
-
isEditing: e.isEditing,
|
|
1549
|
-
setFormField: ($, ue) => s("update:field", $, ue)
|
|
1550
|
-
}, () => [
|
|
1551
|
-
o.type === "switch" ? (i(), m("div", {
|
|
1552
|
-
key: 0,
|
|
1553
|
-
class: "w-crud-form-switch",
|
|
1554
|
-
style: Ce(c(o, k))
|
|
1555
|
-
}, [
|
|
1556
|
-
Y(g(_t), {
|
|
1557
|
-
"model-value": e.formData[o.field],
|
|
1558
|
-
disabled: E(o),
|
|
1559
|
-
"onUpdate:modelValue": ($) => s("update:field", o.field, $)
|
|
1560
|
-
}, null, 8, ["model-value", "disabled", "onUpdate:modelValue"]),
|
|
1561
|
-
h("label", fn, T(o.switchLabel || o.label), 1)
|
|
1562
|
-
], 4)) : o.type === "color" ? (i(), m("div", {
|
|
1563
|
-
key: 1,
|
|
1564
|
-
class: re(p(o, k)),
|
|
1565
|
-
style: Ce(c(o, k))
|
|
1566
|
-
}, [
|
|
1567
|
-
h("label", mn, [
|
|
1568
|
-
Fe(T(o.label) + " ", 1),
|
|
1569
|
-
o.required ? (i(), m("span", pn, "*")) : S("", !0)
|
|
1570
|
-
]),
|
|
1571
|
-
h("div", vn, [
|
|
1572
|
-
Y(g(ea), {
|
|
1573
|
-
"model-value": q(o),
|
|
1574
|
-
disabled: E(o),
|
|
1575
|
-
"onUpdate:modelValue": ($) => j(o, $)
|
|
1576
|
-
}, null, 8, ["model-value", "disabled", "onUpdate:modelValue"]),
|
|
1577
|
-
Y(g(ye), {
|
|
1578
|
-
"model-value": e.formData[o.field],
|
|
1579
|
-
class: "w-28",
|
|
1580
|
-
maxlength: "7",
|
|
1581
|
-
placeholder: "#000000",
|
|
1582
|
-
disabled: E(o),
|
|
1583
|
-
"onUpdate:modelValue": ($) => s("update:field", o.field, $)
|
|
1584
|
-
}, null, 8, ["model-value", "disabled", "onUpdate:modelValue"])
|
|
1585
|
-
])
|
|
1586
|
-
], 6)) : o.type === "image" ? (i(), m("div", {
|
|
1587
|
-
key: 2,
|
|
1588
|
-
class: re(p(o, k)),
|
|
1589
|
-
style: Ce(c(o, k))
|
|
1590
|
-
}, [
|
|
1591
|
-
h("label", gn, T(o.label), 1),
|
|
1592
|
-
N(l.$slots, `image-${o.field}`, {
|
|
1593
|
-
field: o,
|
|
1594
|
-
formData: e.formData
|
|
1595
|
-
}, () => [
|
|
1596
|
-
h("input", {
|
|
1597
|
-
type: "file",
|
|
1598
|
-
accept: o.accept || "image/*",
|
|
1599
|
-
disabled: E(o),
|
|
1600
|
-
onChange: ($) => {
|
|
1601
|
-
var me;
|
|
1602
|
-
const ue = ((me = $.target.files) == null ? void 0 : me[0]) ?? null;
|
|
1603
|
-
s("update:field", o.field, ue);
|
|
1604
|
-
}
|
|
1605
|
-
}, null, 40, hn)
|
|
1606
|
-
])
|
|
1607
|
-
], 6)) : o.type === "transfer" ? (i(), m("div", {
|
|
1608
|
-
key: 3,
|
|
1609
|
-
class: re(p(o, k)),
|
|
1610
|
-
style: Ce(c(o, k))
|
|
1611
|
-
}, [
|
|
1612
|
-
h("label", yn, [
|
|
1613
|
-
Fe(T(o.label) + " ", 1),
|
|
1614
|
-
o.required ? (i(), m("span", bn, "*")) : S("", !0)
|
|
1615
|
-
]),
|
|
1616
|
-
Y(jt, {
|
|
1617
|
-
source: z(o.options) || [],
|
|
1618
|
-
selected: e.formData[o.field] || [],
|
|
1619
|
-
"track-by": o.optionValue || "id",
|
|
1620
|
-
"option-label": o.optionLabel || "nome",
|
|
1621
|
-
"search-fields": o.searchFields,
|
|
1622
|
-
disabled: E(o),
|
|
1623
|
-
"onUpdate:selected": ($) => s("update:field", o.field, $)
|
|
1624
|
-
}, null, 8, ["source", "selected", "track-by", "option-label", "search-fields", "disabled", "onUpdate:selected"])
|
|
1625
|
-
], 6)) : (i(), m("div", {
|
|
1626
|
-
key: 4,
|
|
1627
|
-
class: re(p(o, k)),
|
|
1628
|
-
style: Ce(c(o, k))
|
|
1629
|
-
}, [
|
|
1630
|
-
h("label", wn, [
|
|
1631
|
-
Fe(T(o.label) + " ", 1),
|
|
1632
|
-
o.required ? (i(), m("span", kn, "*")) : S("", !0),
|
|
1633
|
-
u[o.field] ? (i(), m("i", $n)) : S("", !0)
|
|
1634
|
-
]),
|
|
1635
|
-
(!o.type || o.type === "text") && o.mask ? he((i(), A(g(ye), {
|
|
1636
|
-
key: 0,
|
|
1637
|
-
"model-value": e.formData[o.field],
|
|
1638
|
-
fluid: "",
|
|
1639
|
-
autofocus: G(o) || void 0,
|
|
1640
|
-
placeholder: o.placeholder,
|
|
1641
|
-
disabled: E(o),
|
|
1642
|
-
"onUpdate:modelValue": ($) => s("update:field", o.field, $)
|
|
1643
|
-
}, null, 8, ["model-value", "autofocus", "placeholder", "disabled", "onUpdate:modelValue"])), [
|
|
1644
|
-
[g(rt), { mask: J(o.mask) }]
|
|
1645
|
-
]) : !o.type || o.type === "text" ? (i(), A(g(ye), {
|
|
1646
|
-
key: 1,
|
|
1647
|
-
"model-value": e.formData[o.field],
|
|
1648
|
-
fluid: "",
|
|
1649
|
-
autofocus: G(o) || void 0,
|
|
1650
|
-
placeholder: o.placeholder,
|
|
1651
|
-
disabled: E(o),
|
|
1652
|
-
"onUpdate:modelValue": ($) => s("update:field", o.field, $)
|
|
1653
|
-
}, null, 8, ["model-value", "autofocus", "placeholder", "disabled", "onUpdate:modelValue"])) : o.type === "email" ? (i(), A(g(ye), {
|
|
1654
|
-
key: 2,
|
|
1655
|
-
"model-value": e.formData[o.field],
|
|
1656
|
-
type: "email",
|
|
1657
|
-
fluid: "",
|
|
1658
|
-
autofocus: G(o) || void 0,
|
|
1659
|
-
placeholder: o.placeholder,
|
|
1660
|
-
disabled: E(o),
|
|
1661
|
-
"onUpdate:modelValue": ($) => s("update:field", o.field, $)
|
|
1662
|
-
}, null, 8, ["model-value", "autofocus", "placeholder", "disabled", "onUpdate:modelValue"])) : o.type === "password" ? (i(), A(g(ta), {
|
|
1663
|
-
key: 3,
|
|
1664
|
-
"model-value": e.formData[o.field],
|
|
1665
|
-
fluid: "",
|
|
1666
|
-
"toggle-mask": "",
|
|
1667
|
-
feedback: o.feedback !== !1,
|
|
1668
|
-
placeholder: o.placeholder,
|
|
1669
|
-
disabled: E(o),
|
|
1670
|
-
"onUpdate:modelValue": ($) => s("update:field", o.field, $)
|
|
1671
|
-
}, null, 8, ["model-value", "feedback", "placeholder", "disabled", "onUpdate:modelValue"])) : o.type === "number" ? (i(), A(g(vt), {
|
|
1672
|
-
key: 4,
|
|
1673
|
-
"model-value": e.formData[o.field],
|
|
1674
|
-
fluid: "",
|
|
1675
|
-
locale: "pt-BR",
|
|
1676
|
-
min: o.min,
|
|
1677
|
-
max: o.max,
|
|
1678
|
-
"min-fraction-digits": o.minFractionDigits,
|
|
1679
|
-
"max-fraction-digits": o.maxFractionDigits,
|
|
1680
|
-
suffix: o.suffix,
|
|
1681
|
-
prefix: o.prefix,
|
|
1682
|
-
placeholder: o.placeholder,
|
|
1683
|
-
disabled: E(o),
|
|
1684
|
-
"onUpdate:modelValue": ($) => s("update:field", o.field, $)
|
|
1685
|
-
}, null, 8, ["model-value", "min", "max", "min-fraction-digits", "max-fraction-digits", "suffix", "prefix", "placeholder", "disabled", "onUpdate:modelValue"])) : o.type === "currency" && o.fillFromRight ? (i(), A(Bt, {
|
|
1686
|
-
key: 5,
|
|
1687
|
-
"model-value": e.formData[o.field],
|
|
1688
|
-
decimals: o.decimals ?? 2,
|
|
1689
|
-
currency: "",
|
|
1690
|
-
prefix: o.prefix,
|
|
1691
|
-
suffix: o.suffix,
|
|
1692
|
-
placeholder: o.placeholder,
|
|
1693
|
-
disabled: E(o),
|
|
1694
|
-
"onUpdate:modelValue": ($) => s("update:field", o.field, $)
|
|
1695
|
-
}, null, 8, ["model-value", "decimals", "prefix", "suffix", "placeholder", "disabled", "onUpdate:modelValue"])) : o.type === "currency" ? (i(), A(g(vt), {
|
|
1696
|
-
key: 6,
|
|
1697
|
-
"model-value": e.formData[o.field],
|
|
1698
|
-
fluid: "",
|
|
1699
|
-
mode: "currency",
|
|
1700
|
-
currency: "BRL",
|
|
1701
|
-
locale: "pt-BR",
|
|
1702
|
-
min: o.min,
|
|
1703
|
-
max: o.max,
|
|
1704
|
-
placeholder: o.placeholder,
|
|
1705
|
-
disabled: E(o),
|
|
1706
|
-
"onUpdate:modelValue": ($) => s("update:field", o.field, $)
|
|
1707
|
-
}, null, 8, ["model-value", "min", "max", "placeholder", "disabled", "onUpdate:modelValue"])) : o.type === "select" ? (i(), A(g(Qt), {
|
|
1708
|
-
key: 7,
|
|
1709
|
-
"model-value": e.formData[o.field],
|
|
1710
|
-
fluid: "",
|
|
1711
|
-
options: z(o.options),
|
|
1712
|
-
"option-label": o.optionLabel || "label",
|
|
1713
|
-
"option-value": o.optionValue || "value",
|
|
1714
|
-
"show-clear": o.showClear !== !1,
|
|
1715
|
-
placeholder: o.placeholder,
|
|
1716
|
-
disabled: E(o),
|
|
1717
|
-
"onUpdate:modelValue": ($) => s("update:field", o.field, $)
|
|
1718
|
-
}, null, 8, ["model-value", "options", "option-label", "option-value", "show-clear", "placeholder", "disabled", "onUpdate:modelValue"])) : o.type === "autocomplete" ? (i(), A(g(Mt), {
|
|
1719
|
-
key: 8,
|
|
1720
|
-
"model-value": V(o),
|
|
1721
|
-
fluid: "",
|
|
1722
|
-
suggestions: Z(o),
|
|
1723
|
-
"option-label": o.optionLabel || "label",
|
|
1724
|
-
placeholder: o.placeholder,
|
|
1725
|
-
disabled: E(o),
|
|
1726
|
-
onComplete: ($) => X(o, $),
|
|
1727
|
-
onItemSelect: ($) => B(o, $),
|
|
1728
|
-
onClear: ($) => s("update:field", o.field, null)
|
|
1729
|
-
}, null, 8, ["model-value", "suggestions", "option-label", "placeholder", "disabled", "onComplete", "onItemSelect", "onClear"])) : o.type === "fk" ? (i(), A(Ot, {
|
|
1730
|
-
key: 9,
|
|
1731
|
-
"model-value": e.formData[o.field],
|
|
1732
|
-
endpoint: o.endpoint,
|
|
1733
|
-
"endpoint-params": o.endpointParams,
|
|
1734
|
-
drilldown: ee(o),
|
|
1735
|
-
"blocked-placeholder": o.blockedPlaceholder,
|
|
1736
|
-
"option-label": o.optionLabel || "nome",
|
|
1737
|
-
placeholder: o.placeholder,
|
|
1738
|
-
disabled: E(o),
|
|
1739
|
-
"show-clear": o.showClear !== !1,
|
|
1740
|
-
"dialog-header": o.label,
|
|
1741
|
-
"crud-fields": o.crudFields,
|
|
1742
|
-
"crud-columns": o.crudColumns,
|
|
1743
|
-
"onUpdate:modelValue": ($) => s("update:field", o.field, $)
|
|
1744
|
-
}, null, 8, ["model-value", "endpoint", "endpoint-params", "drilldown", "blocked-placeholder", "option-label", "placeholder", "disabled", "show-clear", "dialog-header", "crud-fields", "crud-columns", "onUpdate:modelValue"])) : o.type === "date" ? (i(), A(g(gt), {
|
|
1745
|
-
key: 10,
|
|
1746
|
-
"model-value": e.formData[o.field],
|
|
1747
|
-
fluid: "",
|
|
1748
|
-
"date-format": o.dateFormat || "dd/mm/yy",
|
|
1749
|
-
placeholder: o.placeholder,
|
|
1750
|
-
disabled: E(o),
|
|
1751
|
-
"onUpdate:modelValue": ($) => s("update:field", o.field, $)
|
|
1752
|
-
}, null, 8, ["model-value", "date-format", "placeholder", "disabled", "onUpdate:modelValue"])) : o.type === "datetime" ? (i(), A(g(gt), {
|
|
1753
|
-
key: 11,
|
|
1754
|
-
"model-value": e.formData[o.field],
|
|
1755
|
-
fluid: "",
|
|
1756
|
-
"show-time": "",
|
|
1757
|
-
"hour-format": o.hourFormat || "24",
|
|
1758
|
-
"date-format": o.dateFormat || "dd/mm/yy",
|
|
1759
|
-
placeholder: o.placeholder,
|
|
1760
|
-
disabled: E(o),
|
|
1761
|
-
"onUpdate:modelValue": ($) => s("update:field", o.field, $)
|
|
1762
|
-
}, null, 8, ["model-value", "hour-format", "date-format", "placeholder", "disabled", "onUpdate:modelValue"])) : o.type === "cpf_cnpj" ? (i(), A(g(ye), {
|
|
1763
|
-
key: 12,
|
|
1764
|
-
"model-value": v(e.formData[o.field]),
|
|
1765
|
-
fluid: "",
|
|
1766
|
-
maxlength: "18",
|
|
1767
|
-
placeholder: o.placeholder || "000.000.000-00",
|
|
1768
|
-
disabled: E(o),
|
|
1769
|
-
invalid: !!r[o.field],
|
|
1770
|
-
onInput: ($) => D(o.field, $),
|
|
1771
|
-
onBlur: ($) => oe(o)
|
|
1772
|
-
}, null, 8, ["model-value", "placeholder", "disabled", "invalid", "onInput", "onBlur"])) : o.type === "mask" ? he((i(), A(g(ye), {
|
|
1773
|
-
key: 13,
|
|
1774
|
-
"model-value": e.formData[o.field],
|
|
1775
|
-
fluid: "",
|
|
1776
|
-
placeholder: o.placeholder,
|
|
1777
|
-
disabled: E(o),
|
|
1778
|
-
invalid: !!r[o.field],
|
|
1779
|
-
"onUpdate:modelValue": ($) => s("update:field", o.field, $),
|
|
1780
|
-
onBlur: ($) => oe(o)
|
|
1781
|
-
}, null, 8, ["model-value", "placeholder", "disabled", "invalid", "onUpdate:modelValue", "onBlur"])), [
|
|
1782
|
-
[g(rt), { mask: J(o.mask) }]
|
|
1783
|
-
]) : o.type === "cep" ? he((i(), A(g(ye), {
|
|
1784
|
-
key: 14,
|
|
1785
|
-
"model-value": e.formData[o.field],
|
|
1786
|
-
fluid: "",
|
|
1787
|
-
placeholder: o.placeholder || "00000-000",
|
|
1788
|
-
disabled: E(o),
|
|
1789
|
-
invalid: !!b[o.field],
|
|
1790
|
-
onInput: ($) => x(o, $)
|
|
1791
|
-
}, null, 8, ["model-value", "placeholder", "disabled", "invalid", "onInput"])), [
|
|
1792
|
-
[g(rt), { mask: "#####-###" }]
|
|
1793
|
-
]) : o.type === "textarea" ? (i(), A(g(Xt), {
|
|
1794
|
-
key: 15,
|
|
1795
|
-
"model-value": e.formData[o.field],
|
|
1796
|
-
fluid: "",
|
|
1797
|
-
autofocus: G(o) || void 0,
|
|
1798
|
-
rows: o.rows || 3,
|
|
1799
|
-
placeholder: o.placeholder,
|
|
1800
|
-
disabled: E(o),
|
|
1801
|
-
"onUpdate:modelValue": ($) => s("update:field", o.field, $)
|
|
1802
|
-
}, null, 8, ["model-value", "autofocus", "rows", "placeholder", "disabled", "onUpdate:modelValue"])) : S("", !0),
|
|
1803
|
-
b[o.field] ? (i(), m("small", Cn, T(b[o.field]), 1)) : r[o.field] ? (i(), m("small", Dn, T(r[o.field]), 1)) : S("", !0)
|
|
1804
|
-
], 6))
|
|
1805
|
-
])), 128))
|
|
1806
|
-
], 4)
|
|
1807
|
-
]))), 128))
|
|
1808
|
-
]));
|
|
1809
|
-
}
|
|
1810
|
-
}), Sn = { class: "w-crud-form-footer" }, pt = /* @__PURE__ */ fe({
|
|
1811
|
-
__name: "WCrudFormDialog",
|
|
1812
|
-
props: {
|
|
1813
|
-
visible: { type: Boolean },
|
|
1814
|
-
title: {},
|
|
1815
|
-
fields: {},
|
|
1816
|
-
formData: {},
|
|
1817
|
-
isEditing: { type: Boolean },
|
|
1818
|
-
saving: { type: Boolean },
|
|
1819
|
-
disabled: { type: Boolean, default: !1 },
|
|
1820
|
-
width: { default: "480px" },
|
|
1821
|
-
formColumns: { default: void 0 }
|
|
1822
|
-
},
|
|
1823
|
-
emits: ["update:visible", "update:field", "save"],
|
|
1824
|
-
setup(e, { emit: a }) {
|
|
1825
|
-
const t = e, n = a, s = K(null);
|
|
1826
|
-
function r() {
|
|
1827
|
-
s.value ? s.value.validateAll().length === 0 && n("save") : n("save");
|
|
1828
|
-
}
|
|
1829
|
-
return Qe(
|
|
1830
|
-
() => t.visible,
|
|
1831
|
-
(u) => {
|
|
1832
|
-
u && s.value && s.value.clearErrors();
|
|
1833
|
-
}
|
|
1834
|
-
), (u, b) => (i(), A(g(Vt), {
|
|
1835
|
-
visible: e.visible,
|
|
1836
|
-
header: e.title,
|
|
1837
|
-
style: Ce({ width: e.width }),
|
|
1838
|
-
modal: "",
|
|
1839
|
-
draggable: !1,
|
|
1840
|
-
class: "w-crud-form-dialog",
|
|
1841
|
-
"onUpdate:visible": b[2] || (b[2] = (d) => n("update:visible", d))
|
|
1842
|
-
}, {
|
|
1843
|
-
default: se(() => [
|
|
1844
|
-
h("form", {
|
|
1845
|
-
class: "w-crud-form",
|
|
1846
|
-
onSubmit: qt(r, ["prevent"])
|
|
1847
|
-
}, [
|
|
1848
|
-
Y(xn, {
|
|
1849
|
-
ref_key: "rendererRef",
|
|
1850
|
-
ref: s,
|
|
1851
|
-
fields: e.fields,
|
|
1852
|
-
"form-data": e.formData,
|
|
1853
|
-
"is-editing": e.isEditing,
|
|
1854
|
-
disabled: e.disabled,
|
|
1855
|
-
columns: e.formColumns,
|
|
1856
|
-
"onUpdate:field": b[0] || (b[0] = (d, x) => n("update:field", d, x))
|
|
1857
|
-
}, ut({ _: 2 }, [
|
|
1858
|
-
ce(e.fields, (d) => ({
|
|
1859
|
-
name: `field-${d.field}`,
|
|
1860
|
-
fn: se((x) => [
|
|
1861
|
-
N(u.$slots, `field-${d.field}`, dt(ct(x)))
|
|
1862
|
-
])
|
|
1863
|
-
})),
|
|
1864
|
-
ce(e.fields.filter((d) => d.type === "image"), (d) => ({
|
|
1865
|
-
name: `image-${d.field}`,
|
|
1866
|
-
fn: se((x) => [
|
|
1867
|
-
N(u.$slots, `image-${d.field}`, dt(ct(x)))
|
|
1868
|
-
])
|
|
1869
|
-
}))
|
|
1870
|
-
]), 1032, ["fields", "form-data", "is-editing", "disabled", "columns"]),
|
|
1871
|
-
h("div", Sn, [
|
|
1872
|
-
N(u.$slots, "footer", {
|
|
1873
|
-
saving: e.saving,
|
|
1874
|
-
disabled: e.disabled
|
|
1875
|
-
}, () => [
|
|
1876
|
-
Y(g(ae), {
|
|
1877
|
-
type: "button",
|
|
1878
|
-
label: e.disabled ? "Fechar" : "Cancelar",
|
|
1879
|
-
severity: "secondary",
|
|
1880
|
-
text: "",
|
|
1881
|
-
disabled: e.saving,
|
|
1882
|
-
onClick: b[1] || (b[1] = (d) => n("update:visible", !1))
|
|
1883
|
-
}, null, 8, ["label", "disabled"]),
|
|
1884
|
-
e.disabled ? S("", !0) : (i(), A(g(ae), {
|
|
1885
|
-
key: 0,
|
|
1886
|
-
type: "submit",
|
|
1887
|
-
label: e.isEditing ? "Atualizar" : "Salvar",
|
|
1888
|
-
icon: "pi pi-check",
|
|
1889
|
-
loading: e.saving
|
|
1890
|
-
}, null, 8, ["label", "loading"]))
|
|
1891
|
-
])
|
|
1892
|
-
])
|
|
1893
|
-
], 32)
|
|
1894
|
-
]),
|
|
1895
|
-
_: 3
|
|
1896
|
-
}, 8, ["visible", "header", "style"]));
|
|
1897
|
-
}
|
|
1898
|
-
});
|
|
1899
|
-
function Pn(e, a) {
|
|
1900
|
-
const t = a[e.field];
|
|
1901
|
-
return e.format ? e.format(t, a) : t == null ? "" : typeof t == "boolean" ? t ? "Sim" : "Não" : String(t);
|
|
1902
|
-
}
|
|
1903
|
-
function Ct(e, a) {
|
|
1904
|
-
return e.includes('"') || e.includes(a) || e.includes(`
|
|
1905
|
-
`) || e.includes("\r") ? `"${e.replace(/"/g, '""')}"` : e;
|
|
1906
|
-
}
|
|
1907
|
-
function Vn(e, a, t = {}) {
|
|
1908
|
-
const n = t.separator ?? ";", s = a.map((u) => Ct(u.header, n)).join(n), r = e.map(
|
|
1909
|
-
(u) => a.map((b) => Ct(Pn(b, u), n)).join(n)
|
|
1910
|
-
);
|
|
1911
|
-
return "\uFEFF" + [s, ...r].join(`\r
|
|
1912
|
-
`);
|
|
1913
|
-
}
|
|
1914
|
-
function Mn(e, a = "export.csv") {
|
|
1915
|
-
const t = new Blob([e], { type: "text/csv;charset=utf-8;" }), n = URL.createObjectURL(t), s = document.createElement("a");
|
|
1916
|
-
s.href = n, s.download = a, document.body.appendChild(s), s.click(), document.body.removeChild(s), URL.revokeObjectURL(n);
|
|
1917
|
-
}
|
|
1918
|
-
const En = { class: "w-crud" }, Fn = {
|
|
1919
|
-
key: 0,
|
|
1920
|
-
class: "w-crud-header"
|
|
1921
|
-
}, An = { class: "w-crud-header-content" }, Rn = { class: "w-crud-title" }, In = {
|
|
1922
|
-
key: 0,
|
|
1923
|
-
class: "w-crud-subtitle"
|
|
1924
|
-
}, Tn = { class: "w-crud-header-actions" }, Ln = {
|
|
1925
|
-
key: 0,
|
|
1926
|
-
class: "w-crud-kpis"
|
|
1927
|
-
}, zn = { class: "w-crud-kpi-content" }, Nn = { class: "w-crud-kpi-label" }, Yn = { class: "w-crud-kpi-value" }, On = { class: "w-crud-content-main" }, Bn = {
|
|
1928
|
-
key: 0,
|
|
1929
|
-
class: "w-crud-table"
|
|
1930
|
-
}, jn = { class: "w-crud-toolbar" }, Wn = { class: "w-crud-toolbar-start" }, Un = { class: "w-crud-toolbar-end" }, qn = {
|
|
1931
|
-
key: 1,
|
|
1932
|
-
class: "w-crud-view-toggle"
|
|
1933
|
-
}, Hn = { class: "w-crud-actions" }, Kn = {
|
|
1934
|
-
key: 1,
|
|
1935
|
-
class: "w-crud-cards-wrap"
|
|
1936
|
-
}, Gn = { class: "w-crud-toolbar w-crud-toolbar--standalone" }, Jn = { class: "w-crud-toolbar-start" }, Zn = { class: "w-crud-toolbar-end" }, Xn = {
|
|
1937
|
-
key: 1,
|
|
1938
|
-
class: "w-crud-view-toggle"
|
|
1939
|
-
}, Qn = {
|
|
1940
|
-
key: 0,
|
|
1941
|
-
class: "w-crud-cards-loading"
|
|
1942
|
-
}, _n = {
|
|
1943
|
-
key: 2,
|
|
1944
|
-
class: "w-crud-cards"
|
|
1945
|
-
}, eo = ["onClick", "onDblclick", "onContextmenu"], to = { class: "w-crud-card-body" }, ao = {
|
|
1946
|
-
key: 0,
|
|
1947
|
-
class: "w-crud-card-label"
|
|
1948
|
-
}, no = { class: "w-crud-card-value" }, oo = {
|
|
1949
|
-
key: 0,
|
|
1950
|
-
class: "w-crud-card-actions"
|
|
1951
|
-
}, lo = {
|
|
1952
|
-
key: 0,
|
|
1953
|
-
class: "w-crud-rail"
|
|
1954
|
-
}, so = {
|
|
1955
|
-
key: 1,
|
|
1956
|
-
class: "w-crud-rail-sep"
|
|
1957
|
-
}, io = {
|
|
1958
|
-
key: 2,
|
|
1959
|
-
class: "w-crud-rail-sep"
|
|
1960
|
-
}, ro = /* @__PURE__ */ fe({
|
|
1961
|
-
__name: "WCrudView",
|
|
1962
|
-
props: {
|
|
1963
|
-
crud: {},
|
|
1964
|
-
title: {},
|
|
1965
|
-
subtitle: {},
|
|
1966
|
-
showSearch: { type: Boolean, default: !0 },
|
|
1967
|
-
showHeader: { type: Boolean, default: !0 },
|
|
1968
|
-
dialogWidth: { default: "480px" },
|
|
1969
|
-
formColumns: {},
|
|
1970
|
-
autoInit: { type: Boolean, default: !0 },
|
|
1971
|
-
showKpi: { type: Boolean, default: !1 },
|
|
1972
|
-
kpiIcon: { default: "pi pi-list" },
|
|
1973
|
-
kpiLabel: { default: "Total de Registros" },
|
|
1974
|
-
extraKpis: { default: () => [] },
|
|
1975
|
-
expandable: { type: Boolean, default: !1 },
|
|
1976
|
-
viewToggle: { type: Boolean, default: !0 },
|
|
1977
|
-
defaultView: { default: "table" },
|
|
1978
|
-
cardFields: { default: 4 },
|
|
1979
|
-
actionRail: { type: Boolean, default: !0 },
|
|
1980
|
-
contextMenu: { type: Boolean, default: !0 },
|
|
1981
|
-
showPrint: { type: Boolean, default: !1 },
|
|
1982
|
-
exportCsv: { type: Boolean, default: !0 },
|
|
1983
|
-
csvFilename: { default: "export.csv" },
|
|
1984
|
-
csvScope: { default: "all" },
|
|
1985
|
-
csvPageSize: { default: 200 }
|
|
1986
|
-
},
|
|
1987
|
-
emits: ["row-expand", "row-collapse", "print"],
|
|
1988
|
-
setup(e, { emit: a }) {
|
|
1989
|
-
const t = e, n = a, s = Ht(), { formatNumber: r } = mt(), u = K({}), b = K(t.defaultView);
|
|
1990
|
-
function d(c) {
|
|
1991
|
-
return b.value === c;
|
|
1992
|
-
}
|
|
1993
|
-
function x(c) {
|
|
1994
|
-
b.value = c;
|
|
1995
|
-
}
|
|
1996
|
-
const F = O(
|
|
1997
|
-
() => (t.crud.pagination.page - 1) * t.crud.pagination.pageSize
|
|
1998
|
-
), E = O(
|
|
1999
|
-
() => t.crud.config.columns.filter((c) => c.visible !== !1).map((c) => c.type === "number" && !c.align ? { ...c, align: "right" } : c.type === "currency" && !c.align ? { ...c, align: "right" } : c)
|
|
2000
|
-
);
|
|
2001
|
-
function z(c) {
|
|
2002
|
-
if (c.align === "right") return "text-right";
|
|
2003
|
-
if (c.align === "center") return "text-center";
|
|
2004
|
-
}
|
|
2005
|
-
const I = O(() => E.value.slice(0, t.cardFields)), G = O(() => {
|
|
2006
|
-
const c = [];
|
|
2007
|
-
return t.crud.config.canEdit !== !1 && c.push({ action: "edit", icon: "pi pi-pencil", tooltip: "Editar" }), t.crud.config.canCreate !== !1 && c.push({
|
|
2008
|
-
action: "duplicate",
|
|
2009
|
-
icon: "pi pi-copy",
|
|
2010
|
-
tooltip: "Duplicar",
|
|
2011
|
-
severity: "info"
|
|
2012
|
-
}), t.crud.config.canDelete !== !1 && c.push({
|
|
2013
|
-
action: "delete",
|
|
2014
|
-
icon: "pi pi-trash",
|
|
2015
|
-
tooltip: "Excluir",
|
|
2016
|
-
severity: "danger"
|
|
2017
|
-
}), c;
|
|
2018
|
-
}), J = O(
|
|
2019
|
-
() => t.crud.config.rowActions ?? G.value
|
|
2020
|
-
), v = O(() => J.value.length > 0 || !!s["row-actions"]);
|
|
2021
|
-
function D(c, p) {
|
|
2022
|
-
if (c.handler) {
|
|
2023
|
-
c.handler(p);
|
|
2024
|
-
return;
|
|
2025
|
-
}
|
|
2026
|
-
c.action === "edit" ? t.crud.openEditDialog(p) : c.action === "view" ? t.crud.openViewDialog(p) : c.action === "duplicate" ? t.crud.openDuplicateDialog(p) : c.action === "delete" && t.crud.confirmDelete(p);
|
|
2027
|
-
}
|
|
2028
|
-
function P(c, p) {
|
|
2029
|
-
return c.visible ? c.visible(p) : !0;
|
|
2030
|
-
}
|
|
2031
|
-
function V(c, p) {
|
|
2032
|
-
return c.disabled ? c.disabled(p) : !1;
|
|
2033
|
-
}
|
|
2034
|
-
const Z = O(() => {
|
|
2035
|
-
const c = [];
|
|
2036
|
-
return t.showKpi && c.push({
|
|
2037
|
-
icon: t.kpiIcon,
|
|
2038
|
-
label: t.kpiLabel,
|
|
2039
|
-
value: r(t.crud.pagination.rows, 0)
|
|
2040
|
-
}), c.push(...t.extraKpis), c;
|
|
2041
|
-
});
|
|
2042
|
-
O(() => t.crud.config.labels ?? {});
|
|
2043
|
-
const X = O(() => t.crud.config.canCreate !== !1), B = K(null), q = K(null);
|
|
2044
|
-
function j(c) {
|
|
2045
|
-
B.value = c;
|
|
2046
|
-
}
|
|
2047
|
-
function ee(c) {
|
|
2048
|
-
var p;
|
|
2049
|
-
t.contextMenu && (B.value = c.data, (p = q.value) == null || p.show(c.originalEvent));
|
|
2050
|
-
}
|
|
2051
|
-
function oe(c, p) {
|
|
2052
|
-
var U;
|
|
2053
|
-
t.contextMenu && (c.preventDefault(), B.value = p, (U = q.value) == null || U.show(c));
|
|
2054
|
-
}
|
|
2055
|
-
const te = O(() => {
|
|
2056
|
-
const c = B.value;
|
|
2057
|
-
if (!c) return [];
|
|
2058
|
-
const p = [
|
|
2059
|
-
{
|
|
2060
|
-
label: "Ver detalhes",
|
|
2061
|
-
icon: "pi pi-eye",
|
|
2062
|
-
command: () => t.crud.openViewDialog(c)
|
|
2063
|
-
}
|
|
2064
|
-
];
|
|
2065
|
-
for (const U of J.value)
|
|
2066
|
-
P(U, c) && p.push({
|
|
2067
|
-
label: U.tooltip ?? U.action,
|
|
2068
|
-
icon: U.icon,
|
|
2069
|
-
class: U.severity === "danger" ? "w-crud-ctx-danger" : void 0,
|
|
2070
|
-
disabled: V(U, c),
|
|
2071
|
-
command: () => D(U, c)
|
|
2072
|
-
});
|
|
2073
|
-
return t.showPrint && p.push({
|
|
2074
|
-
label: "Imprimir",
|
|
2075
|
-
icon: "pi pi-print",
|
|
2076
|
-
command: () => n("print", c)
|
|
2077
|
-
}), t.exportCsv && (p.push({ separator: !0 }), p.push({
|
|
2078
|
-
label: t.csvScope === "all" ? "Exportar tudo (CSV)" : "Exportar página (CSV)",
|
|
2079
|
-
icon: "pi pi-download",
|
|
2080
|
-
command: () => H()
|
|
2081
|
-
})), p;
|
|
2082
|
-
});
|
|
2083
|
-
function le() {
|
|
2084
|
-
B.value && n("print", B.value);
|
|
2085
|
-
}
|
|
2086
|
-
const W = K(!1);
|
|
2087
|
-
async function H() {
|
|
2088
|
-
if (!W.value) {
|
|
2089
|
-
W.value = !0;
|
|
2090
|
-
try {
|
|
2091
|
-
const c = t.csvScope === "page" ? t.crud.items.value : await t.crud.fetchAll(t.csvPageSize), p = Vn(c, E.value);
|
|
2092
|
-
Mn(p, t.csvFilename);
|
|
2093
|
-
} finally {
|
|
2094
|
-
W.value = !1;
|
|
2095
|
-
}
|
|
2096
|
-
}
|
|
2097
|
-
}
|
|
2098
|
-
return Kt(() => {
|
|
2099
|
-
t.autoInit && t.crud.init();
|
|
2100
|
-
}), (c, p) => {
|
|
2101
|
-
const U = xt("tooltip");
|
|
2102
|
-
return i(), m("div", En, [
|
|
2103
|
-
e.showHeader ? (i(), m("div", Fn, [
|
|
2104
|
-
h("div", An, [
|
|
2105
|
-
h("h1", Rn, T(e.title), 1),
|
|
2106
|
-
e.subtitle ? (i(), m("p", In, T(e.subtitle), 1)) : S("", !0)
|
|
2107
|
-
]),
|
|
2108
|
-
h("div", Tn, [
|
|
2109
|
-
N(c.$slots, "header-actions"),
|
|
2110
|
-
X.value && !e.actionRail ? (i(), A(g(ae), {
|
|
2111
|
-
key: 0,
|
|
2112
|
-
label: "Novo",
|
|
2113
|
-
icon: "pi pi-plus",
|
|
2114
|
-
onClick: p[0] || (p[0] = (l) => e.crud.openCreateDialog())
|
|
2115
|
-
})) : S("", !0)
|
|
2116
|
-
])
|
|
2117
|
-
])) : S("", !0),
|
|
2118
|
-
N(c.$slots, "before-table", {}, () => [
|
|
2119
|
-
Z.value.length ? (i(), m("div", Ln, [
|
|
2120
|
-
(i(!0), m(ie, null, ce(Z.value, (l, f) => (i(), m("div", {
|
|
2121
|
-
key: f,
|
|
2122
|
-
class: "w-crud-kpi"
|
|
2123
|
-
}, [
|
|
2124
|
-
h("div", {
|
|
2125
|
-
class: re(["w-crud-kpi-icon", l.severity ? `w-crud-kpi-icon--${l.severity}` : ""])
|
|
2126
|
-
}, [
|
|
2127
|
-
h("i", {
|
|
2128
|
-
class: re([l.icon]),
|
|
2129
|
-
style: Ce(l.color ? `color: ${l.color}` : "")
|
|
2130
|
-
}, null, 6)
|
|
2131
|
-
], 2),
|
|
2132
|
-
h("div", zn, [
|
|
2133
|
-
h("div", Nn, T(l.label), 1),
|
|
2134
|
-
h("div", Yn, T(l.value), 1)
|
|
2135
|
-
])
|
|
2136
|
-
]))), 128))
|
|
2137
|
-
])) : S("", !0)
|
|
2138
|
-
]),
|
|
2139
|
-
h("div", {
|
|
2140
|
-
class: re(["w-crud-content", { "w-crud-content--rail": e.actionRail }])
|
|
2141
|
-
}, [
|
|
2142
|
-
h("div", On, [
|
|
2143
|
-
b.value === "table" ? (i(), m("div", Bn, [
|
|
2144
|
-
Y(g(St), {
|
|
2145
|
-
value: e.crud.items.value,
|
|
2146
|
-
loading: e.crud.loading.value,
|
|
2147
|
-
"expanded-rows": u.value,
|
|
2148
|
-
"onUpdate:expandedRows": p[4] || (p[4] = (l) => u.value = l),
|
|
2149
|
-
paginator: "",
|
|
2150
|
-
rows: e.crud.pagination.pageSize,
|
|
2151
|
-
"total-records": e.crud.pagination.rows,
|
|
2152
|
-
"rows-per-page-options": [10, 20, 50],
|
|
2153
|
-
"paginator-template": "CurrentPageReport PrevPageLink NextPageLink",
|
|
2154
|
-
"current-page-report-template": "Página {currentPage} de {totalPages}",
|
|
2155
|
-
pt: { pcPaginator: { root: { class: "w-crud-paginator" } } },
|
|
2156
|
-
lazy: "",
|
|
2157
|
-
"striped-rows": "",
|
|
2158
|
-
"removable-sort": "",
|
|
2159
|
-
size: "small",
|
|
2160
|
-
"sort-field": e.crud.sort.field ?? void 0,
|
|
2161
|
-
"sort-order": e.crud.sort.order,
|
|
2162
|
-
"data-key": e.crud.config.pk || "id",
|
|
2163
|
-
selection: e.actionRail || e.contextMenu ? B.value : void 0,
|
|
2164
|
-
"selection-mode": e.actionRail || e.contextMenu ? "single" : void 0,
|
|
2165
|
-
"context-menu": e.contextMenu,
|
|
2166
|
-
"context-menu-selection": e.contextMenu ? B.value : void 0,
|
|
2167
|
-
"onUpdate:selection": p[5] || (p[5] = (l) => B.value = l),
|
|
2168
|
-
"onUpdate:contextMenuSelection": p[6] || (p[6] = (l) => B.value = l),
|
|
2169
|
-
onRowContextmenu: ee,
|
|
2170
|
-
onPage: e.crud.onPage,
|
|
2171
|
-
onSort: p[7] || (p[7] = (l) => e.crud.onSort({ sortField: l.sortField, sortOrder: l.sortOrder })),
|
|
2172
|
-
onRowExpand: p[8] || (p[8] = (l) => n("row-expand", l.data)),
|
|
2173
|
-
onRowCollapse: p[9] || (p[9] = (l) => n("row-collapse", l.data))
|
|
2174
|
-
}, ut({
|
|
2175
|
-
header: se(() => [
|
|
2176
|
-
h("div", jn, [
|
|
2177
|
-
h("div", Wn, [
|
|
2178
|
-
e.showSearch ? (i(), A(g(qe), { key: 0 }, {
|
|
2179
|
-
default: se(() => [
|
|
2180
|
-
Y(g(He), { class: "pi pi-search" }),
|
|
2181
|
-
Y(g(ye), {
|
|
2182
|
-
"model-value": e.crud.search.value,
|
|
2183
|
-
placeholder: "Buscar...",
|
|
2184
|
-
class: "w-72",
|
|
2185
|
-
onInput: e.crud.onSearch
|
|
2186
|
-
}, null, 8, ["model-value", "onInput"])
|
|
2187
|
-
]),
|
|
2188
|
-
_: 1
|
|
2189
|
-
})) : S("", !0),
|
|
2190
|
-
N(c.$slots, "toolbar-start"),
|
|
2191
|
-
N(c.$slots, "toolbar-filters")
|
|
2192
|
-
]),
|
|
2193
|
-
h("div", Un, [
|
|
2194
|
-
N(c.$slots, "toolbar-actions"),
|
|
2195
|
-
e.exportCsv ? he((i(), A(g(ae), {
|
|
2196
|
-
key: 0,
|
|
2197
|
-
icon: "pi pi-download",
|
|
2198
|
-
text: "",
|
|
2199
|
-
size: "small",
|
|
2200
|
-
loading: W.value,
|
|
2201
|
-
onClick: H
|
|
2202
|
-
}, null, 8, ["loading"])), [
|
|
2203
|
-
[
|
|
2204
|
-
U,
|
|
2205
|
-
e.csvScope === "all" ? "Exportar tudo (CSV)" : "Exportar página (CSV)",
|
|
2206
|
-
void 0,
|
|
2207
|
-
{ top: !0 }
|
|
2208
|
-
]
|
|
2209
|
-
]) : S("", !0),
|
|
2210
|
-
e.viewToggle ? (i(), m("div", qn, [
|
|
2211
|
-
Y(g(ae), {
|
|
2212
|
-
icon: "pi pi-table",
|
|
2213
|
-
size: "small",
|
|
2214
|
-
text: !d("table"),
|
|
2215
|
-
outlined: d("table"),
|
|
2216
|
-
onClick: p[1] || (p[1] = (l) => x("table"))
|
|
2217
|
-
}, null, 8, ["text", "outlined"]),
|
|
2218
|
-
Y(g(ae), {
|
|
2219
|
-
icon: "pi pi-th-large",
|
|
2220
|
-
size: "small",
|
|
2221
|
-
text: !d("cards"),
|
|
2222
|
-
outlined: d("cards"),
|
|
2223
|
-
onClick: p[2] || (p[2] = (l) => x("cards"))
|
|
2224
|
-
}, null, 8, ["text", "outlined"])
|
|
2225
|
-
])) : S("", !0),
|
|
2226
|
-
!e.showHeader && X.value && !e.actionRail ? (i(), A(g(ae), {
|
|
2227
|
-
key: 2,
|
|
2228
|
-
label: "Novo",
|
|
2229
|
-
icon: "pi pi-plus",
|
|
2230
|
-
onClick: p[3] || (p[3] = (l) => e.crud.openCreateDialog())
|
|
2231
|
-
})) : S("", !0)
|
|
2232
|
-
])
|
|
2233
|
-
])
|
|
2234
|
-
]),
|
|
2235
|
-
empty: se(() => [
|
|
2236
|
-
N(c.$slots, "empty", {}, () => [
|
|
2237
|
-
p[17] || (p[17] = h("div", { class: "w-crud-empty" }, [
|
|
2238
|
-
h("div", { class: "w-crud-empty-icon" }, [
|
|
2239
|
-
h("i", { class: "pi pi-inbox" })
|
|
2240
|
-
]),
|
|
2241
|
-
h("p", { class: "w-crud-empty-title" }, "Nenhum registro encontrado"),
|
|
2242
|
-
h("p", { class: "w-crud-empty-text" }, "Tente ajustar sua busca ou crie um novo registro")
|
|
2243
|
-
], -1))
|
|
2244
|
-
])
|
|
2245
|
-
]),
|
|
2246
|
-
default: se(() => [
|
|
2247
|
-
e.expandable ? (i(), A(g(Oe), {
|
|
2248
|
-
key: 0,
|
|
2249
|
-
expander: "",
|
|
2250
|
-
style: { width: "3rem" }
|
|
2251
|
-
})) : S("", !0),
|
|
2252
|
-
(i(!0), m(ie, null, ce(E.value, (l) => (i(), A(g(Oe), {
|
|
2253
|
-
key: l.field,
|
|
2254
|
-
field: l.field,
|
|
2255
|
-
header: l.header,
|
|
2256
|
-
sortable: l.sortable,
|
|
2257
|
-
style: Ce(l.style),
|
|
2258
|
-
"header-class": z(l),
|
|
2259
|
-
"body-class": z(l)
|
|
2260
|
-
}, {
|
|
2261
|
-
body: se(({ data: f }) => [
|
|
2262
|
-
N(c.$slots, `column-${l.field}`, {
|
|
2263
|
-
data: f,
|
|
2264
|
-
value: f[l.field]
|
|
2265
|
-
}, () => [
|
|
2266
|
-
Y(tt, {
|
|
2267
|
-
column: l,
|
|
2268
|
-
value: f[l.field],
|
|
2269
|
-
"row-data": f
|
|
2270
|
-
}, null, 8, ["column", "value", "row-data"])
|
|
2271
|
-
])
|
|
2272
|
-
]),
|
|
2273
|
-
_: 2
|
|
2274
|
-
}, 1032, ["field", "header", "sortable", "style", "header-class", "body-class"]))), 128)),
|
|
2275
|
-
v.value && !e.actionRail ? (i(), A(g(Oe), {
|
|
2276
|
-
key: 1,
|
|
2277
|
-
"header-class": "w-crud-actions-header",
|
|
2278
|
-
style: Ce({ width: `${(J.value.length + (g(s)["row-actions"] ? 1 : 0)) * 2.5 + 1}rem` })
|
|
2279
|
-
}, {
|
|
2280
|
-
body: se(({ data: l }) => [
|
|
2281
|
-
h("div", Hn, [
|
|
2282
|
-
(i(!0), m(ie, null, ce(J.value, (f) => (i(), m(ie, {
|
|
2283
|
-
key: f.action
|
|
2284
|
-
}, [
|
|
2285
|
-
P(f, l) ? he((i(), A(g(ae), {
|
|
2286
|
-
key: 0,
|
|
2287
|
-
icon: f.icon,
|
|
2288
|
-
text: "",
|
|
2289
|
-
rounded: "",
|
|
2290
|
-
size: "small",
|
|
2291
|
-
severity: f.severity,
|
|
2292
|
-
disabled: V(f, l),
|
|
2293
|
-
onClick: (k) => D(f, l)
|
|
2294
|
-
}, null, 8, ["icon", "severity", "disabled", "onClick"])), [
|
|
2295
|
-
[
|
|
2296
|
-
U,
|
|
2297
|
-
f.tooltip,
|
|
2298
|
-
void 0,
|
|
2299
|
-
{ top: !0 }
|
|
2300
|
-
]
|
|
2301
|
-
]) : S("", !0)
|
|
2302
|
-
], 64))), 128)),
|
|
2303
|
-
N(c.$slots, "row-actions", {
|
|
2304
|
-
data: l,
|
|
2305
|
-
crud: e.crud
|
|
2306
|
-
})
|
|
2307
|
-
])
|
|
2308
|
-
]),
|
|
2309
|
-
_: 3
|
|
2310
|
-
}, 8, ["style"])) : S("", !0)
|
|
2311
|
-
]),
|
|
2312
|
-
_: 2
|
|
2313
|
-
}, [
|
|
2314
|
-
e.expandable ? {
|
|
2315
|
-
name: "expansion",
|
|
2316
|
-
fn: se((l) => [
|
|
2317
|
-
N(c.$slots, "expansion", {
|
|
2318
|
-
data: l.data
|
|
2319
|
-
})
|
|
2320
|
-
]),
|
|
2321
|
-
key: "0"
|
|
2322
|
-
} : void 0
|
|
2323
|
-
]), 1032, ["value", "loading", "expanded-rows", "rows", "total-records", "sort-field", "sort-order", "data-key", "selection", "selection-mode", "context-menu", "context-menu-selection", "onPage"])
|
|
2324
|
-
])) : (i(), m("div", Kn, [
|
|
2325
|
-
h("div", Gn, [
|
|
2326
|
-
h("div", Jn, [
|
|
2327
|
-
e.showSearch ? (i(), A(g(qe), { key: 0 }, {
|
|
2328
|
-
default: se(() => [
|
|
2329
|
-
Y(g(He), { class: "pi pi-search" }),
|
|
2330
|
-
Y(g(ye), {
|
|
2331
|
-
"model-value": e.crud.search.value,
|
|
2332
|
-
placeholder: "Buscar...",
|
|
2333
|
-
class: "w-72",
|
|
2334
|
-
onInput: e.crud.onSearch
|
|
2335
|
-
}, null, 8, ["model-value", "onInput"])
|
|
2336
|
-
]),
|
|
2337
|
-
_: 1
|
|
2338
|
-
})) : S("", !0),
|
|
2339
|
-
N(c.$slots, "toolbar-start"),
|
|
2340
|
-
N(c.$slots, "toolbar-filters")
|
|
2341
|
-
]),
|
|
2342
|
-
h("div", Zn, [
|
|
2343
|
-
N(c.$slots, "toolbar-actions"),
|
|
2344
|
-
e.exportCsv ? he((i(), A(g(ae), {
|
|
2345
|
-
key: 0,
|
|
2346
|
-
icon: "pi pi-download",
|
|
2347
|
-
text: "",
|
|
2348
|
-
size: "small",
|
|
2349
|
-
loading: W.value,
|
|
2350
|
-
onClick: H
|
|
2351
|
-
}, null, 8, ["loading"])), [
|
|
2352
|
-
[
|
|
2353
|
-
U,
|
|
2354
|
-
e.csvScope === "all" ? "Exportar tudo (CSV)" : "Exportar página (CSV)",
|
|
2355
|
-
void 0,
|
|
2356
|
-
{ top: !0 }
|
|
2357
|
-
]
|
|
2358
|
-
]) : S("", !0),
|
|
2359
|
-
e.viewToggle ? (i(), m("div", Xn, [
|
|
2360
|
-
Y(g(ae), {
|
|
2361
|
-
icon: "pi pi-table",
|
|
2362
|
-
size: "small",
|
|
2363
|
-
text: !d("table"),
|
|
2364
|
-
outlined: d("table"),
|
|
2365
|
-
onClick: p[10] || (p[10] = (l) => x("table"))
|
|
2366
|
-
}, null, 8, ["text", "outlined"]),
|
|
2367
|
-
Y(g(ae), {
|
|
2368
|
-
icon: "pi pi-th-large",
|
|
2369
|
-
size: "small",
|
|
2370
|
-
text: !d("cards"),
|
|
2371
|
-
outlined: d("cards"),
|
|
2372
|
-
onClick: p[11] || (p[11] = (l) => x("cards"))
|
|
2373
|
-
}, null, 8, ["text", "outlined"])
|
|
2374
|
-
])) : S("", !0),
|
|
2375
|
-
!e.showHeader && X.value && !e.actionRail ? (i(), A(g(ae), {
|
|
2376
|
-
key: 2,
|
|
2377
|
-
label: "Novo",
|
|
2378
|
-
icon: "pi pi-plus",
|
|
2379
|
-
onClick: p[12] || (p[12] = (l) => e.crud.openCreateDialog())
|
|
2380
|
-
})) : S("", !0)
|
|
2381
|
-
])
|
|
2382
|
-
]),
|
|
2383
|
-
e.crud.loading.value ? (i(), m("div", Qn, [...p[18] || (p[18] = [
|
|
2384
|
-
h("i", { class: "pi pi-spin pi-spinner" }, null, -1)
|
|
2385
|
-
])])) : e.crud.items.value.length ? (i(), m("div", _n, [
|
|
2386
|
-
(i(!0), m(ie, null, ce(e.crud.items.value, (l, f) => (i(), m("div", {
|
|
2387
|
-
key: l[e.crud.config.pk || "id"] ?? f,
|
|
2388
|
-
class: re(["w-crud-card", { "w-crud-card--selected": B.value === l }]),
|
|
2389
|
-
onClick: (k) => j(l),
|
|
2390
|
-
onDblclick: (k) => e.crud.config.canEdit !== !1 && e.crud.openEditDialog(l),
|
|
2391
|
-
onContextmenu: (k) => oe(k, l)
|
|
2392
|
-
}, [
|
|
2393
|
-
h("div", to, [
|
|
2394
|
-
(i(!0), m(ie, null, ce(I.value, (k, o) => (i(), m("div", {
|
|
2395
|
-
key: k.field,
|
|
2396
|
-
class: re(["w-crud-card-row", { "w-crud-card-row--title": o === 0 }])
|
|
2397
|
-
}, [
|
|
2398
|
-
o !== 0 ? (i(), m("span", ao, T(k.header), 1)) : S("", !0),
|
|
2399
|
-
h("span", no, [
|
|
2400
|
-
N(c.$slots, `column-${k.field}`, {
|
|
2401
|
-
data: l,
|
|
2402
|
-
value: l[k.field]
|
|
2403
|
-
}, () => [
|
|
2404
|
-
Y(tt, {
|
|
2405
|
-
column: k,
|
|
2406
|
-
value: l[k.field],
|
|
2407
|
-
"row-data": l
|
|
2408
|
-
}, null, 8, ["column", "value", "row-data"])
|
|
2409
|
-
])
|
|
2410
|
-
])
|
|
2411
|
-
], 2))), 128))
|
|
2412
|
-
]),
|
|
2413
|
-
v.value && !e.actionRail ? (i(), m("div", oo, [
|
|
2414
|
-
(i(!0), m(ie, null, ce(J.value, (k) => (i(), m(ie, {
|
|
2415
|
-
key: k.action
|
|
2416
|
-
}, [
|
|
2417
|
-
P(k, l) ? he((i(), A(g(ae), {
|
|
2418
|
-
key: 0,
|
|
2419
|
-
icon: k.icon,
|
|
2420
|
-
text: "",
|
|
2421
|
-
rounded: "",
|
|
2422
|
-
size: "small",
|
|
2423
|
-
severity: k.severity,
|
|
2424
|
-
disabled: V(k, l),
|
|
2425
|
-
onClick: (o) => D(k, l)
|
|
2426
|
-
}, null, 8, ["icon", "severity", "disabled", "onClick"])), [
|
|
2427
|
-
[
|
|
2428
|
-
U,
|
|
2429
|
-
k.tooltip,
|
|
2430
|
-
void 0,
|
|
2431
|
-
{ top: !0 }
|
|
2432
|
-
]
|
|
2433
|
-
]) : S("", !0)
|
|
2434
|
-
], 64))), 128)),
|
|
2435
|
-
N(c.$slots, "row-actions", {
|
|
2436
|
-
data: l,
|
|
2437
|
-
crud: e.crud
|
|
2438
|
-
})
|
|
2439
|
-
])) : S("", !0)
|
|
2440
|
-
], 42, eo))), 128))
|
|
2441
|
-
])) : N(c.$slots, "empty", { key: 1 }, () => [
|
|
2442
|
-
p[19] || (p[19] = Gt('<div class="w-crud-empty"><div class="w-crud-empty-icon"><i class="pi pi-inbox"></i></div><p class="w-crud-empty-title">Nenhum registro encontrado</p><p class="w-crud-empty-text">Tente ajustar sua busca ou crie um novo registro</p></div>', 1))
|
|
2443
|
-
]),
|
|
2444
|
-
e.crud.items.value.length ? (i(), A(g(Jt), {
|
|
2445
|
-
key: 3,
|
|
2446
|
-
rows: e.crud.pagination.pageSize,
|
|
2447
|
-
"total-records": e.crud.pagination.rows,
|
|
2448
|
-
first: F.value,
|
|
2449
|
-
"rows-per-page-options": [10, 20, 50],
|
|
2450
|
-
template: "CurrentPageReport PrevPageLink NextPageLink",
|
|
2451
|
-
"current-page-report-template": "Página {currentPage} de {totalPages}",
|
|
2452
|
-
class: "w-crud-paginator",
|
|
2453
|
-
onPage: e.crud.onPage
|
|
2454
|
-
}, null, 8, ["rows", "total-records", "first", "onPage"])) : S("", !0)
|
|
2455
|
-
]))
|
|
2456
|
-
]),
|
|
2457
|
-
e.actionRail ? (i(), m("aside", lo, [
|
|
2458
|
-
X.value ? he((i(), A(g(ae), {
|
|
2459
|
-
key: 0,
|
|
2460
|
-
icon: "pi pi-plus",
|
|
2461
|
-
rounded: "",
|
|
2462
|
-
onClick: p[13] || (p[13] = (l) => e.crud.openCreateDialog())
|
|
2463
|
-
}, null, 512)), [
|
|
2464
|
-
[
|
|
2465
|
-
U,
|
|
2466
|
-
"Novo",
|
|
2467
|
-
void 0,
|
|
2468
|
-
{ left: !0 }
|
|
2469
|
-
]
|
|
2470
|
-
]) : S("", !0),
|
|
2471
|
-
X.value && J.value.length ? (i(), m("div", so)) : S("", !0),
|
|
2472
|
-
(i(!0), m(ie, null, ce(J.value, (l) => (i(), m(ie, {
|
|
2473
|
-
key: l.action
|
|
2474
|
-
}, [
|
|
2475
|
-
!B.value || P(l, B.value) ? he((i(), A(g(ae), {
|
|
2476
|
-
key: 0,
|
|
2477
|
-
icon: l.icon,
|
|
2478
|
-
text: "",
|
|
2479
|
-
rounded: "",
|
|
2480
|
-
severity: l.severity,
|
|
2481
|
-
disabled: !B.value || V(l, B.value),
|
|
2482
|
-
onClick: (f) => B.value && D(l, B.value)
|
|
2483
|
-
}, null, 8, ["icon", "severity", "disabled", "onClick"])), [
|
|
2484
|
-
[
|
|
2485
|
-
U,
|
|
2486
|
-
l.tooltip,
|
|
2487
|
-
void 0,
|
|
2488
|
-
{ left: !0 }
|
|
2489
|
-
]
|
|
2490
|
-
]) : S("", !0)
|
|
2491
|
-
], 64))), 128)),
|
|
2492
|
-
N(c.$slots, "rail-actions", {
|
|
2493
|
-
selected: B.value,
|
|
2494
|
-
crud: e.crud
|
|
2495
|
-
}),
|
|
2496
|
-
e.showPrint || e.exportCsv ? (i(), m("div", io)) : S("", !0),
|
|
2497
|
-
e.showPrint ? he((i(), A(g(ae), {
|
|
2498
|
-
key: 3,
|
|
2499
|
-
icon: "pi pi-print",
|
|
2500
|
-
text: "",
|
|
2501
|
-
rounded: "",
|
|
2502
|
-
disabled: !B.value,
|
|
2503
|
-
onClick: le
|
|
2504
|
-
}, null, 8, ["disabled"])), [
|
|
2505
|
-
[
|
|
2506
|
-
U,
|
|
2507
|
-
"Imprimir",
|
|
2508
|
-
void 0,
|
|
2509
|
-
{ left: !0 }
|
|
2510
|
-
]
|
|
2511
|
-
]) : S("", !0),
|
|
2512
|
-
e.exportCsv ? he((i(), A(g(ae), {
|
|
2513
|
-
key: 4,
|
|
2514
|
-
icon: "pi pi-download",
|
|
2515
|
-
text: "",
|
|
2516
|
-
rounded: "",
|
|
2517
|
-
loading: W.value,
|
|
2518
|
-
onClick: H
|
|
2519
|
-
}, null, 8, ["loading"])), [
|
|
2520
|
-
[
|
|
2521
|
-
U,
|
|
2522
|
-
e.csvScope === "all" ? "Exportar tudo (CSV)" : "Exportar página (CSV)",
|
|
2523
|
-
void 0,
|
|
2524
|
-
{ left: !0 }
|
|
2525
|
-
]
|
|
2526
|
-
]) : S("", !0)
|
|
2527
|
-
])) : S("", !0)
|
|
2528
|
-
], 2),
|
|
2529
|
-
e.contextMenu ? (i(), A(g(Zt), {
|
|
2530
|
-
key: 1,
|
|
2531
|
-
ref_key: "cm",
|
|
2532
|
-
ref: q,
|
|
2533
|
-
model: te.value
|
|
2534
|
-
}, null, 8, ["model"])) : S("", !0),
|
|
2535
|
-
N(c.$slots, "form-dialog", {
|
|
2536
|
-
crud: e.crud,
|
|
2537
|
-
dialogWidth: e.dialogWidth
|
|
2538
|
-
}, () => {
|
|
2539
|
-
var l;
|
|
2540
|
-
return [
|
|
2541
|
-
Y(pt, {
|
|
2542
|
-
visible: e.crud.dialogVisible.value,
|
|
2543
|
-
title: e.crud.dialogTitle.value,
|
|
2544
|
-
fields: e.crud.config.form,
|
|
2545
|
-
"form-data": e.crud.formData,
|
|
2546
|
-
"is-editing": e.crud.isEditing.value,
|
|
2547
|
-
saving: e.crud.saving.value,
|
|
2548
|
-
disabled: ((l = e.crud.viewMode) == null ? void 0 : l.value) ?? !1,
|
|
2549
|
-
width: e.dialogWidth,
|
|
2550
|
-
"form-columns": e.formColumns ?? e.crud.config.formColumns,
|
|
2551
|
-
"onUpdate:visible": p[14] || (p[14] = (f) => {
|
|
2552
|
-
e.crud.dialogVisible.value = f, f || (e.crud.editingItem.value = null);
|
|
2553
|
-
}),
|
|
2554
|
-
"onUpdate:field": p[15] || (p[15] = (f, k) => e.crud.setFormField(f, k)),
|
|
2555
|
-
onSave: p[16] || (p[16] = (f) => e.crud.save())
|
|
2556
|
-
}, ut({ _: 2 }, [
|
|
2557
|
-
ce(e.crud.config.form, (f) => ({
|
|
2558
|
-
name: `field-${f.field}`,
|
|
2559
|
-
fn: se((k) => [
|
|
2560
|
-
N(c.$slots, `field-${f.field}`, dt(ct(k)))
|
|
2561
|
-
])
|
|
2562
|
-
}))
|
|
2563
|
-
]), 1032, ["visible", "title", "fields", "form-data", "is-editing", "saving", "disabled", "width", "form-columns"])
|
|
2564
|
-
];
|
|
2565
|
-
})
|
|
2566
|
-
]);
|
|
2567
|
-
};
|
|
2568
|
-
}
|
|
2569
|
-
}), uo = /* @__PURE__ */ fe({
|
|
2570
|
-
__name: "WStatusTag",
|
|
2571
|
-
props: {
|
|
2572
|
-
value: {},
|
|
2573
|
-
map: {}
|
|
2574
|
-
},
|
|
2575
|
-
setup(e) {
|
|
2576
|
-
const a = e, t = {
|
|
2577
|
-
ativo: { label: "Ativo", severity: "success" },
|
|
2578
|
-
ativa: { label: "Ativa", severity: "success" },
|
|
2579
|
-
inativo: { label: "Inativo", severity: "danger" },
|
|
2580
|
-
inativa: { label: "Inativa", severity: "danger" },
|
|
2581
|
-
suspensa: { label: "Suspensa", severity: "warn" },
|
|
2582
|
-
suspenso: { label: "Suspenso", severity: "warn" },
|
|
2583
|
-
cancelada: { label: "Cancelada", severity: "danger" },
|
|
2584
|
-
cancelado: { label: "Cancelado", severity: "danger" },
|
|
2585
|
-
pendente: { label: "Pendente", severity: "warn" },
|
|
2586
|
-
confirmada: { label: "Confirmada", severity: "success" },
|
|
2587
|
-
confirmado: { label: "Confirmado", severity: "success" },
|
|
2588
|
-
vencida: { label: "Vencida", severity: "danger" },
|
|
2589
|
-
vencido: { label: "Vencido", severity: "danger" },
|
|
2590
|
-
concluido: { label: "Concluído", severity: "success" },
|
|
2591
|
-
concluida: { label: "Concluída", severity: "success" },
|
|
2592
|
-
em_progresso: { label: "Em Progresso", severity: "info" },
|
|
2593
|
-
em_andamento: { label: "Em Andamento", severity: "info" },
|
|
2594
|
-
expirado: { label: "Expirado", severity: "secondary" },
|
|
2595
|
-
expirada: { label: "Expirada", severity: "secondary" },
|
|
2596
|
-
aberto: { label: "Aberto", severity: "info" },
|
|
2597
|
-
aberta: { label: "Aberta", severity: "info" },
|
|
2598
|
-
fechado: { label: "Fechado", severity: "secondary" },
|
|
2599
|
-
fechada: { label: "Fechada", severity: "secondary" },
|
|
2600
|
-
pago: { label: "Pago", severity: "success" },
|
|
2601
|
-
paga: { label: "Paga", severity: "success" },
|
|
2602
|
-
inadimplente: { label: "Inadimplente", severity: "danger" }
|
|
2603
|
-
}, n = O(() => (a.map ?? t)[a.value] ?? { label: a.value, severity: "secondary" });
|
|
2604
|
-
return (s, r) => (i(), A(g(Pt), {
|
|
2605
|
-
value: n.value.label,
|
|
2606
|
-
severity: n.value.severity
|
|
2607
|
-
}, null, 8, ["value", "severity"]));
|
|
2608
|
-
}
|
|
2609
|
-
}), co = { class: "w-page-header" }, fo = { class: "w-page-header-content" }, mo = { class: "w-page-header-title" }, po = {
|
|
2610
|
-
key: 0,
|
|
2611
|
-
class: "w-page-header-subtitle"
|
|
2612
|
-
}, vo = { class: "w-page-header-actions" }, Hl = /* @__PURE__ */ fe({
|
|
2613
|
-
__name: "WPageHeader",
|
|
2614
|
-
props: {
|
|
2615
|
-
title: {},
|
|
2616
|
-
subtitle: {},
|
|
2617
|
-
actionLabel: {},
|
|
2618
|
-
actionIcon: {}
|
|
2619
|
-
},
|
|
2620
|
-
emits: ["action"],
|
|
2621
|
-
setup(e, { emit: a }) {
|
|
2622
|
-
const t = a;
|
|
2623
|
-
return (n, s) => (i(), m("div", co, [
|
|
2624
|
-
h("div", fo, [
|
|
2625
|
-
h("h2", mo, T(e.title), 1),
|
|
2626
|
-
e.subtitle ? (i(), m("p", po, T(e.subtitle), 1)) : S("", !0)
|
|
2627
|
-
]),
|
|
2628
|
-
h("div", vo, [
|
|
2629
|
-
N(n.$slots, "actions"),
|
|
2630
|
-
e.actionLabel ? (i(), A(g(ae), {
|
|
2631
|
-
key: 0,
|
|
2632
|
-
label: e.actionLabel,
|
|
2633
|
-
icon: e.actionIcon,
|
|
2634
|
-
onClick: s[0] || (s[0] = (r) => t("action"))
|
|
2635
|
-
}, null, 8, ["label", "icon"])) : S("", !0)
|
|
2636
|
-
])
|
|
2637
|
-
]));
|
|
2638
|
-
}
|
|
2639
|
-
}), go = { class: "w-empty-state" }, ho = { class: "w-empty-state-icon" }, yo = { class: "w-empty-state-title" }, bo = {
|
|
2640
|
-
key: 0,
|
|
2641
|
-
class: "w-empty-state-description"
|
|
2642
|
-
}, Kl = /* @__PURE__ */ fe({
|
|
2643
|
-
__name: "WEmptyState",
|
|
2644
|
-
props: {
|
|
2645
|
-
icon: {},
|
|
2646
|
-
title: {},
|
|
2647
|
-
description: {},
|
|
2648
|
-
actionLabel: {},
|
|
2649
|
-
actionIcon: {}
|
|
2650
|
-
},
|
|
2651
|
-
emits: ["action"],
|
|
2652
|
-
setup(e, { emit: a }) {
|
|
2653
|
-
const t = a;
|
|
2654
|
-
return (n, s) => (i(), m("div", go, [
|
|
2655
|
-
h("div", ho, [
|
|
2656
|
-
h("i", {
|
|
2657
|
-
class: re(e.icon)
|
|
2658
|
-
}, null, 2)
|
|
2659
|
-
]),
|
|
2660
|
-
h("p", yo, T(e.title), 1),
|
|
2661
|
-
e.description ? (i(), m("p", bo, T(e.description), 1)) : S("", !0),
|
|
2662
|
-
e.actionLabel ? (i(), A(g(ae), {
|
|
2663
|
-
key: 1,
|
|
2664
|
-
label: e.actionLabel,
|
|
2665
|
-
icon: e.actionIcon,
|
|
2666
|
-
size: "small",
|
|
2667
|
-
class: "mt-3",
|
|
2668
|
-
onClick: s[0] || (s[0] = (r) => t("action"))
|
|
2669
|
-
}, null, 8, ["label", "icon"])) : S("", !0)
|
|
2670
|
-
]));
|
|
2671
|
-
}
|
|
2672
|
-
});
|
|
2673
|
-
/*!
|
|
2674
|
-
* vue-router v4.6.4
|
|
2675
|
-
* (c) 2025 Eduardo San Martin Morote
|
|
2676
|
-
* @license MIT
|
|
2677
|
-
*/
|
|
2678
|
-
Symbol(process.env.NODE_ENV !== "production" ? "navigation failure" : "");
|
|
2679
|
-
Symbol(process.env.NODE_ENV !== "production" ? "router view location matched" : "");
|
|
2680
|
-
Symbol(process.env.NODE_ENV !== "production" ? "router view depth" : "");
|
|
2681
|
-
const wo = Symbol(process.env.NODE_ENV !== "production" ? "router" : "");
|
|
2682
|
-
Symbol(process.env.NODE_ENV !== "production" ? "route location" : "");
|
|
2683
|
-
Symbol(process.env.NODE_ENV !== "production" ? "router view location" : "");
|
|
2684
|
-
/*!
|
|
2685
|
-
* vue-router v4.6.4
|
|
2686
|
-
* (c) 2025 Eduardo San Martin Morote
|
|
2687
|
-
* @license MIT
|
|
2688
|
-
*/
|
|
2689
|
-
function ko() {
|
|
2690
|
-
return Le(wo);
|
|
2691
|
-
}
|
|
2692
|
-
const $o = { class: "w-detail-header" }, Co = { class: "w-detail-header-left" }, Do = { class: "w-detail-header-content" }, xo = { class: "w-detail-header-title" }, So = {
|
|
2693
|
-
key: 0,
|
|
2694
|
-
class: "w-detail-header-subtitle"
|
|
2695
|
-
}, Po = { class: "w-detail-header-actions" }, Gl = /* @__PURE__ */ fe({
|
|
2696
|
-
__name: "WDetailHeader",
|
|
2697
|
-
props: {
|
|
2698
|
-
title: {},
|
|
2699
|
-
subtitle: {},
|
|
2700
|
-
icon: {},
|
|
2701
|
-
backRoute: {},
|
|
2702
|
-
backTo: {},
|
|
2703
|
-
status: {},
|
|
2704
|
-
statusMap: {}
|
|
2705
|
-
},
|
|
2706
|
-
setup(e) {
|
|
2707
|
-
const a = e, t = ko();
|
|
2708
|
-
function n() {
|
|
2709
|
-
a.backTo ? t.push(typeof a.backTo == "string" ? { name: a.backTo } : a.backTo) : a.backRoute ? t.push({ name: a.backRoute }) : t.back();
|
|
2710
|
-
}
|
|
2711
|
-
return (s, r) => (i(), m("div", $o, [
|
|
2712
|
-
h("div", Co, [
|
|
2713
|
-
Y(g(ae), {
|
|
2714
|
-
icon: "pi pi-arrow-left",
|
|
2715
|
-
text: "",
|
|
2716
|
-
rounded: "",
|
|
2717
|
-
onClick: n
|
|
2718
|
-
}),
|
|
2719
|
-
e.icon ? (i(), m("i", {
|
|
2720
|
-
key: 0,
|
|
2721
|
-
class: re([e.icon, "w-detail-header-icon"])
|
|
2722
|
-
}, null, 2)) : S("", !0),
|
|
2723
|
-
h("div", Do, [
|
|
2724
|
-
h("h2", xo, T(e.title), 1),
|
|
2725
|
-
e.subtitle ? (i(), m("p", So, T(e.subtitle), 1)) : S("", !0)
|
|
2726
|
-
]),
|
|
2727
|
-
e.status ? (i(), A(uo, {
|
|
2728
|
-
key: 1,
|
|
2729
|
-
value: e.status,
|
|
2730
|
-
map: e.statusMap
|
|
2731
|
-
}, null, 8, ["value", "map"])) : S("", !0)
|
|
2732
|
-
]),
|
|
2733
|
-
h("div", Po, [
|
|
2734
|
-
N(s.$slots, "actions")
|
|
2735
|
-
])
|
|
2736
|
-
]));
|
|
2737
|
-
}
|
|
2738
|
-
}), Vo = { class: "w-info-card" }, Mo = {
|
|
2739
|
-
key: 0,
|
|
2740
|
-
class: "w-info-card-title"
|
|
2741
|
-
}, Eo = { class: "w-info-card-grid" }, Fo = { class: "w-info-card-label" }, Ao = { class: "w-info-card-value" }, Jl = /* @__PURE__ */ fe({
|
|
2742
|
-
__name: "WInfoCard",
|
|
2743
|
-
props: {
|
|
2744
|
-
title: {},
|
|
2745
|
-
fields: {}
|
|
2746
|
-
},
|
|
2747
|
-
setup(e) {
|
|
2748
|
-
const { formatCurrency: a, formatDate: t, formatNumber: n } = mt();
|
|
2749
|
-
function s(r) {
|
|
2750
|
-
const u = r.value;
|
|
2751
|
-
return u == null || u === "" ? "-" : r.format === "currency" ? a(Number(u)) : r.format === "date" ? t(String(u)) : r.format === "datetime" ? t(String(u), "DD/MM/YYYY HH:mm") : r.format === "number" ? n(Number(u)) : String(u);
|
|
2752
|
-
}
|
|
2753
|
-
return (r, u) => (i(), m("div", Vo, [
|
|
2754
|
-
e.title ? (i(), m("h3", Mo, T(e.title), 1)) : S("", !0),
|
|
2755
|
-
h("div", Eo, [
|
|
2756
|
-
(i(!0), m(ie, null, ce(e.fields, (b) => (i(), m("div", {
|
|
2757
|
-
key: b.label,
|
|
2758
|
-
class: "w-info-card-field"
|
|
2759
|
-
}, [
|
|
2760
|
-
h("span", Fo, T(b.label), 1),
|
|
2761
|
-
h("span", Ao, T(s(b)), 1)
|
|
2762
|
-
]))), 128))
|
|
2763
|
-
])
|
|
2764
|
-
]));
|
|
2765
|
-
}
|
|
2766
|
-
}), Ro = {
|
|
2767
|
-
key: 0,
|
|
2768
|
-
class: "w-kpi-card__loading"
|
|
2769
|
-
}, Io = { class: "w-kpi-card__loading-content" }, To = { class: "w-kpi-card__header" }, Lo = {
|
|
2770
|
-
key: 0,
|
|
2771
|
-
class: "w-kpi-card__icon"
|
|
2772
|
-
}, zo = {
|
|
2773
|
-
key: 1,
|
|
2774
|
-
class: "w-kpi-card__trend"
|
|
2775
|
-
}, No = { class: "w-kpi-card__content" }, Yo = { class: "w-kpi-card__label" }, Oo = { class: "w-kpi-card__value" }, Bo = {
|
|
2776
|
-
key: 0,
|
|
2777
|
-
class: "w-kpi-card__hint"
|
|
2778
|
-
}, jo = {
|
|
2779
|
-
key: 0,
|
|
2780
|
-
class: "w-kpi-card__footer"
|
|
2781
|
-
}, Wo = /* @__PURE__ */ fe({
|
|
2782
|
-
__name: "WKpiCard",
|
|
2783
|
-
props: {
|
|
2784
|
-
label: {},
|
|
2785
|
-
value: {},
|
|
2786
|
-
icon: {},
|
|
2787
|
-
hint: {},
|
|
2788
|
-
severity: {},
|
|
2789
|
-
trend: {},
|
|
2790
|
-
loading: { type: Boolean }
|
|
2791
|
-
},
|
|
2792
|
-
setup(e) {
|
|
2793
|
-
return (a, t) => (i(), m("article", {
|
|
2794
|
-
class: re(["w-kpi-card", e.severity ? `w-kpi-card--${e.severity}` : ""])
|
|
2795
|
-
}, [
|
|
2796
|
-
e.loading ? (i(), m("div", Ro, [
|
|
2797
|
-
Y(g(Ze), {
|
|
2798
|
-
shape: "circle",
|
|
2799
|
-
size: "2.75rem"
|
|
2800
|
-
}),
|
|
2801
|
-
h("div", Io, [
|
|
2802
|
-
Y(g(Ze), {
|
|
2803
|
-
width: "6rem",
|
|
2804
|
-
height: "0.75rem"
|
|
2805
|
-
}),
|
|
2806
|
-
Y(g(Ze), {
|
|
2807
|
-
width: "7.5rem",
|
|
2808
|
-
height: "1.5rem"
|
|
2809
|
-
}),
|
|
2810
|
-
Y(g(Ze), {
|
|
2811
|
-
width: "5rem",
|
|
2812
|
-
height: "0.75rem"
|
|
2813
|
-
})
|
|
2814
|
-
])
|
|
2815
|
-
])) : (i(), m(ie, { key: 1 }, [
|
|
2816
|
-
h("div", To, [
|
|
2817
|
-
e.icon || a.$slots.icon ? (i(), m("div", Lo, [
|
|
2818
|
-
N(a.$slots, "icon", {}, () => [
|
|
2819
|
-
e.icon ? (i(), m("i", {
|
|
2820
|
-
key: 0,
|
|
2821
|
-
class: re(e.icon)
|
|
2822
|
-
}, null, 2)) : S("", !0)
|
|
2823
|
-
])
|
|
2824
|
-
])) : S("", !0),
|
|
2825
|
-
e.trend || a.$slots.trend ? (i(), m("div", zo, [
|
|
2826
|
-
N(a.$slots, "trend", {}, () => [
|
|
2827
|
-
e.trend ? (i(), m("span", {
|
|
2828
|
-
key: 0,
|
|
2829
|
-
class: re(["w-kpi-card__trend-badge", e.trend.direction ? `w-kpi-card__trend-badge--${e.trend.direction}` : ""])
|
|
2830
|
-
}, T(e.trend.value), 3)) : S("", !0)
|
|
2831
|
-
])
|
|
2832
|
-
])) : S("", !0)
|
|
2833
|
-
]),
|
|
2834
|
-
h("div", No, [
|
|
2835
|
-
h("p", Yo, T(e.label), 1),
|
|
2836
|
-
h("div", Oo, [
|
|
2837
|
-
N(a.$slots, "value", {}, () => [
|
|
2838
|
-
Fe(T(e.value), 1)
|
|
2839
|
-
])
|
|
2840
|
-
]),
|
|
2841
|
-
e.hint || a.$slots.hint ? (i(), m("p", Bo, [
|
|
2842
|
-
N(a.$slots, "hint", {}, () => [
|
|
2843
|
-
Fe(T(e.hint), 1)
|
|
2844
|
-
])
|
|
2845
|
-
])) : S("", !0)
|
|
2846
|
-
]),
|
|
2847
|
-
a.$slots.footer ? (i(), m("footer", jo, [
|
|
2848
|
-
N(a.$slots, "footer")
|
|
2849
|
-
])) : S("", !0)
|
|
2850
|
-
], 64))
|
|
2851
|
-
], 2));
|
|
2852
|
-
}
|
|
2853
|
-
}), Zl = /* @__PURE__ */ fe({
|
|
2854
|
-
__name: "WKpiGrid",
|
|
2855
|
-
props: {
|
|
2856
|
-
items: { default: () => [] },
|
|
2857
|
-
columns: { default: 4 },
|
|
2858
|
-
dense: { type: Boolean, default: !1 }
|
|
2859
|
-
},
|
|
2860
|
-
setup(e) {
|
|
2861
|
-
const a = e, t = O(() => [
|
|
2862
|
-
a.columns === "auto" ? "w-kpi-grid--auto" : `w-kpi-grid--cols-${a.columns}`,
|
|
2863
|
-
{ "w-kpi-grid--dense": a.dense }
|
|
2864
|
-
]);
|
|
2865
|
-
return (n, s) => (i(), m("div", {
|
|
2866
|
-
class: re(["w-kpi-grid", t.value])
|
|
2867
|
-
}, [
|
|
2868
|
-
n.$slots.item ? (i(!0), m(ie, { key: 0 }, ce(e.items, (r, u) => N(n.$slots, "item", {
|
|
2869
|
-
key: u,
|
|
2870
|
-
item: r,
|
|
2871
|
-
index: u
|
|
2872
|
-
})), 128)) : (i(!0), m(ie, { key: 1 }, ce(e.items, (r, u) => (i(), A(Wo, {
|
|
2873
|
-
key: u,
|
|
2874
|
-
label: r.label,
|
|
2875
|
-
value: r.value,
|
|
2876
|
-
icon: r.icon,
|
|
2877
|
-
severity: r.severity || "primary",
|
|
2878
|
-
hint: r.hint,
|
|
2879
|
-
trend: r.trend,
|
|
2880
|
-
loading: r.loading
|
|
2881
|
-
}, null, 8, ["label", "value", "icon", "severity", "hint", "trend", "loading"]))), 128))
|
|
2882
|
-
], 2));
|
|
2883
|
-
}
|
|
2884
|
-
}), Uo = { class: "w-section-header__main" }, qo = {
|
|
2885
|
-
key: 0,
|
|
2886
|
-
class: "w-section-header__icon"
|
|
2887
|
-
}, Ho = { class: "w-section-header__content" }, Ko = { class: "w-section-header__title-row" }, Go = { class: "w-section-header__title" }, Jo = {
|
|
2888
|
-
key: 0,
|
|
2889
|
-
class: "w-section-header__subtitle"
|
|
2890
|
-
}, Zo = {
|
|
2891
|
-
key: 0,
|
|
2892
|
-
class: "w-section-header__actions"
|
|
2893
|
-
}, Xl = /* @__PURE__ */ fe({
|
|
2894
|
-
__name: "WSectionHeader",
|
|
2895
|
-
props: {
|
|
2896
|
-
title: {},
|
|
2897
|
-
subtitle: {},
|
|
2898
|
-
icon: {},
|
|
2899
|
-
compact: { type: Boolean }
|
|
2900
|
-
},
|
|
2901
|
-
setup(e) {
|
|
2902
|
-
return (a, t) => (i(), m("div", {
|
|
2903
|
-
class: re(["w-section-header", { "w-section-header--compact": e.compact }])
|
|
2904
|
-
}, [
|
|
2905
|
-
h("div", Uo, [
|
|
2906
|
-
e.icon || a.$slots.icon ? (i(), m("div", qo, [
|
|
2907
|
-
N(a.$slots, "icon", {}, () => [
|
|
2908
|
-
e.icon ? (i(), m("i", {
|
|
2909
|
-
key: 0,
|
|
2910
|
-
class: re(e.icon)
|
|
2911
|
-
}, null, 2)) : S("", !0)
|
|
2912
|
-
])
|
|
2913
|
-
])) : S("", !0),
|
|
2914
|
-
h("div", Ho, [
|
|
2915
|
-
h("div", Ko, [
|
|
2916
|
-
h("h3", Go, T(e.title), 1),
|
|
2917
|
-
N(a.$slots, "meta")
|
|
2918
|
-
]),
|
|
2919
|
-
e.subtitle ? (i(), m("p", Jo, T(e.subtitle), 1)) : S("", !0)
|
|
2920
|
-
])
|
|
2921
|
-
]),
|
|
2922
|
-
a.$slots.actions ? (i(), m("div", Zo, [
|
|
2923
|
-
N(a.$slots, "actions")
|
|
2924
|
-
])) : S("", !0)
|
|
2925
|
-
], 2));
|
|
2926
|
-
}
|
|
2927
|
-
}), Xo = {
|
|
2928
|
-
key: 0,
|
|
2929
|
-
class: "w-form-section__header"
|
|
2930
|
-
}, Qo = { class: "w-form-section__content" }, _o = { class: "w-form-section__title" }, el = {
|
|
2931
|
-
key: 0,
|
|
2932
|
-
class: "w-form-section__description"
|
|
2933
|
-
}, tl = {
|
|
2934
|
-
key: 0,
|
|
2935
|
-
class: "w-form-section__actions"
|
|
2936
|
-
}, al = { class: "w-form-section__body" }, Ql = /* @__PURE__ */ fe({
|
|
2937
|
-
__name: "WFormSection",
|
|
2938
|
-
props: {
|
|
2939
|
-
title: {},
|
|
2940
|
-
description: {},
|
|
2941
|
-
variant: {}
|
|
2942
|
-
},
|
|
2943
|
-
setup(e) {
|
|
2944
|
-
return (a, t) => (i(), m("section", {
|
|
2945
|
-
class: re(["w-form-section", e.variant ? `w-form-section--${e.variant}` : ""])
|
|
2946
|
-
}, [
|
|
2947
|
-
e.title || e.description || a.$slots.actions ? (i(), m("div", Xo, [
|
|
2948
|
-
h("div", Qo, [
|
|
2949
|
-
h("h3", _o, T(e.title), 1),
|
|
2950
|
-
e.description ? (i(), m("p", el, T(e.description), 1)) : S("", !0)
|
|
2951
|
-
]),
|
|
2952
|
-
a.$slots.actions ? (i(), m("div", tl, [
|
|
2953
|
-
N(a.$slots, "actions")
|
|
2954
|
-
])) : S("", !0)
|
|
2955
|
-
])) : S("", !0),
|
|
2956
|
-
h("div", al, [
|
|
2957
|
-
N(a.$slots, "default")
|
|
2958
|
-
])
|
|
2959
|
-
], 2));
|
|
2960
|
-
}
|
|
2961
|
-
}), nl = {
|
|
2962
|
-
key: 0,
|
|
2963
|
-
class: "w-action-bar__primary"
|
|
2964
|
-
}, ol = {
|
|
2965
|
-
key: 1,
|
|
2966
|
-
class: "w-action-bar__filters"
|
|
2967
|
-
}, ll = {
|
|
2968
|
-
key: 2,
|
|
2969
|
-
class: "w-action-bar__secondary"
|
|
2970
|
-
}, _l = /* @__PURE__ */ fe({
|
|
2971
|
-
__name: "WActionBar",
|
|
2972
|
-
props: {
|
|
2973
|
-
align: { default: "between" },
|
|
2974
|
-
stackOnMobile: { type: Boolean, default: !0 }
|
|
2975
|
-
},
|
|
2976
|
-
setup(e) {
|
|
2977
|
-
return (a, t) => (i(), m("div", {
|
|
2978
|
-
class: re(["w-action-bar", [
|
|
2979
|
-
`w-action-bar--${e.align}`,
|
|
2980
|
-
{ "w-action-bar--stack": e.stackOnMobile }
|
|
2981
|
-
]])
|
|
2982
|
-
}, [
|
|
2983
|
-
a.$slots.primary || a.$slots.default ? (i(), m("div", nl, [
|
|
2984
|
-
N(a.$slots, "primary", {}, () => [
|
|
2985
|
-
N(a.$slots, "default")
|
|
2986
|
-
])
|
|
2987
|
-
])) : S("", !0),
|
|
2988
|
-
a.$slots.filters ? (i(), m("div", ol, [
|
|
2989
|
-
N(a.$slots, "filters")
|
|
2990
|
-
])) : S("", !0),
|
|
2991
|
-
a.$slots.secondary ? (i(), m("div", ll, [
|
|
2992
|
-
N(a.$slots, "secondary")
|
|
2993
|
-
])) : S("", !0)
|
|
2994
|
-
], 2));
|
|
2995
|
-
}
|
|
2996
|
-
}), sl = { class: "w-progress-flow__marker" }, il = { class: "w-progress-flow__content" }, rl = { class: "w-progress-flow__label" }, ul = {
|
|
2997
|
-
key: 0,
|
|
2998
|
-
class: "w-progress-flow__description"
|
|
2999
|
-
}, es = /* @__PURE__ */ fe({
|
|
3000
|
-
__name: "WProgressFlow",
|
|
3001
|
-
props: {
|
|
3002
|
-
steps: {},
|
|
3003
|
-
currentStep: {},
|
|
3004
|
-
orientation: { default: "horizontal" }
|
|
3005
|
-
},
|
|
3006
|
-
setup(e) {
|
|
3007
|
-
const a = e, t = O(
|
|
3008
|
-
() => a.steps.findIndex((s) => s.key === a.currentStep)
|
|
3009
|
-
);
|
|
3010
|
-
function n(s) {
|
|
3011
|
-
return s < t.value ? "done" : s === t.value ? "current" : "pending";
|
|
3012
|
-
}
|
|
3013
|
-
return (s, r) => (i(), m("div", {
|
|
3014
|
-
class: re(["w-progress-flow", `w-progress-flow--${e.orientation}`])
|
|
3015
|
-
}, [
|
|
3016
|
-
(i(!0), m(ie, null, ce(e.steps, (u, b) => (i(), m("div", {
|
|
3017
|
-
key: u.key,
|
|
3018
|
-
class: re(["w-progress-flow__step", `w-progress-flow__step--${n(b)}`])
|
|
3019
|
-
}, [
|
|
3020
|
-
N(s.$slots, "step", {
|
|
3021
|
-
step: u,
|
|
3022
|
-
index: b,
|
|
3023
|
-
state: n(b)
|
|
3024
|
-
}, () => [
|
|
3025
|
-
h("div", sl, [
|
|
3026
|
-
h("span", null, T(b + 1), 1)
|
|
3027
|
-
]),
|
|
3028
|
-
h("div", il, [
|
|
3029
|
-
h("p", rl, T(u.label), 1),
|
|
3030
|
-
u.description ? (i(), m("p", ul, T(u.description), 1)) : S("", !0)
|
|
3031
|
-
])
|
|
3032
|
-
])
|
|
3033
|
-
], 2))), 128))
|
|
3034
|
-
], 2));
|
|
3035
|
-
}
|
|
3036
|
-
});
|
|
3037
|
-
function dl(e, a, t) {
|
|
3038
|
-
const n = e;
|
|
3039
|
-
return Array.isArray(n.results) ? {
|
|
3040
|
-
data: n.results,
|
|
3041
|
-
page: n.page ?? a,
|
|
3042
|
-
page_size: n.page_size ?? t,
|
|
3043
|
-
rows: n.count ?? 0,
|
|
3044
|
-
extras: n.extras ?? {}
|
|
3045
|
-
} : Array.isArray(n.data) ? {
|
|
3046
|
-
data: n.data,
|
|
3047
|
-
page: n.page ?? a,
|
|
3048
|
-
page_size: n.page_size ?? t,
|
|
3049
|
-
rows: n.rows ?? 0,
|
|
3050
|
-
extras: n.extras ?? {}
|
|
1
|
+
import { b as _, W, a as w } from "./plugin-BKa0eSEM.js";
|
|
2
|
+
import { d as A, c as P, b as v, a as C, l as F, q as b } from "./WProgressFlow.vue_vue_type_script_setup_true_lang-BVlG1in1.js";
|
|
3
|
+
import { _ as N, e as O, f as V, g as k, h as q, i as H, j, k as B, m as U, n as G, o as X, p as J, r as Q, s as Z, t as ee, u as ae, v as te, w as re } from "./WProgressFlow.vue_vue_type_script_setup_true_lang-BVlG1in1.js";
|
|
4
|
+
import { u as ne, a as oe } from "./useApi-B692TOWz.js";
|
|
5
|
+
import { e as ce, u as le, a as ue, b as de, c as fe } from "./useApiError-C7rPzGrF.js";
|
|
6
|
+
import { DEFAULT_CRUD_LABELS as pe } from "./types.js";
|
|
7
|
+
function x(e, a, t) {
|
|
8
|
+
const r = e;
|
|
9
|
+
return Array.isArray(r.results) ? {
|
|
10
|
+
data: r.results,
|
|
11
|
+
page: r.page ?? a,
|
|
12
|
+
page_size: r.page_size ?? t,
|
|
13
|
+
rows: r.count ?? 0,
|
|
14
|
+
extras: r.extras ?? {}
|
|
15
|
+
} : Array.isArray(r.data) ? {
|
|
16
|
+
data: r.data,
|
|
17
|
+
page: r.page ?? a,
|
|
18
|
+
page_size: r.page_size ?? t,
|
|
19
|
+
rows: r.rows ?? 0,
|
|
20
|
+
extras: r.extras ?? {}
|
|
3051
21
|
} : {
|
|
3052
22
|
data: Array.isArray(e) ? e : [],
|
|
3053
23
|
page: a,
|
|
@@ -3056,41 +26,37 @@ function dl(e, a, t) {
|
|
|
3056
26
|
extras: {}
|
|
3057
27
|
};
|
|
3058
28
|
}
|
|
3059
|
-
function
|
|
29
|
+
function D(e) {
|
|
3060
30
|
return {
|
|
3061
31
|
async list(a, t = {}) {
|
|
3062
|
-
const
|
|
3063
|
-
return
|
|
3064
|
-
|
|
32
|
+
const r = await e.get(a, { params: t });
|
|
33
|
+
return x(
|
|
34
|
+
r.data,
|
|
3065
35
|
Number(t.page ?? 1),
|
|
3066
36
|
Number(t.page_size ?? 20)
|
|
3067
37
|
);
|
|
3068
38
|
},
|
|
3069
|
-
async get(a, t,
|
|
3070
|
-
return { data: (await e.get(`${a}${t}/`,
|
|
39
|
+
async get(a, t, r) {
|
|
40
|
+
return { data: (await e.get(`${a}${t}/`, r)).data };
|
|
3071
41
|
},
|
|
3072
|
-
async create(a, t,
|
|
3073
|
-
return { data: (await e.post(a, t,
|
|
42
|
+
async create(a, t, r) {
|
|
43
|
+
return { data: (await e.post(a, t, r)).data };
|
|
3074
44
|
},
|
|
3075
|
-
async update(a, t,
|
|
3076
|
-
return { data: (await e.patch(
|
|
3077
|
-
`${a}${t}/`,
|
|
3078
|
-
n,
|
|
3079
|
-
s
|
|
3080
|
-
)).data };
|
|
45
|
+
async update(a, t, r, s) {
|
|
46
|
+
return { data: (await e.patch(`${a}${t}/`, r, s)).data };
|
|
3081
47
|
},
|
|
3082
48
|
async delete(a, t) {
|
|
3083
49
|
await e.delete(`${a}${t}/`);
|
|
3084
50
|
}
|
|
3085
51
|
};
|
|
3086
52
|
}
|
|
3087
|
-
const
|
|
53
|
+
const Y = {
|
|
3088
54
|
install(e, a) {
|
|
3089
55
|
if (!(a != null && a.axios) && !(a != null && a.dataProvider))
|
|
3090
56
|
throw new Error(
|
|
3091
57
|
'[wPrimeVueComponents] Informe "axios" ou "dataProvider" ao registrar o WPrimeVuePlugin.'
|
|
3092
58
|
);
|
|
3093
|
-
const t = a.dataProvider ??
|
|
59
|
+
const t = a.dataProvider ?? D(a.axios), r = {
|
|
3094
60
|
axios: a.axios,
|
|
3095
61
|
dataProvider: t,
|
|
3096
62
|
defaultPageSize: a.defaultPageSize ?? 20,
|
|
@@ -3099,396 +65,16 @@ const ts = {
|
|
|
3099
65
|
locale: a.locale ?? "pt-BR",
|
|
3100
66
|
currency: a.currency ?? "BRL"
|
|
3101
67
|
};
|
|
3102
|
-
a.axios && e.provide(
|
|
68
|
+
a.axios && e.provide(_, a.axios), e.provide(W, t), e.provide(w, r), a.registerComponents !== !1 && (e.component("WCrudView", A), e.component("WCrudFormDialog", P), e.component("WCrudColumnRenderer", v), e.component("WAutoCompleteFK", C), e.component("WMoneyInput", F), e.component("WTransferList", b));
|
|
3103
69
|
}
|
|
3104
|
-
}, fl = {
|
|
3105
|
-
createTitle: "Novo Registro",
|
|
3106
|
-
editTitle: "Editar Registro",
|
|
3107
|
-
createButton: "Novo",
|
|
3108
|
-
saveButton: "Salvar",
|
|
3109
|
-
updateButton: "Atualizar",
|
|
3110
|
-
cancelButton: "Cancelar",
|
|
3111
|
-
deleteConfirmTitle: "Confirmar Exclusão",
|
|
3112
|
-
deleteConfirmMessage: "Deseja realmente excluir este registro?",
|
|
3113
|
-
searchPlaceholder: "Buscar...",
|
|
3114
|
-
emptyMessage: "Nenhum registro encontrado",
|
|
3115
|
-
successCreate: "Registro criado com sucesso",
|
|
3116
|
-
successUpdate: "Registro atualizado com sucesso",
|
|
3117
|
-
successDelete: "Registro excluído com sucesso"
|
|
3118
70
|
};
|
|
3119
|
-
function
|
|
3120
|
-
const t = {};
|
|
3121
|
-
for (const n of Object.keys(a))
|
|
3122
|
-
JSON.stringify(e[n]) !== JSON.stringify(a[n]) && (t[n] = a[n]);
|
|
3123
|
-
return t;
|
|
3124
|
-
}
|
|
3125
|
-
function as(e) {
|
|
3126
|
-
const {
|
|
3127
|
-
endpoint: a,
|
|
3128
|
-
columns: t,
|
|
3129
|
-
form: n,
|
|
3130
|
-
pk: s = "id",
|
|
3131
|
-
searchDebounce: r = 300,
|
|
3132
|
-
partialUpdate: u = !0,
|
|
3133
|
-
refetchOnSave: b = !0,
|
|
3134
|
-
canCreate: d = !0,
|
|
3135
|
-
canEdit: x = !0,
|
|
3136
|
-
canDelete: F = !0,
|
|
3137
|
-
rowActions: E = void 0,
|
|
3138
|
-
filterParams: z = void 0,
|
|
3139
|
-
createDefaults: I = void 0,
|
|
3140
|
-
transformPayload: G = void 0,
|
|
3141
|
-
onAfterSave: J = void 0,
|
|
3142
|
-
onAfterDelete: v = void 0
|
|
3143
|
-
} = e, D = Le(at);
|
|
3144
|
-
if (!D)
|
|
3145
|
-
throw new Error(
|
|
3146
|
-
"[wPrimeVueComponents] dataProvider não encontrado. Registre o WPrimeVuePlugin antes de usar useCrudManager."
|
|
3147
|
-
);
|
|
3148
|
-
const P = D, V = Le(nt), Z = e.pageSize ?? (V == null ? void 0 : V.defaultPageSize) ?? 20, X = { ...fl, ...e.labels }, B = Nt(), { confirmDelete: q } = Yt(), j = K([]), ee = K({}), oe = K(!1), te = K(!1), le = K(""), W = K(!1), H = K(!1), c = K(null), p = we({});
|
|
3149
|
-
let U = null;
|
|
3150
|
-
const l = we({
|
|
3151
|
-
page: 1,
|
|
3152
|
-
pageSize: Z,
|
|
3153
|
-
rows: 0,
|
|
3154
|
-
totalPages: 0
|
|
3155
|
-
}), f = we({
|
|
3156
|
-
field: null,
|
|
3157
|
-
order: 0
|
|
3158
|
-
});
|
|
3159
|
-
function k() {
|
|
3160
|
-
const w = {};
|
|
3161
|
-
for (const M of n)
|
|
3162
|
-
w[M.field] = M.defaultValue !== void 0 ? typeof M.defaultValue == "function" ? M.defaultValue() : M.defaultValue : null;
|
|
3163
|
-
return w;
|
|
3164
|
-
}
|
|
3165
|
-
const o = k();
|
|
3166
|
-
for (const w of Object.keys(o))
|
|
3167
|
-
p[w] = o[w];
|
|
3168
|
-
const $ = O(
|
|
3169
|
-
() => c.value !== null && !H.value
|
|
3170
|
-
), ue = O(() => H.value), me = O(
|
|
3171
|
-
() => H.value ? X.viewTitle ?? "Visualizar Registro" : $.value ? X.editTitle : X.createTitle
|
|
3172
|
-
), ke = O(() => l.page <= 1), ne = O(() => l.page >= l.totalPages);
|
|
3173
|
-
let de = null;
|
|
3174
|
-
async function pe(w = {}) {
|
|
3175
|
-
oe.value = !0;
|
|
3176
|
-
try {
|
|
3177
|
-
const M = {
|
|
3178
|
-
page: l.page,
|
|
3179
|
-
page_size: l.pageSize,
|
|
3180
|
-
...w
|
|
3181
|
-
};
|
|
3182
|
-
le.value && (M.search = le.value), f.field && f.order !== 0 && (M.ordering = f.order === -1 ? `-${f.field}` : f.field), z && Object.assign(M, z());
|
|
3183
|
-
const R = await P.list(a, M);
|
|
3184
|
-
j.value = R.data, l.rows = R.rows, ee.value = R.extras ?? {}, R.page && (l.page = R.page), R.page_size && (l.pageSize = R.page_size), l.totalPages = Math.ceil(l.rows / l.pageSize) || 0;
|
|
3185
|
-
} finally {
|
|
3186
|
-
oe.value = !1;
|
|
3187
|
-
}
|
|
3188
|
-
}
|
|
3189
|
-
async function De() {
|
|
3190
|
-
await pe();
|
|
3191
|
-
}
|
|
3192
|
-
async function Ne() {
|
|
3193
|
-
await pe();
|
|
3194
|
-
}
|
|
3195
|
-
async function Re(w = 200) {
|
|
3196
|
-
const M = {};
|
|
3197
|
-
le.value && (M.search = le.value), f.field && f.order !== 0 && (M.ordering = f.order === -1 ? `-${f.field}` : f.field), z && Object.assign(M, z());
|
|
3198
|
-
const R = [];
|
|
3199
|
-
let _ = 1;
|
|
3200
|
-
const Ye = 1e4;
|
|
3201
|
-
for (; _ <= Ye; ) {
|
|
3202
|
-
const xe = await P.list(a, {
|
|
3203
|
-
...M,
|
|
3204
|
-
page: _,
|
|
3205
|
-
page_size: w
|
|
3206
|
-
});
|
|
3207
|
-
R.push(...xe.data);
|
|
3208
|
-
const $e = xe.rows ?? R.length;
|
|
3209
|
-
if (xe.data.length === 0 || R.length >= $e) break;
|
|
3210
|
-
_++;
|
|
3211
|
-
}
|
|
3212
|
-
return R;
|
|
3213
|
-
}
|
|
3214
|
-
function be(w) {
|
|
3215
|
-
le.value = w, de && clearTimeout(de), de = setTimeout(() => {
|
|
3216
|
-
l.page = 1, pe();
|
|
3217
|
-
}, r);
|
|
3218
|
-
}
|
|
3219
|
-
function Se(w) {
|
|
3220
|
-
const M = w.target;
|
|
3221
|
-
be(M.value);
|
|
3222
|
-
}
|
|
3223
|
-
function ve(w) {
|
|
3224
|
-
l.page = w, pe();
|
|
3225
|
-
}
|
|
3226
|
-
function ge() {
|
|
3227
|
-
ve(1);
|
|
3228
|
-
}
|
|
3229
|
-
function Pe() {
|
|
3230
|
-
ve(l.totalPages);
|
|
3231
|
-
}
|
|
3232
|
-
function Ie(w) {
|
|
3233
|
-
l.page = w.page + 1, l.pageSize = w.rows, pe();
|
|
3234
|
-
}
|
|
3235
|
-
function Te(w) {
|
|
3236
|
-
f.field = w.sortField ?? null, f.order = w.sortOrder ?? 0, l.page = 1, pe();
|
|
3237
|
-
}
|
|
3238
|
-
function Ve() {
|
|
3239
|
-
const w = k();
|
|
3240
|
-
for (const M of Object.keys(w))
|
|
3241
|
-
p[M] = w[M];
|
|
3242
|
-
}
|
|
3243
|
-
function Ge(w, M) {
|
|
3244
|
-
p[w] = M;
|
|
3245
|
-
}
|
|
3246
|
-
function ot() {
|
|
3247
|
-
if (H.value = !1, c.value = null, U = null, Ve(), I) {
|
|
3248
|
-
const w = I();
|
|
3249
|
-
for (const [M, R] of Object.entries(w))
|
|
3250
|
-
p[M] = R;
|
|
3251
|
-
}
|
|
3252
|
-
W.value = !0;
|
|
3253
|
-
}
|
|
3254
|
-
function Je(w) {
|
|
3255
|
-
const M = {};
|
|
3256
|
-
for (const R of n) {
|
|
3257
|
-
let _ = w[R.field] !== void 0 ? w[R.field] : null;
|
|
3258
|
-
_ && (R.type === "date" || R.type === "datetime") && typeof _ == "string" && (_ = ft(_)), p[R.field] = _, M[R.field] = _;
|
|
3259
|
-
}
|
|
3260
|
-
U = M;
|
|
3261
|
-
}
|
|
3262
|
-
function lt(w) {
|
|
3263
|
-
H.value = !1, c.value = w, Je(w), W.value = !0;
|
|
3264
|
-
}
|
|
3265
|
-
function st(w) {
|
|
3266
|
-
H.value = !0, c.value = w, Je(w), W.value = !0;
|
|
3267
|
-
}
|
|
3268
|
-
function y(w) {
|
|
3269
|
-
H.value = !1, c.value = null, U = null, Ve();
|
|
3270
|
-
for (const M of n) {
|
|
3271
|
-
if (M.field === s) continue;
|
|
3272
|
-
let R = w[M.field] !== void 0 ? w[M.field] : p[M.field];
|
|
3273
|
-
R && (M.type === "date" || M.type === "datetime") && typeof R == "string" && (R = ft(R)), p[M.field] = R;
|
|
3274
|
-
}
|
|
3275
|
-
if (I) {
|
|
3276
|
-
const M = I();
|
|
3277
|
-
for (const [R, _] of Object.entries(M))
|
|
3278
|
-
p[R] = _;
|
|
3279
|
-
}
|
|
3280
|
-
W.value = !0;
|
|
3281
|
-
}
|
|
3282
|
-
function C(w) {
|
|
3283
|
-
const M = { ...w };
|
|
3284
|
-
for (const R of n) {
|
|
3285
|
-
const _ = M[R.field];
|
|
3286
|
-
if (R.type === "date" && _ instanceof Date ? M[R.field] = Et(_) : R.type === "datetime" && _ instanceof Date && (M[R.field] = Ft(_)), R.type === "fk" && _ !== null && typeof _ == "object") {
|
|
3287
|
-
const Ye = R.optionValue || "id";
|
|
3288
|
-
M[R.field] = _[Ye] ?? _;
|
|
3289
|
-
}
|
|
3290
|
-
(R.type === "mask" || R.type === "cpf_cnpj") && typeof _ == "string" && (M[R.field] = Ae(_));
|
|
3291
|
-
}
|
|
3292
|
-
return M;
|
|
3293
|
-
}
|
|
3294
|
-
async function Q() {
|
|
3295
|
-
for (const w of n) {
|
|
3296
|
-
if (w.validate) {
|
|
3297
|
-
const M = w.validate(p[w.field]);
|
|
3298
|
-
if (M)
|
|
3299
|
-
return B.error(M), null;
|
|
3300
|
-
}
|
|
3301
|
-
if (w.required) {
|
|
3302
|
-
const M = p[w.field];
|
|
3303
|
-
if (M == null || M === "")
|
|
3304
|
-
return B.error(`${w.label} é obrigatório`), null;
|
|
3305
|
-
}
|
|
3306
|
-
}
|
|
3307
|
-
te.value = !0;
|
|
3308
|
-
try {
|
|
3309
|
-
let w = C(p);
|
|
3310
|
-
if (!$.value && I && Object.assign(w, I()), $.value && u && U) {
|
|
3311
|
-
const $e = C(U);
|
|
3312
|
-
if (w = ml($e, w), Object.keys(w).length === 0 && !G) {
|
|
3313
|
-
W.value = !1;
|
|
3314
|
-
const Ee = c.value;
|
|
3315
|
-
return c.value = null, U = null, Ee;
|
|
3316
|
-
}
|
|
3317
|
-
}
|
|
3318
|
-
G && (w = G(w, $.value));
|
|
3319
|
-
const M = n.some(
|
|
3320
|
-
($e) => $e.type === "image" && w[$e.field] instanceof File
|
|
3321
|
-
);
|
|
3322
|
-
let R = w, _;
|
|
3323
|
-
if (M) {
|
|
3324
|
-
const $e = new Set(
|
|
3325
|
-
n.filter((Me) => Me.type === "image").map((Me) => Me.field)
|
|
3326
|
-
), Ee = new FormData();
|
|
3327
|
-
for (const [Me, Be] of Object.entries(w))
|
|
3328
|
-
if (Be != null)
|
|
3329
|
-
if (Be instanceof File)
|
|
3330
|
-
Ee.append(Me, Be);
|
|
3331
|
-
else {
|
|
3332
|
-
if ($e.has(Me))
|
|
3333
|
-
continue;
|
|
3334
|
-
Ee.append(Me, String(Be));
|
|
3335
|
-
}
|
|
3336
|
-
R = Ee, _ = { "Content-Type": "multipart/form-data" };
|
|
3337
|
-
}
|
|
3338
|
-
const Ye = _ ? { headers: _ } : void 0;
|
|
3339
|
-
let xe;
|
|
3340
|
-
if ($.value && c.value) {
|
|
3341
|
-
const $e = c.value[s];
|
|
3342
|
-
if (xe = await P.update(
|
|
3343
|
-
a,
|
|
3344
|
-
$e,
|
|
3345
|
-
R,
|
|
3346
|
-
Ye
|
|
3347
|
-
), !b) {
|
|
3348
|
-
const Ee = j.value.findIndex(
|
|
3349
|
-
(Me) => Me[s] === $e
|
|
3350
|
-
);
|
|
3351
|
-
Ee !== -1 && (j.value[Ee] = xe.data);
|
|
3352
|
-
}
|
|
3353
|
-
B.success(X.successUpdate);
|
|
3354
|
-
} else
|
|
3355
|
-
xe = await P.create(a, R, Ye), b || (j.value.unshift(xe.data), l.rows++), B.success(X.successCreate);
|
|
3356
|
-
return W.value = !1, c.value = null, U = null, b && await pe(), J && J(xe.data, $.value), xe.data;
|
|
3357
|
-
} catch (w) {
|
|
3358
|
-
return B.error(Ke(w, "Erro ao salvar registro")), null;
|
|
3359
|
-
} finally {
|
|
3360
|
-
te.value = !1;
|
|
3361
|
-
}
|
|
3362
|
-
}
|
|
3363
|
-
function L(w) {
|
|
3364
|
-
q(async () => {
|
|
3365
|
-
try {
|
|
3366
|
-
const M = w[s];
|
|
3367
|
-
await P.delete(a, M);
|
|
3368
|
-
const R = j.value.findIndex((_) => _[s] === M);
|
|
3369
|
-
R !== -1 && (j.value.splice(R, 1), l.rows--), B.success(X.successDelete), v && v(w);
|
|
3370
|
-
} catch (M) {
|
|
3371
|
-
B.error(Ke(M, "Erro ao excluir registro"));
|
|
3372
|
-
}
|
|
3373
|
-
}, X.deleteConfirmMessage);
|
|
3374
|
-
}
|
|
3375
|
-
return {
|
|
3376
|
-
items: j,
|
|
3377
|
-
extras: ee,
|
|
3378
|
-
loading: oe,
|
|
3379
|
-
saving: te,
|
|
3380
|
-
search: le,
|
|
3381
|
-
dialogVisible: W,
|
|
3382
|
-
editingItem: c,
|
|
3383
|
-
formData: p,
|
|
3384
|
-
pagination: l,
|
|
3385
|
-
sort: f,
|
|
3386
|
-
isEditing: $,
|
|
3387
|
-
isViewing: ue,
|
|
3388
|
-
viewMode: H,
|
|
3389
|
-
dialogTitle: me,
|
|
3390
|
-
isFirstPage: ke,
|
|
3391
|
-
isLastPage: ne,
|
|
3392
|
-
init: De,
|
|
3393
|
-
fetchItems: pe,
|
|
3394
|
-
fetchAll: Re,
|
|
3395
|
-
refresh: Ne,
|
|
3396
|
-
setSearch: be,
|
|
3397
|
-
onSearch: Se,
|
|
3398
|
-
onPage: Ie,
|
|
3399
|
-
onSort: Te,
|
|
3400
|
-
openCreateDialog: ot,
|
|
3401
|
-
openEditDialog: lt,
|
|
3402
|
-
openViewDialog: st,
|
|
3403
|
-
openDuplicateDialog: y,
|
|
3404
|
-
save: Q,
|
|
3405
|
-
confirmDelete: L,
|
|
3406
|
-
setFormField: Ge,
|
|
3407
|
-
resetForm: Ve,
|
|
3408
|
-
goToPage: ve,
|
|
3409
|
-
firstPage: ge,
|
|
3410
|
-
lastPage: Pe,
|
|
3411
|
-
config: e
|
|
3412
|
-
};
|
|
3413
|
-
}
|
|
3414
|
-
function ns(e) {
|
|
3415
|
-
const { endpoint: a, searchDebounce: t = 300, immediate: n = !1 } = e, s = Le(at);
|
|
3416
|
-
if (!s)
|
|
3417
|
-
throw new Error(
|
|
3418
|
-
"[wPrimeVueComponents] dataProvider não encontrado. Registre o WPrimeVuePlugin antes de usar useApi."
|
|
3419
|
-
);
|
|
3420
|
-
const r = s, u = Le(nt), b = e.pageSize ?? (u == null ? void 0 : u.defaultPageSize) ?? 20, d = K([]), x = K(!1), F = K(""), E = K({}), z = we({}), I = we({
|
|
3421
|
-
page: 1,
|
|
3422
|
-
pageSize: b,
|
|
3423
|
-
rows: 0,
|
|
3424
|
-
totalPages: 0
|
|
3425
|
-
}), G = we({
|
|
3426
|
-
field: null,
|
|
3427
|
-
order: 0
|
|
3428
|
-
});
|
|
3429
|
-
let J = null;
|
|
3430
|
-
async function v(q = {}) {
|
|
3431
|
-
x.value = !0;
|
|
3432
|
-
try {
|
|
3433
|
-
const j = {
|
|
3434
|
-
page: I.page,
|
|
3435
|
-
page_size: I.pageSize,
|
|
3436
|
-
...q
|
|
3437
|
-
};
|
|
3438
|
-
F.value && (j.search = F.value), G.field && G.order !== 0 && (j.ordering = G.order === -1 ? `-${G.field}` : G.field);
|
|
3439
|
-
for (const [oe, te] of Object.entries(z))
|
|
3440
|
-
te != null && te !== "" && (j[oe] = te);
|
|
3441
|
-
const ee = await r.list(a, j);
|
|
3442
|
-
d.value = ee.data, I.rows = ee.rows, ee.page && (I.page = ee.page), ee.page_size && (I.pageSize = ee.page_size), I.totalPages = Math.ceil(I.rows / I.pageSize) || 0, E.value = ee.extras ?? {};
|
|
3443
|
-
} finally {
|
|
3444
|
-
x.value = !1;
|
|
3445
|
-
}
|
|
3446
|
-
}
|
|
3447
|
-
async function D() {
|
|
3448
|
-
await v();
|
|
3449
|
-
}
|
|
3450
|
-
function P(q) {
|
|
3451
|
-
F.value = q, J && clearTimeout(J), J = setTimeout(() => {
|
|
3452
|
-
I.page = 1, v();
|
|
3453
|
-
}, t);
|
|
3454
|
-
}
|
|
3455
|
-
function V(q, j) {
|
|
3456
|
-
z[q] = j, I.page = 1, v();
|
|
3457
|
-
}
|
|
3458
|
-
function Z() {
|
|
3459
|
-
for (const q of Object.keys(z))
|
|
3460
|
-
delete z[q];
|
|
3461
|
-
I.page = 1, v();
|
|
3462
|
-
}
|
|
3463
|
-
function X(q) {
|
|
3464
|
-
I.page = q.page + 1, I.pageSize = q.rows, v();
|
|
3465
|
-
}
|
|
3466
|
-
function B(q) {
|
|
3467
|
-
G.field = q.sortField ?? null, G.order = q.sortOrder ?? 0, I.page = 1, v();
|
|
3468
|
-
}
|
|
3469
|
-
return n && v(), {
|
|
3470
|
-
items: d,
|
|
3471
|
-
loading: x,
|
|
3472
|
-
search: F,
|
|
3473
|
-
pagination: I,
|
|
3474
|
-
sort: G,
|
|
3475
|
-
extras: E,
|
|
3476
|
-
fetchItems: v,
|
|
3477
|
-
refresh: D,
|
|
3478
|
-
setSearch: P,
|
|
3479
|
-
setFilter: V,
|
|
3480
|
-
clearFilters: Z,
|
|
3481
|
-
onPage: X,
|
|
3482
|
-
onSort: B
|
|
3483
|
-
};
|
|
3484
|
-
}
|
|
3485
|
-
function pl(e) {
|
|
71
|
+
function S(e) {
|
|
3486
72
|
return e.split("?")[0].replace(/^\/+|\/+$/g, "").replace(/^api\/v\d+\//, "");
|
|
3487
73
|
}
|
|
3488
|
-
function
|
|
74
|
+
function h(e) {
|
|
3489
75
|
return typeof e == "string" ? { table: e } : e;
|
|
3490
76
|
}
|
|
3491
|
-
function
|
|
77
|
+
function y(e, a = 400) {
|
|
3492
78
|
return {
|
|
3493
79
|
response: {
|
|
3494
80
|
status: a,
|
|
@@ -3497,14 +83,14 @@ function Wt(e, a = 400) {
|
|
|
3497
83
|
message: e
|
|
3498
84
|
};
|
|
3499
85
|
}
|
|
3500
|
-
function
|
|
86
|
+
function g(e) {
|
|
3501
87
|
if (e instanceof FormData)
|
|
3502
|
-
throw
|
|
88
|
+
throw y(
|
|
3503
89
|
"SupabaseDataProvider nao envia FormData diretamente. Faça upload do arquivo no Storage e envie a URL/caminho no payload."
|
|
3504
90
|
);
|
|
3505
91
|
return e;
|
|
3506
92
|
}
|
|
3507
|
-
function
|
|
93
|
+
function f(e) {
|
|
3508
94
|
throw {
|
|
3509
95
|
response: {
|
|
3510
96
|
data: {
|
|
@@ -3517,120 +103,115 @@ function je(e) {
|
|
|
3517
103
|
message: (e == null ? void 0 : e.message) ?? "Erro ao consultar Supabase"
|
|
3518
104
|
};
|
|
3519
105
|
}
|
|
3520
|
-
function
|
|
3521
|
-
var s,
|
|
3522
|
-
const t =
|
|
3523
|
-
if (
|
|
3524
|
-
return
|
|
3525
|
-
if ((
|
|
106
|
+
function m(e, a) {
|
|
107
|
+
var s, n;
|
|
108
|
+
const t = S(e), r = (s = a.resources) == null ? void 0 : s[t];
|
|
109
|
+
if (r)
|
|
110
|
+
return h(r);
|
|
111
|
+
if ((n = a.allowedTables) != null && n.includes(t))
|
|
3526
112
|
return { table: t };
|
|
3527
|
-
throw
|
|
3528
|
-
`Recurso Supabase nao registrado para o endpoint "${e}".`,
|
|
3529
|
-
404
|
|
3530
|
-
);
|
|
113
|
+
throw y(`Recurso Supabase nao registrado para o endpoint "${e}".`, 404);
|
|
3531
114
|
}
|
|
3532
|
-
function
|
|
3533
|
-
const
|
|
3534
|
-
for (const [
|
|
3535
|
-
|
|
115
|
+
function E(e, a, t) {
|
|
116
|
+
const r = /* @__PURE__ */ new Set(["page", "page_size", "search", "ordering"]), s = { ...t.defaultFilters, ...a };
|
|
117
|
+
for (const [n, o] of Object.entries(s))
|
|
118
|
+
r.has(n) || o === null || o === void 0 || o === "" || (e = e.eq(n, o));
|
|
3536
119
|
return e;
|
|
3537
120
|
}
|
|
3538
|
-
function
|
|
121
|
+
function $(e, a, t) {
|
|
3539
122
|
if (typeof a != "string" || !a.trim() || !(t != null && t.length))
|
|
3540
123
|
return e;
|
|
3541
|
-
const
|
|
124
|
+
const r = a.trim().replace(/,/g, "\\,"), s = t.map((n) => `${n}.ilike.%${r}%`).join(",");
|
|
3542
125
|
return e.or(s);
|
|
3543
126
|
}
|
|
3544
|
-
function
|
|
127
|
+
function R(e, a) {
|
|
3545
128
|
const t = typeof e == "string" && e ? e : a;
|
|
3546
129
|
return t ? {
|
|
3547
130
|
field: t.startsWith("-") ? t.slice(1) : t,
|
|
3548
131
|
ascending: !t.startsWith("-")
|
|
3549
132
|
} : null;
|
|
3550
133
|
}
|
|
3551
|
-
function
|
|
3552
|
-
return e ? a.mapListItem ? e.map(
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
}
|
|
3557
|
-
) : e : [];
|
|
134
|
+
function z(e, a) {
|
|
135
|
+
return e ? a.mapListItem ? e.map((t) => {
|
|
136
|
+
var r;
|
|
137
|
+
return (r = a.mapListItem) == null ? void 0 : r.call(a, t);
|
|
138
|
+
}) : e : [];
|
|
3558
139
|
}
|
|
3559
|
-
function
|
|
140
|
+
function I(e) {
|
|
3560
141
|
const a = e.defaultSelect ?? "*";
|
|
3561
142
|
return {
|
|
3562
|
-
async list(t,
|
|
3563
|
-
var
|
|
3564
|
-
const s =
|
|
3565
|
-
let
|
|
3566
|
-
|
|
3567
|
-
const
|
|
3568
|
-
|
|
3569
|
-
const
|
|
3570
|
-
return
|
|
3571
|
-
data:
|
|
3572
|
-
page:
|
|
3573
|
-
page_size:
|
|
3574
|
-
rows:
|
|
143
|
+
async list(t, r = {}) {
|
|
144
|
+
var p;
|
|
145
|
+
const s = m(t, e), n = Math.max(Number(r.page ?? 1), 1), o = Math.max(Number(r.page_size ?? 20), 1), i = (n - 1) * o, l = i + o - 1;
|
|
146
|
+
let c = e.client.from(s.table).select(s.select ?? a, { count: "exact" });
|
|
147
|
+
c = E(c, r, s), c = $(c, r.search, s.searchFields);
|
|
148
|
+
const u = R(r.ordering, s.defaultOrdering);
|
|
149
|
+
u && (c = c.order(u.field, { ascending: u.ascending }));
|
|
150
|
+
const d = await c.range(i, l);
|
|
151
|
+
return d.error && f(d.error), {
|
|
152
|
+
data: z(d.data, s),
|
|
153
|
+
page: n,
|
|
154
|
+
page_size: o,
|
|
155
|
+
rows: d.count ?? ((p = d.data) == null ? void 0 : p.length) ?? 0,
|
|
3575
156
|
extras: {}
|
|
3576
157
|
};
|
|
3577
158
|
},
|
|
3578
|
-
async get(t,
|
|
3579
|
-
const
|
|
3580
|
-
return
|
|
159
|
+
async get(t, r, s) {
|
|
160
|
+
const n = m(t, e), o = n.pk ?? "id", i = await e.client.from(n.table).select(n.select ?? a).eq(o, r).single();
|
|
161
|
+
return i.error && f(i.error), { data: i.data };
|
|
3581
162
|
},
|
|
3582
|
-
async create(t,
|
|
3583
|
-
const
|
|
3584
|
-
return
|
|
163
|
+
async create(t, r, s) {
|
|
164
|
+
const n = m(t, e), o = g(r), i = n.mapPayload ? n.mapPayload(o, "create") : o, l = await e.client.from(n.table).insert(i).select(n.select ?? a).single();
|
|
165
|
+
return l.error && f(l.error), { data: l.data };
|
|
3585
166
|
},
|
|
3586
|
-
async update(t,
|
|
3587
|
-
const
|
|
3588
|
-
return
|
|
167
|
+
async update(t, r, s, n) {
|
|
168
|
+
const o = m(t, e), i = o.pk ?? "id", l = g(s), c = o.mapPayload ? o.mapPayload(l, "update") : l, u = await e.client.from(o.table).update(c).eq(i, r).select(o.select ?? a).single();
|
|
169
|
+
return u.error && f(u.error), { data: u.data };
|
|
3589
170
|
},
|
|
3590
|
-
async delete(t,
|
|
3591
|
-
const s =
|
|
3592
|
-
|
|
171
|
+
async delete(t, r) {
|
|
172
|
+
const s = m(t, e), n = s.pk ?? "id", o = s.softDelete === !0 ? { is_active: !1 } : typeof s.softDelete == "object" ? s.softDelete : null, i = o ? await e.client.from(s.table).update(o).eq(n, r) : await e.client.from(s.table).delete().eq(n, r);
|
|
173
|
+
i.error && f(i.error);
|
|
3593
174
|
}
|
|
3594
175
|
};
|
|
3595
176
|
}
|
|
3596
177
|
export {
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
178
|
+
pe as DEFAULT_CRUD_LABELS,
|
|
179
|
+
N as WActionBar,
|
|
180
|
+
C as WAutoCompleteFK,
|
|
181
|
+
v as WCrudColumnRenderer,
|
|
182
|
+
P as WCrudFormDialog,
|
|
183
|
+
A as WCrudView,
|
|
184
|
+
O as WDetailHeader,
|
|
185
|
+
V as WEmptyState,
|
|
186
|
+
k as WFormRenderer,
|
|
187
|
+
q as WFormSection,
|
|
188
|
+
H as WInfoCard,
|
|
189
|
+
j as WKpiCard,
|
|
190
|
+
B as WKpiGrid,
|
|
191
|
+
F as WMoneyInput,
|
|
192
|
+
U as WPageHeader,
|
|
193
|
+
Y as WPrimeVuePlugin,
|
|
194
|
+
G as WProgressFlow,
|
|
195
|
+
X as WSectionHeader,
|
|
196
|
+
J as WStatusTag,
|
|
197
|
+
b as WTransferList,
|
|
198
|
+
_ as W_AXIOS_KEY,
|
|
199
|
+
w as W_CONFIG_KEY,
|
|
200
|
+
W as W_DATA_PROVIDER_KEY,
|
|
201
|
+
D as createAxiosDataProvider,
|
|
202
|
+
I as createSupabaseDataProvider,
|
|
203
|
+
Q as downloadCsv,
|
|
204
|
+
ce as extractApiError,
|
|
205
|
+
Z as mapApiFieldToColumnDef,
|
|
206
|
+
ee as mapApiFieldToFieldDef,
|
|
207
|
+
ae as mapApiFieldsToColumnDefs,
|
|
208
|
+
te as mapApiFieldsToFieldDefs,
|
|
209
|
+
re as toCsv,
|
|
210
|
+
ne as useApi,
|
|
211
|
+
le as useApiError,
|
|
212
|
+
ue as useAppConfirm,
|
|
213
|
+
de as useAppToast,
|
|
214
|
+
oe as useCrudManager,
|
|
215
|
+
fe as useFormatters
|
|
3635
216
|
};
|
|
3636
217
|
//# sourceMappingURL=index.js.map
|