@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
|
@@ -0,0 +1,3024 @@
|
|
|
1
|
+
import { defineComponent as le, openBlock as o, createElementBlock as u, createBlock as $, unref as d, toDisplayString as E, inject as Ze, ref as N, computed as R, watch as Ce, reactive as ke, resolveDirective as Qe, Fragment as K, createElementVNode as c, mergeProps as vt, createVNode as S, withDirectives as ue, withCtx as G, createCommentVNode as p, renderList as _, normalizeStyle as me, createTextVNode as be, onBeforeUnmount as pt, normalizeClass as X, renderSlot as A, isRef as ht, withModifiers as gt, createSlots as Be, normalizeProps as Le, guardReactiveProps as Ne, useSlots as yt, onMounted as bt, createStaticVNode as wt } from "vue";
|
|
2
|
+
import _e from "primevue/datatable";
|
|
3
|
+
import $e from "primevue/column";
|
|
4
|
+
import L from "primevue/button";
|
|
5
|
+
import de from "primevue/inputtext";
|
|
6
|
+
import Te from "primevue/inputnumber";
|
|
7
|
+
import ze from "primevue/select";
|
|
8
|
+
import Se from "primevue/iconfield";
|
|
9
|
+
import De from "primevue/inputicon";
|
|
10
|
+
import kt from "primevue/paginator";
|
|
11
|
+
import $t from "primevue/contextmenu";
|
|
12
|
+
import et from "primevue/tag";
|
|
13
|
+
import { c as Oe, b as xt, a as Ct, e as qe } from "./useApiError-C7rPzGrF.js";
|
|
14
|
+
import je from "primevue/dialog";
|
|
15
|
+
import Vt from "primevue/textarea";
|
|
16
|
+
import tt from "primevue/autocomplete";
|
|
17
|
+
import He from "primevue/datepicker";
|
|
18
|
+
import St from "primevue/toggleswitch";
|
|
19
|
+
import Dt from "primevue/colorpicker";
|
|
20
|
+
import Et from "primevue/password";
|
|
21
|
+
import { W as Pt } from "./plugin-BKa0eSEM.js";
|
|
22
|
+
import Rt from "primevue/inputgroup";
|
|
23
|
+
import Ke from "primevue/inputgroupaddon";
|
|
24
|
+
import Ft from "primevue/slider";
|
|
25
|
+
import Re from "primevue/skeleton";
|
|
26
|
+
const Mt = {
|
|
27
|
+
key: 0,
|
|
28
|
+
class: "text-muted-color text-xs"
|
|
29
|
+
}, It = ["src", "alt"], At = {
|
|
30
|
+
key: 3,
|
|
31
|
+
class: "text-muted-color tabular-nums text-[0.8125rem]"
|
|
32
|
+
}, Ut = {
|
|
33
|
+
key: 4,
|
|
34
|
+
class: "text-muted-color tabular-nums text-[0.8125rem]"
|
|
35
|
+
}, Bt = {
|
|
36
|
+
key: 5,
|
|
37
|
+
class: "font-semibold tabular-nums text-[0.8125rem]"
|
|
38
|
+
}, Lt = {
|
|
39
|
+
key: 6,
|
|
40
|
+
class: "font-semibold tabular-nums text-[0.8125rem]"
|
|
41
|
+
}, Nt = {
|
|
42
|
+
key: 7,
|
|
43
|
+
class: "text-[0.8125rem]"
|
|
44
|
+
}, We = /* @__PURE__ */ le({
|
|
45
|
+
__name: "WCrudColumnRenderer",
|
|
46
|
+
props: {
|
|
47
|
+
column: {},
|
|
48
|
+
value: {},
|
|
49
|
+
rowData: {}
|
|
50
|
+
},
|
|
51
|
+
setup(e) {
|
|
52
|
+
const { formatDate: a, formatDateTime: l, formatCurrency: n, formatNumber: i } = Oe();
|
|
53
|
+
return (f, g) => e.value == null ? (o(), u("span", Mt, "—")) : e.column.type === "image" ? (o(), u("img", {
|
|
54
|
+
key: 1,
|
|
55
|
+
src: String(e.value),
|
|
56
|
+
alt: e.column.header,
|
|
57
|
+
class: "size-9 rounded-lg object-cover ring-1 ring-surface-200 dark:ring-surface-700"
|
|
58
|
+
}, null, 8, It)) : e.column.type === "boolean" ? (o(), $(d(et), {
|
|
59
|
+
key: 2,
|
|
60
|
+
value: e.column.tagValue ? e.column.tagValue(e.value, e.rowData) : e.value ? "Ativo" : "Inativo",
|
|
61
|
+
severity: e.column.tagSeverity ? e.column.tagSeverity(e.value, e.rowData) : e.value ? "success" : "danger",
|
|
62
|
+
class: "text-xs"
|
|
63
|
+
}, null, 8, ["value", "severity"])) : e.column.type === "date" ? (o(), u("span", At, E(d(a)(e.value)), 1)) : e.column.type === "datetime" ? (o(), u("span", Ut, E(d(l)(e.value)), 1)) : e.column.type === "currency" ? (o(), u("span", Bt, E(d(n)(e.value)), 1)) : e.column.type === "number" ? (o(), u("span", Lt, E(e.column.format ? e.column.format(e.value, e.rowData) : d(i)(e.value, e.column.decimals ?? 0)), 1)) : (o(), u("span", Nt, E(e.column.format ? e.column.format(e.value, e.rowData) : e.value), 1));
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
var Tt = Object.defineProperty, zt = (e, a, l) => a in e ? Tt(e, a, { enumerable: !0, configurable: !0, writable: !0, value: l }) : e[a] = l, Ve = (e, a, l) => zt(e, typeof a != "symbol" ? a + "" : a, l);
|
|
67
|
+
const Ge = {
|
|
68
|
+
"#": { pattern: /[0-9]/ },
|
|
69
|
+
"@": { pattern: /[a-zA-Z]/ },
|
|
70
|
+
"*": { pattern: /[a-zA-Z0-9]/ }
|
|
71
|
+
}, Ye = (e, a, l) => e.replaceAll(a, "").replace(l, ".").replace("..", ".").replace(/[^.\d]/g, ""), Xe = (e, a, l) => {
|
|
72
|
+
var n;
|
|
73
|
+
return new Intl.NumberFormat(((n = l.number) == null ? void 0 : n.locale) ?? "en", {
|
|
74
|
+
minimumFractionDigits: e,
|
|
75
|
+
maximumFractionDigits: a,
|
|
76
|
+
roundingMode: "trunc"
|
|
77
|
+
});
|
|
78
|
+
}, Wt = (e, a = !0, l) => {
|
|
79
|
+
var n, i, f, g;
|
|
80
|
+
const x = ((n = l.number) == null ? void 0 : n.unsigned) !== !0 && e.startsWith("-") ? "-" : "", h = ((i = l.number) == null ? void 0 : i.fraction) ?? 0;
|
|
81
|
+
let V = Xe(0, h, l);
|
|
82
|
+
const z = V.formatToParts(1000.12), D = ((f = z.find((M) => M.type === "group")) == null ? void 0 : f.value) ?? " ", H = ((g = z.find((M) => M.type === "decimal")) == null ? void 0 : g.value) ?? ".", J = Ye(e, D, H);
|
|
83
|
+
if (Number.isNaN(parseFloat(J))) return x;
|
|
84
|
+
const j = J.split(".");
|
|
85
|
+
if (j[1] != null && j[1].length >= 1) {
|
|
86
|
+
const M = j[1].length <= h ? j[1].length : h;
|
|
87
|
+
V = Xe(M, h, l);
|
|
88
|
+
}
|
|
89
|
+
let T = V.format(parseFloat(J));
|
|
90
|
+
return a ? h > 0 && J.endsWith(".") && !J.slice(0, -1).includes(".") && (T += H) : T = Ye(T, D, H), x + T;
|
|
91
|
+
}, lt = (e) => JSON.parse(e.replaceAll("'", '"')), Ot = (e, a = {}) => {
|
|
92
|
+
const l = { ...a };
|
|
93
|
+
e.dataset.maska != null && e.dataset.maska !== "" && (l.mask = jt(e.dataset.maska)), e.dataset.maskaEager != null && (l.eager = Fe(e.dataset.maskaEager)), e.dataset.maskaReversed != null && (l.reversed = Fe(e.dataset.maskaReversed)), e.dataset.maskaTokensReplace != null && (l.tokensReplace = Fe(e.dataset.maskaTokensReplace)), e.dataset.maskaTokens != null && (l.tokens = qt(e.dataset.maskaTokens));
|
|
94
|
+
const n = {};
|
|
95
|
+
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 = Fe(e.dataset.maskaNumberUnsigned)), (e.dataset.maskaNumber != null || Object.values(n).length > 0) && (l.number = n), l;
|
|
96
|
+
}, Fe = (e) => e !== "" ? !!JSON.parse(e) : !0, jt = (e) => e.startsWith("[") && e.endsWith("]") ? lt(e) : e, qt = (e) => {
|
|
97
|
+
if (e.startsWith("{") && e.endsWith("}"))
|
|
98
|
+
return lt(e);
|
|
99
|
+
const a = {};
|
|
100
|
+
return e.split("|").forEach((l) => {
|
|
101
|
+
const n = l.split(":");
|
|
102
|
+
a[n[0]] = {
|
|
103
|
+
pattern: at() ? new RegExp(n[1], "u") : new RegExp(n[1]),
|
|
104
|
+
optional: n[2] === "optional",
|
|
105
|
+
multiple: n[2] === "multiple",
|
|
106
|
+
repeated: n[2] === "repeated"
|
|
107
|
+
};
|
|
108
|
+
}), a;
|
|
109
|
+
}, at = () => {
|
|
110
|
+
try {
|
|
111
|
+
return new RegExp("\\p{L}", "u"), !0;
|
|
112
|
+
} catch {
|
|
113
|
+
return !1;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
class Ht {
|
|
117
|
+
constructor(a = {}) {
|
|
118
|
+
Ve(this, "opts", {}), Ve(this, "memo", /* @__PURE__ */ new Map());
|
|
119
|
+
const l = { ...a };
|
|
120
|
+
if (l.tokens != null) {
|
|
121
|
+
l.tokens = l.tokensReplace ? { ...l.tokens } : { ...Ge, ...l.tokens };
|
|
122
|
+
for (const n of Object.values(l.tokens))
|
|
123
|
+
typeof n.pattern == "string" && (n.pattern = at() ? new RegExp(n.pattern, "u") : new RegExp(n.pattern));
|
|
124
|
+
} else
|
|
125
|
+
l.tokens = Ge;
|
|
126
|
+
Array.isArray(l.mask) && (l.mask.length > 1 ? l.mask = [...l.mask].sort((n, i) => n.length - i.length) : l.mask = l.mask[0] ?? ""), l.mask === "" && (l.mask = null), this.opts = l;
|
|
127
|
+
}
|
|
128
|
+
masked(a) {
|
|
129
|
+
return this.process(String(a), this.findMask(String(a)));
|
|
130
|
+
}
|
|
131
|
+
unmasked(a) {
|
|
132
|
+
return this.process(String(a), this.findMask(String(a)), !1);
|
|
133
|
+
}
|
|
134
|
+
isEager() {
|
|
135
|
+
return this.opts.eager === !0;
|
|
136
|
+
}
|
|
137
|
+
isReversed() {
|
|
138
|
+
return this.opts.reversed === !0;
|
|
139
|
+
}
|
|
140
|
+
completed(a) {
|
|
141
|
+
const l = this.findMask(String(a));
|
|
142
|
+
if (this.opts.mask == null || l == null) return !1;
|
|
143
|
+
const n = this.process(String(a), l).length;
|
|
144
|
+
return typeof this.opts.mask == "string" ? n >= this.opts.mask.length : n >= l.length;
|
|
145
|
+
}
|
|
146
|
+
findMask(a) {
|
|
147
|
+
const l = this.opts.mask;
|
|
148
|
+
if (l == null)
|
|
149
|
+
return null;
|
|
150
|
+
if (typeof l == "string")
|
|
151
|
+
return l;
|
|
152
|
+
if (typeof l == "function")
|
|
153
|
+
return l(a);
|
|
154
|
+
const n = this.process(a, l.slice(-1).pop() ?? "", !1);
|
|
155
|
+
return l.find((i) => this.process(a, i, !1).length >= n.length) ?? "";
|
|
156
|
+
}
|
|
157
|
+
escapeMask(a) {
|
|
158
|
+
const l = [], n = [];
|
|
159
|
+
return a.split("").forEach((i, f) => {
|
|
160
|
+
i === "!" && a[f - 1] !== "!" ? n.push(f - n.length) : l.push(i);
|
|
161
|
+
}), { mask: l.join(""), escaped: n };
|
|
162
|
+
}
|
|
163
|
+
process(a, l, n = !0) {
|
|
164
|
+
if (this.opts.number != null) return Wt(a, n, this.opts);
|
|
165
|
+
if (l == null) return a;
|
|
166
|
+
const i = `v=${a},mr=${l},m=${n ? 1 : 0}`;
|
|
167
|
+
if (this.memo.has(i)) return this.memo.get(i);
|
|
168
|
+
const { mask: f, escaped: g } = this.escapeMask(l), x = [], h = this.opts.tokens != null ? this.opts.tokens : {}, V = this.isReversed() ? -1 : 1, z = this.isReversed() ? "unshift" : "push", D = this.isReversed() ? 0 : f.length - 1, H = this.isReversed() ? () => M > -1 && I > -1 : () => M < f.length && I < a.length, J = (P) => !this.isReversed() && P <= D || this.isReversed() && P >= D;
|
|
169
|
+
let j, T = -1, M = this.isReversed() ? f.length - 1 : 0, I = this.isReversed() ? a.length - 1 : 0, B = !1;
|
|
170
|
+
for (; H(); ) {
|
|
171
|
+
const P = f.charAt(M), Y = h[P], ee = (Y == null ? void 0 : Y.transform) != null ? Y.transform(a.charAt(I)) : a.charAt(I);
|
|
172
|
+
if (!g.includes(M) && Y != null ? (ee.match(Y.pattern) != null ? (x[z](ee), Y.repeated ? (T === -1 ? T = M : M === D && M !== T && (M = T - V), D === T && (M -= V)) : Y.multiple && (B = !0, M -= V), M += V) : Y.multiple ? B && (M += V, I -= V, B = !1) : ee === j ? j = void 0 : Y.optional && (M += V, I -= V), I += V) : (n && !this.isEager() && x[z](P), ee === P && !this.isEager() ? I += V : j = P, this.isEager() || (M += V)), this.isEager())
|
|
173
|
+
for (; J(M) && (h[f.charAt(M)] == null || g.includes(M)); ) {
|
|
174
|
+
if (n) {
|
|
175
|
+
if (x[z](f.charAt(M)), a.charAt(I) === f.charAt(M)) {
|
|
176
|
+
M += V, I += V;
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
} else f.charAt(M) === a.charAt(I) && (I += V);
|
|
180
|
+
M += V;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return this.memo.set(i, x.join("")), this.memo.get(i);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
class Kt {
|
|
187
|
+
constructor(a, l = {}) {
|
|
188
|
+
Ve(this, "items", /* @__PURE__ */ new Map()), Ve(this, "eventAbortController"), Ve(this, "onInput", (n) => {
|
|
189
|
+
if (n instanceof CustomEvent && n.type === "input" && !n.isTrusted && !n.bubbles)
|
|
190
|
+
return;
|
|
191
|
+
const i = n.target, f = this.items.get(i);
|
|
192
|
+
if (f === void 0) return;
|
|
193
|
+
const g = "inputType" in n && n.inputType.startsWith("delete"), x = f.isEager(), h = g && x && f.unmasked(i.value) === "" ? "" : i.value;
|
|
194
|
+
this.fixCursor(i, g, () => this.setValue(i, h));
|
|
195
|
+
}), this.options = l, this.eventAbortController = new AbortController(), this.init(this.getInputs(a));
|
|
196
|
+
}
|
|
197
|
+
update(a = {}) {
|
|
198
|
+
this.options = { ...a }, this.init(Array.from(this.items.keys()));
|
|
199
|
+
}
|
|
200
|
+
updateValue(a) {
|
|
201
|
+
var l;
|
|
202
|
+
a.value !== "" && a.value !== ((l = this.processInput(a)) == null ? void 0 : l.masked) && this.setValue(a, a.value);
|
|
203
|
+
}
|
|
204
|
+
destroy() {
|
|
205
|
+
this.eventAbortController.abort(), this.items.clear();
|
|
206
|
+
}
|
|
207
|
+
init(a) {
|
|
208
|
+
const l = this.getOptions(this.options);
|
|
209
|
+
for (const n of a) {
|
|
210
|
+
if (!this.items.has(n)) {
|
|
211
|
+
const { signal: f } = this.eventAbortController;
|
|
212
|
+
n.addEventListener("input", this.onInput, { capture: !0, signal: f });
|
|
213
|
+
}
|
|
214
|
+
const i = new Ht(Ot(n, l));
|
|
215
|
+
this.items.set(n, i), queueMicrotask(() => this.updateValue(n)), n.selectionStart === null && i.isEager() && console.warn("Maska: input of `%s` type is not supported", n.type);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
getInputs(a) {
|
|
219
|
+
return typeof a == "string" ? Array.from(document.querySelectorAll(a)) : "length" in a ? Array.from(a) : [a];
|
|
220
|
+
}
|
|
221
|
+
getOptions(a) {
|
|
222
|
+
const { onMaska: l, preProcess: n, postProcess: i, ...f } = a;
|
|
223
|
+
return f;
|
|
224
|
+
}
|
|
225
|
+
fixCursor(a, l, n) {
|
|
226
|
+
var i, f;
|
|
227
|
+
const g = a.selectionStart, x = a.value;
|
|
228
|
+
if (n(), g === null || g === x.length && !l) return;
|
|
229
|
+
const h = a.value, V = x.slice(0, g), z = h.slice(0, g), D = (i = this.processInput(a, V)) == null ? void 0 : i.unmasked, H = (f = this.processInput(a, z)) == null ? void 0 : f.unmasked;
|
|
230
|
+
if (D === void 0 || H === void 0) return;
|
|
231
|
+
let J = g;
|
|
232
|
+
V !== z && (J += l ? h.length - x.length : D.length - H.length), a.setSelectionRange(J, J);
|
|
233
|
+
}
|
|
234
|
+
setValue(a, l) {
|
|
235
|
+
const n = this.processInput(a, l);
|
|
236
|
+
n !== void 0 && (a.value = n.masked, this.options.onMaska != null && (Array.isArray(this.options.onMaska) ? this.options.onMaska.forEach((i) => i(n)) : this.options.onMaska(n)), a.dispatchEvent(new CustomEvent("maska", { detail: n })), a.dispatchEvent(new CustomEvent("input", { detail: n.masked })));
|
|
237
|
+
}
|
|
238
|
+
processInput(a, l) {
|
|
239
|
+
const n = this.items.get(a);
|
|
240
|
+
if (n === void 0) return;
|
|
241
|
+
let i = l ?? a.value;
|
|
242
|
+
this.options.preProcess != null && (i = this.options.preProcess(i));
|
|
243
|
+
let f = n.masked(i);
|
|
244
|
+
return this.options.postProcess != null && (f = this.options.postProcess(f)), {
|
|
245
|
+
masked: f,
|
|
246
|
+
unmasked: n.unmasked(i),
|
|
247
|
+
completed: n.completed(i)
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
const Ae = /* @__PURE__ */ new WeakMap(), Gt = (e, a) => {
|
|
252
|
+
if (e.arg == null || e.instance == null) return;
|
|
253
|
+
const l = "setup" in e.instance.$.type;
|
|
254
|
+
e.arg in e.instance ? e.instance[e.arg] = a : l && console.warn("Maska: please expose `%s` using defineExpose", e.arg);
|
|
255
|
+
}, Ue = (e, a) => {
|
|
256
|
+
var l;
|
|
257
|
+
const n = e instanceof HTMLInputElement ? e : e.querySelector("input");
|
|
258
|
+
if (n == null || (n == null ? void 0 : n.type) === "file") return;
|
|
259
|
+
let i = {};
|
|
260
|
+
if (a.value != null && (i = typeof a.value == "string" ? { mask: a.value } : { ...a.value }), a.arg != null) {
|
|
261
|
+
const f = (g) => {
|
|
262
|
+
const x = a.modifiers.unmasked ? g.unmasked : a.modifiers.completed ? g.completed : g.masked;
|
|
263
|
+
Gt(a, x);
|
|
264
|
+
};
|
|
265
|
+
i.onMaska = i.onMaska == null ? f : Array.isArray(i.onMaska) ? [...i.onMaska, f] : [i.onMaska, f];
|
|
266
|
+
}
|
|
267
|
+
Ae.has(n) ? (l = Ae.get(n)) == null || l.update(i) : Ae.set(n, new Kt(n, i));
|
|
268
|
+
}, Yt = {
|
|
269
|
+
string: "text",
|
|
270
|
+
integer: "number",
|
|
271
|
+
decimal: "number",
|
|
272
|
+
float: "number",
|
|
273
|
+
boolean: "switch",
|
|
274
|
+
choice: "select",
|
|
275
|
+
fk: "fk",
|
|
276
|
+
date: "date",
|
|
277
|
+
datetime: "datetime",
|
|
278
|
+
email: "email",
|
|
279
|
+
url: "text",
|
|
280
|
+
slug: "text",
|
|
281
|
+
text: "textarea"
|
|
282
|
+
};
|
|
283
|
+
function Xt(e) {
|
|
284
|
+
var n;
|
|
285
|
+
const a = Yt[e.type] ?? "text", l = {
|
|
286
|
+
field: e.name,
|
|
287
|
+
label: e.label,
|
|
288
|
+
type: a,
|
|
289
|
+
required: e.required ?? !1
|
|
290
|
+
};
|
|
291
|
+
return (e.type === "decimal" || e.type === "float") && (l.minFractionDigits = 2, l.maxFractionDigits = 2), e.type === "boolean" && (l.defaultValue = !1), e.type === "choice" && ((n = e.choices) != null && n.length) && (l.options = e.choices.map((i) => ({
|
|
292
|
+
label: i.label,
|
|
293
|
+
value: i.value
|
|
294
|
+
}))), e.type === "fk" && (l.endpoint = e.endpoint, e.option_label && (l.optionLabel = e.option_label), e.option_value && (l.optionValue = e.option_value)), l;
|
|
295
|
+
}
|
|
296
|
+
function Jt(e) {
|
|
297
|
+
return e.filter((a) => !a.read_only && a.name !== "id").map(Xt);
|
|
298
|
+
}
|
|
299
|
+
const Zt = {
|
|
300
|
+
boolean: "boolean",
|
|
301
|
+
date: "date",
|
|
302
|
+
datetime: "datetime",
|
|
303
|
+
decimal: "number",
|
|
304
|
+
float: "number",
|
|
305
|
+
integer: "number"
|
|
306
|
+
};
|
|
307
|
+
function Qt(e) {
|
|
308
|
+
return {
|
|
309
|
+
field: e.type === "fk" ? `${e.name}_nome` : e.name,
|
|
310
|
+
header: e.label,
|
|
311
|
+
type: Zt[e.type],
|
|
312
|
+
sortable: !0
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
function _t(e, a = 6) {
|
|
316
|
+
return e.filter((l) => !l.read_only && l.name !== "id").slice(0, a).map(Qt);
|
|
317
|
+
}
|
|
318
|
+
const el = ["disabled"], tl = { class: "w-autocompletefk-toolbar" }, ll = { class: "w-autocompletefk-toolbar-actions" }, al = { class: "flex items-center justify-end gap-1" }, ol = { class: "w-autocompletefk-footer" }, nl = /* @__PURE__ */ le({
|
|
319
|
+
inheritAttrs: !1,
|
|
320
|
+
__name: "WAutoCompleteFK",
|
|
321
|
+
props: {
|
|
322
|
+
modelValue: {},
|
|
323
|
+
endpoint: {},
|
|
324
|
+
endpointParams: {},
|
|
325
|
+
drilldown: {},
|
|
326
|
+
optionLabel: { default: "nome" },
|
|
327
|
+
optionValue: { default: "id" },
|
|
328
|
+
placeholder: { default: "Buscar..." },
|
|
329
|
+
blockedPlaceholder: {},
|
|
330
|
+
disabled: { type: Boolean, default: !1 },
|
|
331
|
+
showClear: { type: Boolean, default: !0 },
|
|
332
|
+
forceSelection: { type: Boolean, default: !0 },
|
|
333
|
+
columns: {},
|
|
334
|
+
minLength: { default: 0 },
|
|
335
|
+
dialogHeader: {},
|
|
336
|
+
canCreate: { type: Boolean, default: void 0 },
|
|
337
|
+
canEdit: { type: Boolean, default: void 0 },
|
|
338
|
+
canDelete: { type: Boolean, default: void 0 },
|
|
339
|
+
crudFields: {},
|
|
340
|
+
crudColumns: {},
|
|
341
|
+
dialogWidth: { default: "480px" }
|
|
342
|
+
},
|
|
343
|
+
emits: ["update:modelValue"],
|
|
344
|
+
setup(e, { emit: a }) {
|
|
345
|
+
const l = e, n = a, i = Ze(Pt);
|
|
346
|
+
if (!i)
|
|
347
|
+
throw new Error("[wPrimeVueComponents] dataProvider não encontrado. Registre o WPrimeVuePlugin.");
|
|
348
|
+
const f = i, g = xt(), { confirmDelete: x } = Ct(), h = N(null), V = N([]), z = N(!1);
|
|
349
|
+
let D = null;
|
|
350
|
+
function H(v) {
|
|
351
|
+
return v == null || v === "";
|
|
352
|
+
}
|
|
353
|
+
function J(v) {
|
|
354
|
+
if (v && typeof v == "object") {
|
|
355
|
+
const y = v;
|
|
356
|
+
return y.id ?? y.value ?? y;
|
|
357
|
+
}
|
|
358
|
+
return v;
|
|
359
|
+
}
|
|
360
|
+
const j = R(() => {
|
|
361
|
+
const v = l.drilldown;
|
|
362
|
+
return v ? Array.isArray(v) ? v : [v] : [];
|
|
363
|
+
}), T = R(
|
|
364
|
+
() => j.value.some(
|
|
365
|
+
(v) => (v.required ?? !0) && H(J(v.value))
|
|
366
|
+
)
|
|
367
|
+
);
|
|
368
|
+
function M() {
|
|
369
|
+
const v = {};
|
|
370
|
+
for (const y of j.value) {
|
|
371
|
+
const O = J(y.value);
|
|
372
|
+
H(O) || (v[y.field] = O);
|
|
373
|
+
}
|
|
374
|
+
return v;
|
|
375
|
+
}
|
|
376
|
+
const I = R(
|
|
377
|
+
() => T.value && l.blockedPlaceholder ? l.blockedPlaceholder : l.placeholder
|
|
378
|
+
);
|
|
379
|
+
async function B(v) {
|
|
380
|
+
try {
|
|
381
|
+
const y = await f.get(l.endpoint, v);
|
|
382
|
+
h.value = y.data;
|
|
383
|
+
} catch {
|
|
384
|
+
h.value = null;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
async function P(v) {
|
|
388
|
+
if (T.value) {
|
|
389
|
+
V.value = [];
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
z.value = !0;
|
|
393
|
+
try {
|
|
394
|
+
const y = {
|
|
395
|
+
page_size: 20,
|
|
396
|
+
...l.endpointParams,
|
|
397
|
+
...M()
|
|
398
|
+
};
|
|
399
|
+
v && (y.search = v);
|
|
400
|
+
const O = await f.list(l.endpoint, y);
|
|
401
|
+
V.value = O.data;
|
|
402
|
+
} catch {
|
|
403
|
+
V.value = [];
|
|
404
|
+
} finally {
|
|
405
|
+
z.value = !1;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
function Y(v) {
|
|
409
|
+
const y = v.query || "";
|
|
410
|
+
if (y.length < l.minLength) {
|
|
411
|
+
V.value = [];
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
D && clearTimeout(D), D = setTimeout(() => P(y), 300);
|
|
415
|
+
}
|
|
416
|
+
function ee(v) {
|
|
417
|
+
h.value = v.value, n("update:modelValue", v.value);
|
|
418
|
+
}
|
|
419
|
+
function W() {
|
|
420
|
+
h.value = null, n("update:modelValue", null);
|
|
421
|
+
}
|
|
422
|
+
Ce(
|
|
423
|
+
() => l.modelValue,
|
|
424
|
+
async (v) => {
|
|
425
|
+
if (v != null) {
|
|
426
|
+
if (typeof v == "object" && v !== null && l.optionLabel in v) {
|
|
427
|
+
h.value = v;
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
(!h.value || h.value[l.optionValue] !== v) && await B(v);
|
|
431
|
+
} else
|
|
432
|
+
h.value = null;
|
|
433
|
+
},
|
|
434
|
+
{ immediate: !0 }
|
|
435
|
+
);
|
|
436
|
+
const ne = N(!1), ae = N([]), ve = N(!1), Z = N(""), ie = N(1), ge = N(15), te = N(0), Q = N(null), se = N(null), ce = N(0);
|
|
437
|
+
let he = null;
|
|
438
|
+
const m = N([]), w = R(() => {
|
|
439
|
+
var v;
|
|
440
|
+
return (v = l.crudFields) != null && v.length ? !0 : m.value.length > 0;
|
|
441
|
+
}), C = R(() => l.canCreate ?? w.value), t = R(() => l.canEdit ?? w.value), s = R(() => l.canDelete ?? w.value), k = R(() => t.value || s.value), r = R(() => {
|
|
442
|
+
var v;
|
|
443
|
+
return (v = l.crudFields) != null && v.length ? l.crudFields : Jt(m.value);
|
|
444
|
+
}), F = R(() => {
|
|
445
|
+
var v, y;
|
|
446
|
+
return (v = l.crudColumns) != null && v.length ? l.crudColumns : (y = l.columns) != null && y.length ? l.columns.map((O) => ({
|
|
447
|
+
field: O.field,
|
|
448
|
+
header: O.header,
|
|
449
|
+
sortable: !0
|
|
450
|
+
})) : m.value.length ? _t(m.value) : [{ field: l.optionLabel, header: l.optionLabel, sortable: !0 }];
|
|
451
|
+
});
|
|
452
|
+
async function b() {
|
|
453
|
+
var v, y, O;
|
|
454
|
+
if (T.value) {
|
|
455
|
+
ae.value = [], te.value = 0;
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
ve.value = !0;
|
|
459
|
+
try {
|
|
460
|
+
const U = {
|
|
461
|
+
page: ie.value,
|
|
462
|
+
page_size: ge.value,
|
|
463
|
+
...l.endpointParams,
|
|
464
|
+
...M()
|
|
465
|
+
};
|
|
466
|
+
Z.value && (U.search = Z.value), se.value && ce.value !== 0 && (U.ordering = ce.value === -1 ? `-${se.value}` : se.value);
|
|
467
|
+
const oe = await f.list(l.endpoint, U);
|
|
468
|
+
ae.value = oe.data, te.value = oe.rows, (v = oe.extras) != null && v.fields && !((y = l.columns) != null && y.length) && !((O = l.crudFields) != null && O.length) && (m.value = oe.extras.fields);
|
|
469
|
+
} catch {
|
|
470
|
+
ae.value = [], te.value = 0;
|
|
471
|
+
} finally {
|
|
472
|
+
ve.value = !1;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
function q() {
|
|
476
|
+
l.disabled || (Z.value = "", ie.value = 1, se.value = null, ce.value = 0, Q.value = null, ne.value = !0, b());
|
|
477
|
+
}
|
|
478
|
+
function fe(v) {
|
|
479
|
+
ie.value = v.page + 1, ge.value = v.rows, b();
|
|
480
|
+
}
|
|
481
|
+
function pe(v) {
|
|
482
|
+
se.value = v.sortField ?? null, ce.value = v.sortOrder ?? 0, ie.value = 1, b();
|
|
483
|
+
}
|
|
484
|
+
function Ee() {
|
|
485
|
+
Q.value && (h.value = Q.value, n("update:modelValue", Q.value), ne.value = !1);
|
|
486
|
+
}
|
|
487
|
+
function Pe(v) {
|
|
488
|
+
h.value = v.data, n("update:modelValue", v.data), ne.value = !1;
|
|
489
|
+
}
|
|
490
|
+
Ce(Z, () => {
|
|
491
|
+
he && clearTimeout(he), he = setTimeout(() => {
|
|
492
|
+
ie.value = 1, b();
|
|
493
|
+
}, 300);
|
|
494
|
+
}), Ce(
|
|
495
|
+
() => j.value.map((v) => J(v.value)),
|
|
496
|
+
(v, y) => {
|
|
497
|
+
if (ne.value && (ie.value = 1, b()), !y) return;
|
|
498
|
+
const O = v.some((oe, ft) => oe !== y[ft]), U = y.some((oe) => !H(oe));
|
|
499
|
+
O && U && h.value && (h.value = null, n("update:modelValue", null));
|
|
500
|
+
}
|
|
501
|
+
);
|
|
502
|
+
const ye = N(!1), xe = N(!1), re = N(null), we = ke({}), Ie = R(() => re.value !== null), nt = R(() => Ie.value ? "Editar Registro" : "Novo Registro");
|
|
503
|
+
function st() {
|
|
504
|
+
const v = {};
|
|
505
|
+
for (const y of r.value)
|
|
506
|
+
v[y.field] = y.defaultValue !== void 0 ? typeof y.defaultValue == "function" ? y.defaultValue() : y.defaultValue : null;
|
|
507
|
+
return v;
|
|
508
|
+
}
|
|
509
|
+
function it() {
|
|
510
|
+
const v = st();
|
|
511
|
+
for (const y of Object.keys(we))
|
|
512
|
+
delete we[y];
|
|
513
|
+
for (const [y, O] of Object.entries(v))
|
|
514
|
+
we[y] = O;
|
|
515
|
+
}
|
|
516
|
+
function rt() {
|
|
517
|
+
re.value = null, it(), ye.value = !0;
|
|
518
|
+
}
|
|
519
|
+
function ut(v) {
|
|
520
|
+
re.value = v;
|
|
521
|
+
for (const y of r.value)
|
|
522
|
+
we[y.field] = v[y.field] !== void 0 ? v[y.field] : null;
|
|
523
|
+
ye.value = !0;
|
|
524
|
+
}
|
|
525
|
+
function dt(v, y) {
|
|
526
|
+
we[v] = y;
|
|
527
|
+
}
|
|
528
|
+
async function ct() {
|
|
529
|
+
xe.value = !0;
|
|
530
|
+
try {
|
|
531
|
+
const v = { ...we };
|
|
532
|
+
for (const O of r.value) {
|
|
533
|
+
const U = v[O.field];
|
|
534
|
+
if (O.type === "fk" && U !== null && typeof U == "object") {
|
|
535
|
+
const oe = O.optionValue || "id";
|
|
536
|
+
v[O.field] = U[oe] ?? U;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
let y;
|
|
540
|
+
if (Ie.value && re.value) {
|
|
541
|
+
const O = re.value[l.optionValue];
|
|
542
|
+
y = await f.update(l.endpoint, O, v);
|
|
543
|
+
const U = ae.value.findIndex((oe) => oe[l.optionValue] === O);
|
|
544
|
+
U !== -1 && (ae.value[U] = y.data), g.success("Registro atualizado com sucesso");
|
|
545
|
+
} else
|
|
546
|
+
y = await f.create(l.endpoint, v), ae.value.unshift(y.data), te.value++, g.success("Registro criado com sucesso");
|
|
547
|
+
ye.value = !1, re.value = null, Q.value = y.data;
|
|
548
|
+
} catch (v) {
|
|
549
|
+
g.error(qe(v, "Erro ao salvar registro"));
|
|
550
|
+
} finally {
|
|
551
|
+
xe.value = !1;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
function mt(v) {
|
|
555
|
+
x(async () => {
|
|
556
|
+
try {
|
|
557
|
+
const y = v[l.optionValue];
|
|
558
|
+
await f.delete(l.endpoint, y);
|
|
559
|
+
const O = ae.value.findIndex((U) => U[l.optionValue] === y);
|
|
560
|
+
O !== -1 && (ae.value.splice(O, 1), te.value--), h.value && h.value[l.optionValue] === y && (h.value = null, n("update:modelValue", null)), Q.value && Q.value[l.optionValue] === y && (Q.value = null), g.success("Registro excluído com sucesso");
|
|
561
|
+
} catch (y) {
|
|
562
|
+
g.error(qe(y, "Erro ao excluir registro"));
|
|
563
|
+
}
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
return (v, y) => {
|
|
567
|
+
const O = Qe("tooltip");
|
|
568
|
+
return o(), u(K, null, [
|
|
569
|
+
c("div", vt({ class: "w-autocompletefk" }, v.$attrs), [
|
|
570
|
+
S(d(tt), {
|
|
571
|
+
"model-value": h.value,
|
|
572
|
+
suggestions: V.value,
|
|
573
|
+
"option-label": e.optionLabel,
|
|
574
|
+
placeholder: I.value,
|
|
575
|
+
disabled: e.disabled,
|
|
576
|
+
"force-selection": e.forceSelection,
|
|
577
|
+
loading: z.value,
|
|
578
|
+
fluid: "",
|
|
579
|
+
onComplete: Y,
|
|
580
|
+
onItemSelect: ee,
|
|
581
|
+
onClear: W
|
|
582
|
+
}, null, 8, ["model-value", "suggestions", "option-label", "placeholder", "disabled", "force-selection", "loading"]),
|
|
583
|
+
ue((o(), u("button", {
|
|
584
|
+
type: "button",
|
|
585
|
+
disabled: e.disabled,
|
|
586
|
+
class: "w-autocompletefk-trigger",
|
|
587
|
+
onClick: q
|
|
588
|
+
}, [...y[6] || (y[6] = [
|
|
589
|
+
c("i", { class: "pi pi-search" }, null, -1)
|
|
590
|
+
])], 8, el)), [
|
|
591
|
+
[
|
|
592
|
+
O,
|
|
593
|
+
"Pesquisar",
|
|
594
|
+
void 0,
|
|
595
|
+
{ top: !0 }
|
|
596
|
+
]
|
|
597
|
+
])
|
|
598
|
+
], 16),
|
|
599
|
+
S(d(je), {
|
|
600
|
+
visible: ne.value,
|
|
601
|
+
"onUpdate:visible": y[4] || (y[4] = (U) => ne.value = U),
|
|
602
|
+
header: e.dialogHeader || "Pesquisar",
|
|
603
|
+
style: { width: "80vw" },
|
|
604
|
+
modal: "",
|
|
605
|
+
draggable: !1,
|
|
606
|
+
class: "w-autocompletefk-dialog"
|
|
607
|
+
}, {
|
|
608
|
+
footer: G(() => [
|
|
609
|
+
c("div", ol, [
|
|
610
|
+
S(d(L), {
|
|
611
|
+
label: "Cancelar",
|
|
612
|
+
severity: "secondary",
|
|
613
|
+
text: "",
|
|
614
|
+
onClick: y[3] || (y[3] = (U) => ne.value = !1)
|
|
615
|
+
}),
|
|
616
|
+
S(d(L), {
|
|
617
|
+
label: "Selecionar",
|
|
618
|
+
icon: "pi pi-check",
|
|
619
|
+
disabled: !Q.value,
|
|
620
|
+
onClick: Ee
|
|
621
|
+
}, null, 8, ["disabled"])
|
|
622
|
+
])
|
|
623
|
+
]),
|
|
624
|
+
default: G(() => [
|
|
625
|
+
c("div", tl, [
|
|
626
|
+
S(d(Se), { class: "w-autocompletefk-toolbar-search" }, {
|
|
627
|
+
default: G(() => [
|
|
628
|
+
S(d(De), { class: "pi pi-search" }),
|
|
629
|
+
S(d(de), {
|
|
630
|
+
modelValue: Z.value,
|
|
631
|
+
"onUpdate:modelValue": y[0] || (y[0] = (U) => Z.value = U),
|
|
632
|
+
placeholder: "Pesquisar...",
|
|
633
|
+
class: "w-full"
|
|
634
|
+
}, null, 8, ["modelValue"])
|
|
635
|
+
]),
|
|
636
|
+
_: 1
|
|
637
|
+
}),
|
|
638
|
+
c("div", ll, [
|
|
639
|
+
C.value ? (o(), $(d(L), {
|
|
640
|
+
key: 0,
|
|
641
|
+
label: "Novo",
|
|
642
|
+
icon: "pi pi-plus",
|
|
643
|
+
size: "small",
|
|
644
|
+
onClick: rt
|
|
645
|
+
})) : p("", !0)
|
|
646
|
+
])
|
|
647
|
+
]),
|
|
648
|
+
S(d(_e), {
|
|
649
|
+
selection: Q.value,
|
|
650
|
+
"onUpdate:selection": y[1] || (y[1] = (U) => Q.value = U),
|
|
651
|
+
value: ae.value,
|
|
652
|
+
loading: ve.value,
|
|
653
|
+
paginator: "",
|
|
654
|
+
lazy: "",
|
|
655
|
+
"striped-rows": "",
|
|
656
|
+
"removable-sort": "",
|
|
657
|
+
size: "small",
|
|
658
|
+
rows: ge.value,
|
|
659
|
+
"total-records": te.value,
|
|
660
|
+
"sort-field": se.value ?? void 0,
|
|
661
|
+
"sort-order": ce.value,
|
|
662
|
+
"selection-mode": "single",
|
|
663
|
+
"data-key": e.optionValue,
|
|
664
|
+
onPage: fe,
|
|
665
|
+
onSort: y[2] || (y[2] = (U) => pe({ sortField: U.sortField, sortOrder: U.sortOrder })),
|
|
666
|
+
onRowDblclick: Pe
|
|
667
|
+
}, {
|
|
668
|
+
empty: G(() => [...y[7] || (y[7] = [
|
|
669
|
+
c("div", { class: "w-autocompletefk-empty" }, "Nenhum registro encontrado", -1)
|
|
670
|
+
])]),
|
|
671
|
+
default: G(() => [
|
|
672
|
+
S(d($e), {
|
|
673
|
+
"selection-mode": "single",
|
|
674
|
+
"header-style": "width: 3rem"
|
|
675
|
+
}),
|
|
676
|
+
(o(!0), u(K, null, _(F.value, (U) => (o(), $(d($e), {
|
|
677
|
+
key: U.field,
|
|
678
|
+
field: U.field,
|
|
679
|
+
header: U.header,
|
|
680
|
+
sortable: U.sortable ?? !0,
|
|
681
|
+
style: me(U.style)
|
|
682
|
+
}, {
|
|
683
|
+
body: G(({ data: oe }) => [
|
|
684
|
+
U.type ? (o(), $(We, {
|
|
685
|
+
key: 0,
|
|
686
|
+
column: U,
|
|
687
|
+
value: oe[U.field],
|
|
688
|
+
"row-data": oe
|
|
689
|
+
}, null, 8, ["column", "value", "row-data"])) : (o(), u(K, { key: 1 }, [
|
|
690
|
+
be(E(oe[U.field]), 1)
|
|
691
|
+
], 64))
|
|
692
|
+
]),
|
|
693
|
+
_: 2
|
|
694
|
+
}, 1032, ["field", "header", "sortable", "style"]))), 128)),
|
|
695
|
+
k.value ? (o(), $(d($e), {
|
|
696
|
+
key: 0,
|
|
697
|
+
header: "",
|
|
698
|
+
style: { width: "6rem" }
|
|
699
|
+
}, {
|
|
700
|
+
body: G(({ data: U }) => [
|
|
701
|
+
c("div", al, [
|
|
702
|
+
t.value ? ue((o(), $(d(L), {
|
|
703
|
+
key: 0,
|
|
704
|
+
icon: "pi pi-pencil",
|
|
705
|
+
text: "",
|
|
706
|
+
rounded: "",
|
|
707
|
+
size: "small",
|
|
708
|
+
onClick: (oe) => ut(U)
|
|
709
|
+
}, null, 8, ["onClick"])), [
|
|
710
|
+
[
|
|
711
|
+
O,
|
|
712
|
+
"Editar",
|
|
713
|
+
void 0,
|
|
714
|
+
{ top: !0 }
|
|
715
|
+
]
|
|
716
|
+
]) : p("", !0),
|
|
717
|
+
s.value ? ue((o(), $(d(L), {
|
|
718
|
+
key: 1,
|
|
719
|
+
icon: "pi pi-trash",
|
|
720
|
+
text: "",
|
|
721
|
+
rounded: "",
|
|
722
|
+
size: "small",
|
|
723
|
+
severity: "danger",
|
|
724
|
+
onClick: (oe) => mt(U)
|
|
725
|
+
}, null, 8, ["onClick"])), [
|
|
726
|
+
[
|
|
727
|
+
O,
|
|
728
|
+
"Excluir",
|
|
729
|
+
void 0,
|
|
730
|
+
{ top: !0 }
|
|
731
|
+
]
|
|
732
|
+
]) : p("", !0)
|
|
733
|
+
])
|
|
734
|
+
]),
|
|
735
|
+
_: 1
|
|
736
|
+
})) : p("", !0)
|
|
737
|
+
]),
|
|
738
|
+
_: 1
|
|
739
|
+
}, 8, ["selection", "value", "loading", "rows", "total-records", "sort-field", "sort-order", "data-key"])
|
|
740
|
+
]),
|
|
741
|
+
_: 1
|
|
742
|
+
}, 8, ["visible", "header"]),
|
|
743
|
+
w.value ? (o(), $(ot, {
|
|
744
|
+
key: 0,
|
|
745
|
+
visible: ye.value,
|
|
746
|
+
title: nt.value,
|
|
747
|
+
fields: r.value,
|
|
748
|
+
"form-data": we,
|
|
749
|
+
"is-editing": Ie.value,
|
|
750
|
+
saving: xe.value,
|
|
751
|
+
width: e.dialogWidth,
|
|
752
|
+
"onUpdate:visible": y[5] || (y[5] = (U) => {
|
|
753
|
+
ye.value = U, U || (re.value = null);
|
|
754
|
+
}),
|
|
755
|
+
"onUpdate:field": dt,
|
|
756
|
+
onSave: ct
|
|
757
|
+
}, null, 8, ["visible", "title", "fields", "form-data", "is-editing", "saving", "width"])) : p("", !0)
|
|
758
|
+
], 64);
|
|
759
|
+
};
|
|
760
|
+
}
|
|
761
|
+
}), sl = /* @__PURE__ */ le({
|
|
762
|
+
__name: "WMoneyInput",
|
|
763
|
+
props: {
|
|
764
|
+
modelValue: {},
|
|
765
|
+
decimals: { default: 2 },
|
|
766
|
+
currency: { type: Boolean, default: !1 },
|
|
767
|
+
prefix: {},
|
|
768
|
+
suffix: {},
|
|
769
|
+
locale: { default: "pt-BR" },
|
|
770
|
+
disabled: { type: Boolean, default: !1 },
|
|
771
|
+
placeholder: {},
|
|
772
|
+
invalid: { type: Boolean }
|
|
773
|
+
},
|
|
774
|
+
emits: ["update:modelValue"],
|
|
775
|
+
setup(e, { emit: a }) {
|
|
776
|
+
const l = e, n = a, i = R(() => l.prefix ?? (l.currency ? "R$" : void 0)), f = R(() => !!i.value || !!l.suffix), g = R(() => {
|
|
777
|
+
const h = l.modelValue;
|
|
778
|
+
return h == null || Number.isNaN(h) ? "" : new Intl.NumberFormat(l.locale, {
|
|
779
|
+
minimumFractionDigits: l.decimals,
|
|
780
|
+
maximumFractionDigits: l.decimals
|
|
781
|
+
}).format(h);
|
|
782
|
+
});
|
|
783
|
+
function x(h) {
|
|
784
|
+
const V = h.target.value.replace(/\D/g, "");
|
|
785
|
+
if (!V) {
|
|
786
|
+
n("update:modelValue", null);
|
|
787
|
+
return;
|
|
788
|
+
}
|
|
789
|
+
const z = Number(V) / Math.pow(10, l.decimals);
|
|
790
|
+
n("update:modelValue", z);
|
|
791
|
+
}
|
|
792
|
+
return (h, V) => f.value ? (o(), $(d(Rt), {
|
|
793
|
+
key: 0,
|
|
794
|
+
class: "w-money-input"
|
|
795
|
+
}, {
|
|
796
|
+
default: G(() => [
|
|
797
|
+
i.value ? (o(), $(d(Ke), { key: 0 }, {
|
|
798
|
+
default: G(() => [
|
|
799
|
+
be(E(i.value), 1)
|
|
800
|
+
]),
|
|
801
|
+
_: 1
|
|
802
|
+
})) : p("", !0),
|
|
803
|
+
S(d(de), {
|
|
804
|
+
"model-value": g.value,
|
|
805
|
+
inputmode: "numeric",
|
|
806
|
+
class: "w-money-input__field",
|
|
807
|
+
placeholder: e.placeholder,
|
|
808
|
+
disabled: e.disabled,
|
|
809
|
+
invalid: e.invalid,
|
|
810
|
+
onInput: x
|
|
811
|
+
}, null, 8, ["model-value", "placeholder", "disabled", "invalid"]),
|
|
812
|
+
e.suffix ? (o(), $(d(Ke), { key: 1 }, {
|
|
813
|
+
default: G(() => [
|
|
814
|
+
be(E(e.suffix), 1)
|
|
815
|
+
]),
|
|
816
|
+
_: 1
|
|
817
|
+
})) : p("", !0)
|
|
818
|
+
]),
|
|
819
|
+
_: 1
|
|
820
|
+
})) : (o(), $(d(de), {
|
|
821
|
+
key: 1,
|
|
822
|
+
"model-value": g.value,
|
|
823
|
+
inputmode: "numeric",
|
|
824
|
+
fluid: "",
|
|
825
|
+
class: "w-money-input__field",
|
|
826
|
+
placeholder: e.placeholder,
|
|
827
|
+
disabled: e.disabled,
|
|
828
|
+
invalid: e.invalid,
|
|
829
|
+
onInput: x
|
|
830
|
+
}, null, 8, ["model-value", "placeholder", "disabled", "invalid"]));
|
|
831
|
+
}
|
|
832
|
+
}), il = { class: "w-imgcropper" }, rl = ["src"], ul = { class: "w-imgcropper-actions" }, dl = ["accept"], cl = { class: "w-imgcropper-stage" }, ml = ["src"], fl = { class: "w-imgcropper-zoom" }, Me = 300, vl = /* @__PURE__ */ le({
|
|
833
|
+
__name: "WImageCropper",
|
|
834
|
+
props: {
|
|
835
|
+
modelValue: { default: null },
|
|
836
|
+
accept: { default: "image/*" },
|
|
837
|
+
maxSize: { default: 5242880 },
|
|
838
|
+
aspectRatio: { default: 1 },
|
|
839
|
+
circular: { type: Boolean, default: !1 },
|
|
840
|
+
width: { default: 200 },
|
|
841
|
+
height: { default: 200 }
|
|
842
|
+
},
|
|
843
|
+
emits: ["update:modelValue", "error"],
|
|
844
|
+
setup(e, { emit: a }) {
|
|
845
|
+
const l = e, n = a, i = N(null);
|
|
846
|
+
Ce(
|
|
847
|
+
() => l.modelValue,
|
|
848
|
+
(t) => {
|
|
849
|
+
i.value && (URL.revokeObjectURL(i.value), i.value = null), t instanceof File && (i.value = URL.createObjectURL(t));
|
|
850
|
+
},
|
|
851
|
+
{ immediate: !0 }
|
|
852
|
+
), pt(() => {
|
|
853
|
+
i.value && URL.revokeObjectURL(i.value);
|
|
854
|
+
});
|
|
855
|
+
const f = R(() => l.modelValue instanceof File ? i.value : typeof l.modelValue == "string" && l.modelValue ? l.modelValue : null), g = N(null);
|
|
856
|
+
function x() {
|
|
857
|
+
var t;
|
|
858
|
+
(t = g.value) == null || t.click();
|
|
859
|
+
}
|
|
860
|
+
function h(t) {
|
|
861
|
+
const s = (l.accept || "").trim();
|
|
862
|
+
return !s || s === "*" || s.includes("image/*") ? t.type.startsWith("image/") : s.split(",").map((k) => k.trim()).filter(Boolean).some((k) => k.endsWith("/*") ? t.type.startsWith(k.slice(0, -1)) : k.startsWith(".") ? t.name.toLowerCase().endsWith(k.toLowerCase()) : t.type === k);
|
|
863
|
+
}
|
|
864
|
+
let V = "image.png", z = "image/png", D = null;
|
|
865
|
+
function H(t) {
|
|
866
|
+
var F;
|
|
867
|
+
const s = t.target, k = (F = s.files) == null ? void 0 : F[0];
|
|
868
|
+
if (s.value = "", !k) return;
|
|
869
|
+
if (!h(k)) {
|
|
870
|
+
n("error", "Tipo de arquivo não suportado.");
|
|
871
|
+
return;
|
|
872
|
+
}
|
|
873
|
+
if (k.size > l.maxSize) {
|
|
874
|
+
n("error", `Imagem acima do limite de ${(l.maxSize / 1048576).toFixed(1)}MB.`);
|
|
875
|
+
return;
|
|
876
|
+
}
|
|
877
|
+
V = k.name, z = k.type || "image/png";
|
|
878
|
+
const r = new FileReader();
|
|
879
|
+
r.onload = () => {
|
|
880
|
+
const b = new Image();
|
|
881
|
+
b.onload = () => {
|
|
882
|
+
D = b, M.value = b.naturalWidth, I.value = b.naturalHeight, B.value = 1, T.value = b.src, P.x = (ee.value - ve.value) / 2, P.y = (W.value - Z.value) / 2, j.value = !0;
|
|
883
|
+
}, b.onerror = () => n("error", "Não foi possível carregar a imagem."), b.src = String(r.result);
|
|
884
|
+
}, r.onerror = () => n("error", "Falha ao ler o arquivo."), r.readAsDataURL(k);
|
|
885
|
+
}
|
|
886
|
+
function J() {
|
|
887
|
+
n("update:modelValue", null);
|
|
888
|
+
}
|
|
889
|
+
const j = N(!1), T = N(""), M = N(0), I = N(0), B = N(1), P = ke({ x: 0, y: 0 }), Y = R(() => l.circular ? 1 : l.aspectRatio || 1), ee = R(() => Y.value >= 1 ? Me : Math.round(Me * Y.value)), W = R(() => Y.value >= 1 ? Math.round(Me / Y.value) : Me), ne = R(
|
|
890
|
+
() => M.value && I.value ? Math.max(ee.value / M.value, W.value / I.value) : 1
|
|
891
|
+
), ae = R(() => ne.value * B.value), ve = R(() => M.value * ae.value), Z = R(() => I.value * ae.value);
|
|
892
|
+
function ie() {
|
|
893
|
+
P.x = Math.min(0, Math.max(ee.value - ve.value, P.x)), P.y = Math.min(0, Math.max(W.value - Z.value, P.y));
|
|
894
|
+
}
|
|
895
|
+
Ce(B, ie);
|
|
896
|
+
const ge = R(() => ({
|
|
897
|
+
width: `${ve.value}px`,
|
|
898
|
+
height: `${Z.value}px`,
|
|
899
|
+
transform: `translate(${P.x}px, ${P.y}px)`
|
|
900
|
+
})), te = N(!1);
|
|
901
|
+
let Q = { x: 0, y: 0, ox: 0, oy: 0 };
|
|
902
|
+
function se(t) {
|
|
903
|
+
var s, k;
|
|
904
|
+
te.value = !0, (k = (s = t.currentTarget).setPointerCapture) == null || k.call(s, t.pointerId), Q = { x: t.clientX, y: t.clientY, ox: P.x, oy: P.y };
|
|
905
|
+
}
|
|
906
|
+
function ce(t) {
|
|
907
|
+
te.value && (P.x = Q.ox + (t.clientX - Q.x), P.y = Q.oy + (t.clientY - Q.y), ie());
|
|
908
|
+
}
|
|
909
|
+
function he() {
|
|
910
|
+
te.value = !1;
|
|
911
|
+
}
|
|
912
|
+
function m() {
|
|
913
|
+
return l.circular ? "image/png" : z === "image/jpeg" || z === "image/png" || z === "image/webp" ? z : "image/png";
|
|
914
|
+
}
|
|
915
|
+
function w(t) {
|
|
916
|
+
const s = t === "image/png" ? "png" : t === "image/webp" ? "webp" : "jpg";
|
|
917
|
+
return `${V.replace(/\.[^.]+$/, "") || "image"}.${s}`;
|
|
918
|
+
}
|
|
919
|
+
function C() {
|
|
920
|
+
if (!D) return;
|
|
921
|
+
const t = ae.value, s = -P.x / t, k = -P.y / t, r = ee.value / t, F = W.value / t, b = document.createElement("canvas");
|
|
922
|
+
b.width = Math.max(1, Math.round(r)), b.height = Math.max(1, Math.round(F));
|
|
923
|
+
const q = b.getContext("2d");
|
|
924
|
+
if (!q) {
|
|
925
|
+
n("error", "Canvas indisponível neste ambiente.");
|
|
926
|
+
return;
|
|
927
|
+
}
|
|
928
|
+
l.circular && (q.beginPath(), q.ellipse(
|
|
929
|
+
b.width / 2,
|
|
930
|
+
b.height / 2,
|
|
931
|
+
b.width / 2,
|
|
932
|
+
b.height / 2,
|
|
933
|
+
0,
|
|
934
|
+
0,
|
|
935
|
+
Math.PI * 2
|
|
936
|
+
), q.clip()), q.drawImage(D, s, k, r, F, 0, 0, b.width, b.height);
|
|
937
|
+
const fe = m();
|
|
938
|
+
b.toBlob(
|
|
939
|
+
(pe) => {
|
|
940
|
+
if (!pe) {
|
|
941
|
+
n("error", "Falha ao processar a imagem.");
|
|
942
|
+
return;
|
|
943
|
+
}
|
|
944
|
+
n("update:modelValue", new File([pe], w(fe), { type: fe })), j.value = !1;
|
|
945
|
+
},
|
|
946
|
+
fe,
|
|
947
|
+
0.92
|
|
948
|
+
);
|
|
949
|
+
}
|
|
950
|
+
return (t, s) => (o(), u("div", il, [
|
|
951
|
+
c("div", {
|
|
952
|
+
class: X(["w-imgcropper-preview", { "is-circular": e.circular, "is-empty": !f.value }]),
|
|
953
|
+
style: me({ width: `${e.width}px`, height: `${e.height}px` })
|
|
954
|
+
}, [
|
|
955
|
+
f.value ? (o(), u(K, { key: 0 }, [
|
|
956
|
+
c("img", {
|
|
957
|
+
src: f.value,
|
|
958
|
+
alt: "",
|
|
959
|
+
class: "w-imgcropper-img"
|
|
960
|
+
}, null, 8, rl),
|
|
961
|
+
c("div", ul, [
|
|
962
|
+
S(d(L), {
|
|
963
|
+
type: "button",
|
|
964
|
+
icon: "pi pi-pencil",
|
|
965
|
+
rounded: "",
|
|
966
|
+
text: "",
|
|
967
|
+
"aria-label": "Trocar imagem",
|
|
968
|
+
onClick: x
|
|
969
|
+
}),
|
|
970
|
+
S(d(L), {
|
|
971
|
+
type: "button",
|
|
972
|
+
icon: "pi pi-trash",
|
|
973
|
+
rounded: "",
|
|
974
|
+
text: "",
|
|
975
|
+
severity: "danger",
|
|
976
|
+
"aria-label": "Remover imagem",
|
|
977
|
+
onClick: J
|
|
978
|
+
})
|
|
979
|
+
])
|
|
980
|
+
], 64)) : A(t.$slots, "placeholder", { open: x }, () => [
|
|
981
|
+
c("button", {
|
|
982
|
+
type: "button",
|
|
983
|
+
class: "w-imgcropper-empty",
|
|
984
|
+
onClick: x
|
|
985
|
+
}, [...s[3] || (s[3] = [
|
|
986
|
+
c("i", { class: "pi pi-image" }, null, -1),
|
|
987
|
+
c("span", null, "Selecionar imagem", -1)
|
|
988
|
+
])])
|
|
989
|
+
], !0, 1)
|
|
990
|
+
], 6),
|
|
991
|
+
c("input", {
|
|
992
|
+
ref_key: "fileInput",
|
|
993
|
+
ref: g,
|
|
994
|
+
type: "file",
|
|
995
|
+
accept: e.accept,
|
|
996
|
+
class: "w-imgcropper-file",
|
|
997
|
+
onChange: H
|
|
998
|
+
}, null, 40, dl),
|
|
999
|
+
S(d(je), {
|
|
1000
|
+
visible: j.value,
|
|
1001
|
+
"onUpdate:visible": s[2] || (s[2] = (k) => j.value = k),
|
|
1002
|
+
modal: "",
|
|
1003
|
+
header: "Ajustar imagem",
|
|
1004
|
+
"dismissable-mask": !1,
|
|
1005
|
+
style: { width: "auto" }
|
|
1006
|
+
}, {
|
|
1007
|
+
footer: G(() => [
|
|
1008
|
+
S(d(L), {
|
|
1009
|
+
type: "button",
|
|
1010
|
+
label: "Cancelar",
|
|
1011
|
+
text: "",
|
|
1012
|
+
onClick: s[1] || (s[1] = (k) => j.value = !1)
|
|
1013
|
+
}),
|
|
1014
|
+
S(d(L), {
|
|
1015
|
+
type: "button",
|
|
1016
|
+
label: "Confirmar",
|
|
1017
|
+
onClick: C
|
|
1018
|
+
})
|
|
1019
|
+
]),
|
|
1020
|
+
default: G(() => [
|
|
1021
|
+
c("div", cl, [
|
|
1022
|
+
c("div", {
|
|
1023
|
+
class: X(["w-imgcropper-viewport", { "is-circular": e.circular }]),
|
|
1024
|
+
style: me({ width: `${ee.value}px`, height: `${W.value}px` }),
|
|
1025
|
+
onPointerdown: se,
|
|
1026
|
+
onPointermove: ce,
|
|
1027
|
+
onPointerup: he,
|
|
1028
|
+
onPointerleave: he
|
|
1029
|
+
}, [
|
|
1030
|
+
T.value ? (o(), u("img", {
|
|
1031
|
+
key: 0,
|
|
1032
|
+
src: T.value,
|
|
1033
|
+
alt: "",
|
|
1034
|
+
class: "w-imgcropper-cropimg",
|
|
1035
|
+
style: me(ge.value),
|
|
1036
|
+
draggable: "false"
|
|
1037
|
+
}, null, 12, ml)) : p("", !0),
|
|
1038
|
+
c("div", {
|
|
1039
|
+
class: X(["w-imgcropper-stencil", { "is-circular": e.circular }])
|
|
1040
|
+
}, null, 2)
|
|
1041
|
+
], 38),
|
|
1042
|
+
c("div", fl, [
|
|
1043
|
+
s[4] || (s[4] = c("i", { class: "pi pi-search-minus" }, null, -1)),
|
|
1044
|
+
S(d(Ft), {
|
|
1045
|
+
modelValue: B.value,
|
|
1046
|
+
"onUpdate:modelValue": s[0] || (s[0] = (k) => B.value = k),
|
|
1047
|
+
min: 1,
|
|
1048
|
+
max: 4,
|
|
1049
|
+
step: 0.01,
|
|
1050
|
+
class: "w-imgcropper-slider"
|
|
1051
|
+
}, null, 8, ["modelValue"]),
|
|
1052
|
+
s[5] || (s[5] = c("i", { class: "pi pi-search-plus" }, null, -1))
|
|
1053
|
+
])
|
|
1054
|
+
])
|
|
1055
|
+
]),
|
|
1056
|
+
_: 1
|
|
1057
|
+
}, 8, ["visible"])
|
|
1058
|
+
]));
|
|
1059
|
+
}
|
|
1060
|
+
}), pl = (e, a) => {
|
|
1061
|
+
const l = e.__vccOpts || e;
|
|
1062
|
+
for (const [n, i] of a)
|
|
1063
|
+
l[n] = i;
|
|
1064
|
+
return l;
|
|
1065
|
+
}, hl = /* @__PURE__ */ pl(vl, [["__scopeId", "data-v-95684d2d"]]), gl = { class: "w-transfer__pane" }, yl = { class: "w-transfer__head" }, bl = { class: "w-transfer__count" }, wl = { class: "w-transfer__list" }, kl = ["onClick"], $l = {
|
|
1066
|
+
key: 0,
|
|
1067
|
+
class: "w-transfer__empty"
|
|
1068
|
+
}, xl = { class: "w-transfer__controls" }, Cl = { class: "w-transfer__pane" }, Vl = { class: "w-transfer__head" }, Sl = { class: "w-transfer__count" }, Dl = { class: "w-transfer__list" }, El = ["onClick"], Pl = {
|
|
1069
|
+
key: 0,
|
|
1070
|
+
class: "w-transfer__empty"
|
|
1071
|
+
}, Rl = /* @__PURE__ */ le({
|
|
1072
|
+
__name: "WTransferList",
|
|
1073
|
+
props: {
|
|
1074
|
+
source: {},
|
|
1075
|
+
selected: { default: () => [] },
|
|
1076
|
+
trackBy: { default: "id" },
|
|
1077
|
+
optionLabel: { default: "nome" },
|
|
1078
|
+
searchFields: {},
|
|
1079
|
+
disabled: { type: Boolean }
|
|
1080
|
+
},
|
|
1081
|
+
emits: ["update:selected"],
|
|
1082
|
+
setup(e, { emit: a }) {
|
|
1083
|
+
const l = e, n = a, i = N(""), f = N(""), g = R(() => new Set(l.selected)), x = R(() => l.searchFields ?? [l.optionLabel]);
|
|
1084
|
+
function h(I) {
|
|
1085
|
+
return I[l.trackBy];
|
|
1086
|
+
}
|
|
1087
|
+
function V(I) {
|
|
1088
|
+
return String(I[l.optionLabel] ?? "");
|
|
1089
|
+
}
|
|
1090
|
+
function z(I, B) {
|
|
1091
|
+
if (!B) return !0;
|
|
1092
|
+
const P = B.toLowerCase();
|
|
1093
|
+
return x.value.some(
|
|
1094
|
+
(Y) => String(I[Y] ?? "").toLowerCase().includes(P)
|
|
1095
|
+
);
|
|
1096
|
+
}
|
|
1097
|
+
const D = R(
|
|
1098
|
+
() => l.source.filter((I) => !g.value.has(h(I)) && z(I, i.value))
|
|
1099
|
+
), H = R(
|
|
1100
|
+
() => l.source.filter((I) => g.value.has(h(I)) && z(I, f.value))
|
|
1101
|
+
);
|
|
1102
|
+
function J(I) {
|
|
1103
|
+
l.disabled || n("update:selected", [...l.selected, h(I)]);
|
|
1104
|
+
}
|
|
1105
|
+
function j(I) {
|
|
1106
|
+
if (l.disabled) return;
|
|
1107
|
+
const B = h(I);
|
|
1108
|
+
n(
|
|
1109
|
+
"update:selected",
|
|
1110
|
+
l.selected.filter((P) => P !== B)
|
|
1111
|
+
);
|
|
1112
|
+
}
|
|
1113
|
+
function T() {
|
|
1114
|
+
l.disabled || n("update:selected", l.source.map(h));
|
|
1115
|
+
}
|
|
1116
|
+
function M() {
|
|
1117
|
+
l.disabled || n("update:selected", []);
|
|
1118
|
+
}
|
|
1119
|
+
return (I, B) => (o(), u("div", {
|
|
1120
|
+
class: X(["w-transfer", { "w-transfer--disabled": e.disabled }])
|
|
1121
|
+
}, [
|
|
1122
|
+
c("div", gl, [
|
|
1123
|
+
c("div", yl, [
|
|
1124
|
+
B[2] || (B[2] = c("span", { class: "w-transfer__title" }, "Disponíveis", -1)),
|
|
1125
|
+
c("span", bl, E(D.value.length), 1)
|
|
1126
|
+
]),
|
|
1127
|
+
S(d(Se), { class: "w-transfer__search" }, {
|
|
1128
|
+
default: G(() => [
|
|
1129
|
+
S(d(De), { class: "pi pi-search" }),
|
|
1130
|
+
S(d(de), {
|
|
1131
|
+
modelValue: i.value,
|
|
1132
|
+
"onUpdate:modelValue": B[0] || (B[0] = (P) => i.value = P),
|
|
1133
|
+
placeholder: "Buscar...",
|
|
1134
|
+
fluid: ""
|
|
1135
|
+
}, null, 8, ["modelValue"])
|
|
1136
|
+
]),
|
|
1137
|
+
_: 1
|
|
1138
|
+
}),
|
|
1139
|
+
c("ul", wl, [
|
|
1140
|
+
(o(!0), u(K, null, _(D.value, (P) => (o(), u("li", {
|
|
1141
|
+
key: `a-${h(P)}`,
|
|
1142
|
+
class: "w-transfer__item",
|
|
1143
|
+
onClick: (Y) => J(P)
|
|
1144
|
+
}, [
|
|
1145
|
+
c("span", null, E(V(P)), 1),
|
|
1146
|
+
B[3] || (B[3] = c("i", { class: "pi pi-angle-right" }, null, -1))
|
|
1147
|
+
], 8, kl))), 128)),
|
|
1148
|
+
D.value.length ? p("", !0) : (o(), u("li", $l, "Nenhum item"))
|
|
1149
|
+
])
|
|
1150
|
+
]),
|
|
1151
|
+
c("div", xl, [
|
|
1152
|
+
S(d(L), {
|
|
1153
|
+
type: "button",
|
|
1154
|
+
icon: "pi pi-angle-double-right",
|
|
1155
|
+
text: "",
|
|
1156
|
+
rounded: "",
|
|
1157
|
+
disabled: e.disabled || !D.value.length,
|
|
1158
|
+
onClick: T
|
|
1159
|
+
}, null, 8, ["disabled"]),
|
|
1160
|
+
S(d(L), {
|
|
1161
|
+
type: "button",
|
|
1162
|
+
icon: "pi pi-angle-double-left",
|
|
1163
|
+
text: "",
|
|
1164
|
+
rounded: "",
|
|
1165
|
+
disabled: e.disabled || !e.selected.length,
|
|
1166
|
+
onClick: M
|
|
1167
|
+
}, null, 8, ["disabled"])
|
|
1168
|
+
]),
|
|
1169
|
+
c("div", Cl, [
|
|
1170
|
+
c("div", Vl, [
|
|
1171
|
+
B[4] || (B[4] = c("span", { class: "w-transfer__title" }, "Selecionados", -1)),
|
|
1172
|
+
c("span", Sl, E(H.value.length), 1)
|
|
1173
|
+
]),
|
|
1174
|
+
S(d(Se), { class: "w-transfer__search" }, {
|
|
1175
|
+
default: G(() => [
|
|
1176
|
+
S(d(De), { class: "pi pi-search" }),
|
|
1177
|
+
S(d(de), {
|
|
1178
|
+
modelValue: f.value,
|
|
1179
|
+
"onUpdate:modelValue": B[1] || (B[1] = (P) => f.value = P),
|
|
1180
|
+
placeholder: "Buscar...",
|
|
1181
|
+
fluid: ""
|
|
1182
|
+
}, null, 8, ["modelValue"])
|
|
1183
|
+
]),
|
|
1184
|
+
_: 1
|
|
1185
|
+
}),
|
|
1186
|
+
c("ul", Dl, [
|
|
1187
|
+
(o(!0), u(K, null, _(H.value, (P) => (o(), u("li", {
|
|
1188
|
+
key: `s-${h(P)}`,
|
|
1189
|
+
class: "w-transfer__item",
|
|
1190
|
+
onClick: (Y) => j(P)
|
|
1191
|
+
}, [
|
|
1192
|
+
B[5] || (B[5] = c("i", { class: "pi pi-angle-left" }, null, -1)),
|
|
1193
|
+
c("span", null, E(V(P)), 1)
|
|
1194
|
+
], 8, El))), 128)),
|
|
1195
|
+
H.value.length ? p("", !0) : (o(), u("li", Pl, "Nenhum item"))
|
|
1196
|
+
])
|
|
1197
|
+
])
|
|
1198
|
+
], 2));
|
|
1199
|
+
}
|
|
1200
|
+
});
|
|
1201
|
+
async function Fl(e) {
|
|
1202
|
+
const a = e.replace(/\D/g, "");
|
|
1203
|
+
if (a.length !== 8) return null;
|
|
1204
|
+
try {
|
|
1205
|
+
const l = await fetch(`https://viacep.com.br/ws/${a}/json/`);
|
|
1206
|
+
if (!l.ok) return null;
|
|
1207
|
+
const n = await l.json();
|
|
1208
|
+
return n.erro ? null : n;
|
|
1209
|
+
} catch {
|
|
1210
|
+
return null;
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
const Ml = { class: "w-crud-form" }, Il = {
|
|
1214
|
+
key: 0,
|
|
1215
|
+
class: "w-crud-form-group-header"
|
|
1216
|
+
}, Al = { class: "w-crud-form-group-title" }, Ul = {
|
|
1217
|
+
key: 0,
|
|
1218
|
+
class: "w-crud-form-group-desc"
|
|
1219
|
+
}, Bl = { class: "w-crud-form-switch-label" }, Ll = { class: "w-crud-form-label" }, Nl = {
|
|
1220
|
+
key: 0,
|
|
1221
|
+
class: "w-crud-form-required"
|
|
1222
|
+
}, Tl = { class: "w-crud-form-color-row" }, zl = { class: "w-crud-form-label" }, Wl = {
|
|
1223
|
+
key: 0,
|
|
1224
|
+
class: "w-crud-form-error"
|
|
1225
|
+
}, Ol = { class: "w-crud-form-label" }, jl = {
|
|
1226
|
+
key: 0,
|
|
1227
|
+
class: "w-crud-form-required"
|
|
1228
|
+
}, ql = { class: "w-crud-form-label" }, Hl = {
|
|
1229
|
+
key: 0,
|
|
1230
|
+
class: "w-crud-form-required"
|
|
1231
|
+
}, Kl = {
|
|
1232
|
+
key: 1,
|
|
1233
|
+
class: "pi pi-spin pi-spinner w-crud-form-cep-spinner"
|
|
1234
|
+
}, Gl = {
|
|
1235
|
+
key: 16,
|
|
1236
|
+
class: "w-crud-form-cep-error"
|
|
1237
|
+
}, Yl = {
|
|
1238
|
+
key: 17,
|
|
1239
|
+
class: "w-crud-form-error"
|
|
1240
|
+
}, Xl = /* @__PURE__ */ le({
|
|
1241
|
+
__name: "WFormRenderer",
|
|
1242
|
+
props: {
|
|
1243
|
+
fields: {},
|
|
1244
|
+
formData: {},
|
|
1245
|
+
isEditing: { type: Boolean },
|
|
1246
|
+
disabled: { type: Boolean, default: !1 },
|
|
1247
|
+
columns: { default: 2 }
|
|
1248
|
+
},
|
|
1249
|
+
emits: ["update:field"],
|
|
1250
|
+
setup(e, { expose: a, emit: l }) {
|
|
1251
|
+
const n = e, i = l, f = ke({}), g = ke({}), x = ke({}), h = ke({});
|
|
1252
|
+
function V(m, w) {
|
|
1253
|
+
const C = w.target.value, t = C.replace(/\D/g, "");
|
|
1254
|
+
i("update:field", m.field, C), x[m.field] = null, h[m.field] && (clearTimeout(h[m.field]), h[m.field] = null), t.length === 8 && (h[m.field] = setTimeout(async () => {
|
|
1255
|
+
g[m.field] = !0, x[m.field] = null;
|
|
1256
|
+
try {
|
|
1257
|
+
const s = await Fl(t);
|
|
1258
|
+
if (!s)
|
|
1259
|
+
x[m.field] = "CEP não encontrado. Preencha os campos manualmente.";
|
|
1260
|
+
else {
|
|
1261
|
+
const k = m.cepFields || {}, r = Object.keys(k);
|
|
1262
|
+
for (const F of r) {
|
|
1263
|
+
const b = k[F];
|
|
1264
|
+
if (!b) continue;
|
|
1265
|
+
const q = n.formData[b];
|
|
1266
|
+
(q == null || q === "") && i("update:field", b, s[F] ?? "");
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
} finally {
|
|
1270
|
+
g[m.field] = !1;
|
|
1271
|
+
}
|
|
1272
|
+
}, 400));
|
|
1273
|
+
}
|
|
1274
|
+
const z = R(
|
|
1275
|
+
() => n.fields.filter((m) => m.visible === void 0 || m.visible === !0 ? !0 : typeof m.visible == "function" ? m.visible(n.formData, n.isEditing) : m.visible)
|
|
1276
|
+
);
|
|
1277
|
+
function D(m) {
|
|
1278
|
+
return n.disabled || m.disabledOnEdit && n.isEditing ? !0 : typeof m.disabled == "function" ? m.disabled(n.formData, n.isEditing) : !!m.disabled;
|
|
1279
|
+
}
|
|
1280
|
+
function H(m) {
|
|
1281
|
+
return ht(m) ? m.value : m;
|
|
1282
|
+
}
|
|
1283
|
+
const J = R(() => {
|
|
1284
|
+
const m = n.isEditing ? "edit" : "create", w = n.fields.find((t) => t.autofocus === !0 || t.autofocus === m);
|
|
1285
|
+
if (w) return w.field;
|
|
1286
|
+
const C = z.value.find((t) => !(t.type === "switch" || t.type === "fk" || t.type === "select" || t.type === "image" || t.disabled === !0 || t.disabledOnEdit && n.isEditing));
|
|
1287
|
+
return (C == null ? void 0 : C.field) ?? null;
|
|
1288
|
+
});
|
|
1289
|
+
function j(m) {
|
|
1290
|
+
return m.field === J.value;
|
|
1291
|
+
}
|
|
1292
|
+
function T(m) {
|
|
1293
|
+
if (m)
|
|
1294
|
+
return m.replace(/9/g, "#").replace(/a/g, "S").replace(/\*/g, "X");
|
|
1295
|
+
}
|
|
1296
|
+
function M(m) {
|
|
1297
|
+
if (!m) return "";
|
|
1298
|
+
const w = String(m).replace(/\D/g, "").slice(0, 14);
|
|
1299
|
+
return w.length <= 11 ? w.replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d{1,2})$/, "$1-$2") : w.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");
|
|
1300
|
+
}
|
|
1301
|
+
function I(m, w) {
|
|
1302
|
+
const C = w.target.value.replace(/\D/g, "").slice(0, 14);
|
|
1303
|
+
i("update:field", m, C);
|
|
1304
|
+
}
|
|
1305
|
+
const B = ke({});
|
|
1306
|
+
function P(m) {
|
|
1307
|
+
const w = n.formData[m.field];
|
|
1308
|
+
if (w == null) return null;
|
|
1309
|
+
const C = m.optionValue || "value";
|
|
1310
|
+
return (H(m.options) || []).find((s) => s[C] === w) ?? null;
|
|
1311
|
+
}
|
|
1312
|
+
function Y(m) {
|
|
1313
|
+
return B[m.field] || [];
|
|
1314
|
+
}
|
|
1315
|
+
function ee(m, w) {
|
|
1316
|
+
const C = (w.query || "").toLowerCase(), t = H(m.options) || [], s = m.optionLabel || "label";
|
|
1317
|
+
B[m.field] = t.filter(
|
|
1318
|
+
(k) => String(k[s] || "").toLowerCase().includes(C)
|
|
1319
|
+
);
|
|
1320
|
+
}
|
|
1321
|
+
function W(m, w) {
|
|
1322
|
+
const C = m.optionValue || "value";
|
|
1323
|
+
i("update:field", m.field, w.value[C]);
|
|
1324
|
+
}
|
|
1325
|
+
function ne(m) {
|
|
1326
|
+
const w = n.formData[m.field];
|
|
1327
|
+
return w ? String(w).replace("#", "") : "FFFFFF";
|
|
1328
|
+
}
|
|
1329
|
+
function ae(m, w) {
|
|
1330
|
+
i("update:field", m.field, `#${w}`);
|
|
1331
|
+
}
|
|
1332
|
+
function ve(m) {
|
|
1333
|
+
const w = m.dependsOn;
|
|
1334
|
+
return w ? (Array.isArray(w) ? w : [w]).map((t) => ({
|
|
1335
|
+
field: t.param || t.field,
|
|
1336
|
+
value: n.formData[t.field],
|
|
1337
|
+
required: t.required
|
|
1338
|
+
})) : void 0;
|
|
1339
|
+
}
|
|
1340
|
+
function Z(m) {
|
|
1341
|
+
if (typeof m.validate == "function") {
|
|
1342
|
+
const w = m.validate(n.formData[m.field]);
|
|
1343
|
+
f[m.field] = w || null;
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
function ie() {
|
|
1347
|
+
const m = [];
|
|
1348
|
+
for (const w of n.fields)
|
|
1349
|
+
if (typeof w.validate == "function") {
|
|
1350
|
+
const C = w.validate(n.formData[w.field]);
|
|
1351
|
+
f[w.field] = C || null, C && m.push(C);
|
|
1352
|
+
}
|
|
1353
|
+
return m;
|
|
1354
|
+
}
|
|
1355
|
+
function ge() {
|
|
1356
|
+
Object.keys(f).forEach((m) => delete f[m]);
|
|
1357
|
+
}
|
|
1358
|
+
function te(m) {
|
|
1359
|
+
return Math.max(1, Math.floor(m.columns ?? n.columns));
|
|
1360
|
+
}
|
|
1361
|
+
function Q(m, w) {
|
|
1362
|
+
const C = m.colSpan;
|
|
1363
|
+
return C == null || C === "full" ? w : C === 0.5 ? Math.max(1, Math.round(w / 2)) : Math.min(Math.max(1, Math.floor(C)), w);
|
|
1364
|
+
}
|
|
1365
|
+
function se(m, w) {
|
|
1366
|
+
return { "--w-col-span": Q(m, te(w)) };
|
|
1367
|
+
}
|
|
1368
|
+
function ce(m, w) {
|
|
1369
|
+
return Q(m, te(w)) === te(w) ? "w-crud-form-col-full" : "w-crud-form-col-half";
|
|
1370
|
+
}
|
|
1371
|
+
const he = R(() => {
|
|
1372
|
+
var t, s, k, r, F;
|
|
1373
|
+
const m = /* @__PURE__ */ new Map(), w = [], C = /* @__PURE__ */ new Map();
|
|
1374
|
+
for (const b of z.value) {
|
|
1375
|
+
const q = ((t = b.fieldGroup) == null ? void 0 : t.id) ?? "__default__";
|
|
1376
|
+
m.has(q) || (m.set(q, {
|
|
1377
|
+
id: q,
|
|
1378
|
+
title: (s = b.fieldGroup) == null ? void 0 : s.title,
|
|
1379
|
+
description: (k = b.fieldGroup) == null ? void 0 : k.description,
|
|
1380
|
+
columns: (r = b.fieldGroup) == null ? void 0 : r.columns,
|
|
1381
|
+
fields: []
|
|
1382
|
+
}), w.push(q), ((F = b.fieldGroup) == null ? void 0 : F.order) != null && C.set(q, b.fieldGroup.order)), m.get(q).fields.push(b);
|
|
1383
|
+
}
|
|
1384
|
+
return w.slice().sort((b, q) => {
|
|
1385
|
+
const fe = C.get(b), pe = C.get(q);
|
|
1386
|
+
return fe != null && pe != null ? fe - pe : fe != null ? -1 : pe != null ? 1 : w.indexOf(b) - w.indexOf(q);
|
|
1387
|
+
}).map((b) => m.get(b));
|
|
1388
|
+
});
|
|
1389
|
+
return a({ validateAll: ie, clearErrors: ge }), (m, w) => (o(), u("div", Ml, [
|
|
1390
|
+
(o(!0), u(K, null, _(he.value, (C) => (o(), u("div", {
|
|
1391
|
+
key: C.id,
|
|
1392
|
+
class: "w-crud-form-group"
|
|
1393
|
+
}, [
|
|
1394
|
+
C.title ? (o(), u("div", Il, [
|
|
1395
|
+
c("h3", Al, E(C.title), 1),
|
|
1396
|
+
C.description ? (o(), u("p", Ul, E(C.description), 1)) : p("", !0)
|
|
1397
|
+
])) : p("", !0),
|
|
1398
|
+
c("div", {
|
|
1399
|
+
class: "w-crud-form-fields",
|
|
1400
|
+
style: me({ "--w-form-cols": te(C) })
|
|
1401
|
+
}, [
|
|
1402
|
+
(o(!0), u(K, null, _(C.fields, (t) => A(m.$slots, `field-${t.field}`, {
|
|
1403
|
+
field: t,
|
|
1404
|
+
formData: e.formData,
|
|
1405
|
+
isEditing: e.isEditing,
|
|
1406
|
+
setFormField: (s, k) => i("update:field", s, k)
|
|
1407
|
+
}, () => [
|
|
1408
|
+
t.type === "switch" ? (o(), u("div", {
|
|
1409
|
+
key: 0,
|
|
1410
|
+
class: "w-crud-form-switch",
|
|
1411
|
+
style: me(se(t, C))
|
|
1412
|
+
}, [
|
|
1413
|
+
S(d(St), {
|
|
1414
|
+
"model-value": e.formData[t.field],
|
|
1415
|
+
disabled: D(t),
|
|
1416
|
+
"onUpdate:modelValue": (s) => i("update:field", t.field, s)
|
|
1417
|
+
}, null, 8, ["model-value", "disabled", "onUpdate:modelValue"]),
|
|
1418
|
+
c("label", Bl, E(t.switchLabel || t.label), 1)
|
|
1419
|
+
], 4)) : t.type === "color" ? (o(), u("div", {
|
|
1420
|
+
key: 1,
|
|
1421
|
+
class: X(ce(t, C)),
|
|
1422
|
+
style: me(se(t, C))
|
|
1423
|
+
}, [
|
|
1424
|
+
c("label", Ll, [
|
|
1425
|
+
be(E(t.label) + " ", 1),
|
|
1426
|
+
t.required ? (o(), u("span", Nl, "*")) : p("", !0)
|
|
1427
|
+
]),
|
|
1428
|
+
c("div", Tl, [
|
|
1429
|
+
S(d(Dt), {
|
|
1430
|
+
"model-value": ne(t),
|
|
1431
|
+
disabled: D(t),
|
|
1432
|
+
"onUpdate:modelValue": (s) => ae(t, s)
|
|
1433
|
+
}, null, 8, ["model-value", "disabled", "onUpdate:modelValue"]),
|
|
1434
|
+
S(d(de), {
|
|
1435
|
+
"model-value": e.formData[t.field],
|
|
1436
|
+
class: "w-28",
|
|
1437
|
+
maxlength: "7",
|
|
1438
|
+
placeholder: "#000000",
|
|
1439
|
+
disabled: D(t),
|
|
1440
|
+
"onUpdate:modelValue": (s) => i("update:field", t.field, s)
|
|
1441
|
+
}, null, 8, ["model-value", "disabled", "onUpdate:modelValue"])
|
|
1442
|
+
])
|
|
1443
|
+
], 6)) : t.type === "image" ? (o(), u("div", {
|
|
1444
|
+
key: 2,
|
|
1445
|
+
class: X(ce(t, C)),
|
|
1446
|
+
style: me(se(t, C))
|
|
1447
|
+
}, [
|
|
1448
|
+
c("label", zl, E(t.label), 1),
|
|
1449
|
+
A(m.$slots, `image-${t.field}`, {
|
|
1450
|
+
field: t,
|
|
1451
|
+
formData: e.formData
|
|
1452
|
+
}, () => [
|
|
1453
|
+
S(hl, {
|
|
1454
|
+
"model-value": e.formData[t.field],
|
|
1455
|
+
accept: t.accept || "image/*",
|
|
1456
|
+
"onUpdate:modelValue": (s) => i("update:field", t.field, s),
|
|
1457
|
+
onError: (s) => {
|
|
1458
|
+
f[t.field] = s;
|
|
1459
|
+
}
|
|
1460
|
+
}, null, 8, ["model-value", "accept", "onUpdate:modelValue", "onError"])
|
|
1461
|
+
]),
|
|
1462
|
+
f[t.field] ? (o(), u("small", Wl, E(f[t.field]), 1)) : p("", !0)
|
|
1463
|
+
], 6)) : t.type === "transfer" ? (o(), u("div", {
|
|
1464
|
+
key: 3,
|
|
1465
|
+
class: X(ce(t, C)),
|
|
1466
|
+
style: me(se(t, C))
|
|
1467
|
+
}, [
|
|
1468
|
+
c("label", Ol, [
|
|
1469
|
+
be(E(t.label) + " ", 1),
|
|
1470
|
+
t.required ? (o(), u("span", jl, "*")) : p("", !0)
|
|
1471
|
+
]),
|
|
1472
|
+
S(Rl, {
|
|
1473
|
+
source: H(t.options) || [],
|
|
1474
|
+
selected: e.formData[t.field] || [],
|
|
1475
|
+
"track-by": t.optionValue || "id",
|
|
1476
|
+
"option-label": t.optionLabel || "nome",
|
|
1477
|
+
"search-fields": t.searchFields,
|
|
1478
|
+
disabled: D(t),
|
|
1479
|
+
"onUpdate:selected": (s) => i("update:field", t.field, s)
|
|
1480
|
+
}, null, 8, ["source", "selected", "track-by", "option-label", "search-fields", "disabled", "onUpdate:selected"])
|
|
1481
|
+
], 6)) : (o(), u("div", {
|
|
1482
|
+
key: 4,
|
|
1483
|
+
class: X(ce(t, C)),
|
|
1484
|
+
style: me(se(t, C))
|
|
1485
|
+
}, [
|
|
1486
|
+
c("label", ql, [
|
|
1487
|
+
be(E(t.label) + " ", 1),
|
|
1488
|
+
t.required ? (o(), u("span", Hl, "*")) : p("", !0),
|
|
1489
|
+
g[t.field] ? (o(), u("i", Kl)) : p("", !0)
|
|
1490
|
+
]),
|
|
1491
|
+
(!t.type || t.type === "text") && t.mask ? ue((o(), $(d(de), {
|
|
1492
|
+
key: 0,
|
|
1493
|
+
"model-value": e.formData[t.field],
|
|
1494
|
+
fluid: "",
|
|
1495
|
+
autofocus: j(t) || void 0,
|
|
1496
|
+
placeholder: t.placeholder,
|
|
1497
|
+
disabled: D(t),
|
|
1498
|
+
"onUpdate:modelValue": (s) => i("update:field", t.field, s)
|
|
1499
|
+
}, null, 8, ["model-value", "autofocus", "placeholder", "disabled", "onUpdate:modelValue"])), [
|
|
1500
|
+
[d(Ue), { mask: T(t.mask) }]
|
|
1501
|
+
]) : !t.type || t.type === "text" ? (o(), $(d(de), {
|
|
1502
|
+
key: 1,
|
|
1503
|
+
"model-value": e.formData[t.field],
|
|
1504
|
+
fluid: "",
|
|
1505
|
+
autofocus: j(t) || void 0,
|
|
1506
|
+
placeholder: t.placeholder,
|
|
1507
|
+
disabled: D(t),
|
|
1508
|
+
"onUpdate:modelValue": (s) => i("update:field", t.field, s)
|
|
1509
|
+
}, null, 8, ["model-value", "autofocus", "placeholder", "disabled", "onUpdate:modelValue"])) : t.type === "email" ? (o(), $(d(de), {
|
|
1510
|
+
key: 2,
|
|
1511
|
+
"model-value": e.formData[t.field],
|
|
1512
|
+
type: "email",
|
|
1513
|
+
fluid: "",
|
|
1514
|
+
autofocus: j(t) || void 0,
|
|
1515
|
+
placeholder: t.placeholder,
|
|
1516
|
+
disabled: D(t),
|
|
1517
|
+
"onUpdate:modelValue": (s) => i("update:field", t.field, s)
|
|
1518
|
+
}, null, 8, ["model-value", "autofocus", "placeholder", "disabled", "onUpdate:modelValue"])) : t.type === "password" ? (o(), $(d(Et), {
|
|
1519
|
+
key: 3,
|
|
1520
|
+
"model-value": e.formData[t.field],
|
|
1521
|
+
fluid: "",
|
|
1522
|
+
"toggle-mask": "",
|
|
1523
|
+
feedback: t.feedback !== !1,
|
|
1524
|
+
placeholder: t.placeholder,
|
|
1525
|
+
disabled: D(t),
|
|
1526
|
+
"onUpdate:modelValue": (s) => i("update:field", t.field, s)
|
|
1527
|
+
}, null, 8, ["model-value", "feedback", "placeholder", "disabled", "onUpdate:modelValue"])) : t.type === "number" ? (o(), $(d(Te), {
|
|
1528
|
+
key: 4,
|
|
1529
|
+
"model-value": e.formData[t.field],
|
|
1530
|
+
fluid: "",
|
|
1531
|
+
locale: "pt-BR",
|
|
1532
|
+
min: t.min,
|
|
1533
|
+
max: t.max,
|
|
1534
|
+
"min-fraction-digits": t.minFractionDigits,
|
|
1535
|
+
"max-fraction-digits": t.maxFractionDigits,
|
|
1536
|
+
suffix: t.suffix,
|
|
1537
|
+
prefix: t.prefix,
|
|
1538
|
+
placeholder: t.placeholder,
|
|
1539
|
+
disabled: D(t),
|
|
1540
|
+
"onUpdate:modelValue": (s) => i("update:field", t.field, s)
|
|
1541
|
+
}, null, 8, ["model-value", "min", "max", "min-fraction-digits", "max-fraction-digits", "suffix", "prefix", "placeholder", "disabled", "onUpdate:modelValue"])) : t.type === "currency" && t.fillFromRight ? (o(), $(sl, {
|
|
1542
|
+
key: 5,
|
|
1543
|
+
"model-value": e.formData[t.field],
|
|
1544
|
+
decimals: t.decimals ?? 2,
|
|
1545
|
+
currency: "",
|
|
1546
|
+
prefix: t.prefix,
|
|
1547
|
+
suffix: t.suffix,
|
|
1548
|
+
placeholder: t.placeholder,
|
|
1549
|
+
disabled: D(t),
|
|
1550
|
+
"onUpdate:modelValue": (s) => i("update:field", t.field, s)
|
|
1551
|
+
}, null, 8, ["model-value", "decimals", "prefix", "suffix", "placeholder", "disabled", "onUpdate:modelValue"])) : t.type === "currency" ? (o(), $(d(Te), {
|
|
1552
|
+
key: 6,
|
|
1553
|
+
"model-value": e.formData[t.field],
|
|
1554
|
+
fluid: "",
|
|
1555
|
+
mode: "currency",
|
|
1556
|
+
currency: "BRL",
|
|
1557
|
+
locale: "pt-BR",
|
|
1558
|
+
min: t.min,
|
|
1559
|
+
max: t.max,
|
|
1560
|
+
placeholder: t.placeholder,
|
|
1561
|
+
disabled: D(t),
|
|
1562
|
+
"onUpdate:modelValue": (s) => i("update:field", t.field, s)
|
|
1563
|
+
}, null, 8, ["model-value", "min", "max", "placeholder", "disabled", "onUpdate:modelValue"])) : t.type === "select" ? (o(), $(d(ze), {
|
|
1564
|
+
key: 7,
|
|
1565
|
+
"model-value": e.formData[t.field],
|
|
1566
|
+
fluid: "",
|
|
1567
|
+
options: H(t.options),
|
|
1568
|
+
"option-label": t.optionLabel || "label",
|
|
1569
|
+
"option-value": t.optionValue || "value",
|
|
1570
|
+
"show-clear": t.showClear !== !1,
|
|
1571
|
+
placeholder: t.placeholder,
|
|
1572
|
+
disabled: D(t),
|
|
1573
|
+
"onUpdate:modelValue": (s) => i("update:field", t.field, s)
|
|
1574
|
+
}, null, 8, ["model-value", "options", "option-label", "option-value", "show-clear", "placeholder", "disabled", "onUpdate:modelValue"])) : t.type === "autocomplete" ? (o(), $(d(tt), {
|
|
1575
|
+
key: 8,
|
|
1576
|
+
"model-value": P(t),
|
|
1577
|
+
fluid: "",
|
|
1578
|
+
suggestions: Y(t),
|
|
1579
|
+
"option-label": t.optionLabel || "label",
|
|
1580
|
+
placeholder: t.placeholder,
|
|
1581
|
+
disabled: D(t),
|
|
1582
|
+
onComplete: (s) => ee(t, s),
|
|
1583
|
+
onItemSelect: (s) => W(t, s),
|
|
1584
|
+
onClear: (s) => i("update:field", t.field, null)
|
|
1585
|
+
}, null, 8, ["model-value", "suggestions", "option-label", "placeholder", "disabled", "onComplete", "onItemSelect", "onClear"])) : t.type === "fk" ? (o(), $(nl, {
|
|
1586
|
+
key: 9,
|
|
1587
|
+
"model-value": e.formData[t.field],
|
|
1588
|
+
endpoint: t.endpoint,
|
|
1589
|
+
"endpoint-params": t.endpointParams,
|
|
1590
|
+
drilldown: ve(t),
|
|
1591
|
+
"blocked-placeholder": t.blockedPlaceholder,
|
|
1592
|
+
"option-label": t.optionLabel || "nome",
|
|
1593
|
+
placeholder: t.placeholder,
|
|
1594
|
+
disabled: D(t),
|
|
1595
|
+
"show-clear": t.showClear !== !1,
|
|
1596
|
+
"dialog-header": t.label,
|
|
1597
|
+
"crud-fields": t.crudFields,
|
|
1598
|
+
"crud-columns": t.crudColumns,
|
|
1599
|
+
"onUpdate:modelValue": (s) => i("update:field", t.field, s)
|
|
1600
|
+
}, null, 8, ["model-value", "endpoint", "endpoint-params", "drilldown", "blocked-placeholder", "option-label", "placeholder", "disabled", "show-clear", "dialog-header", "crud-fields", "crud-columns", "onUpdate:modelValue"])) : t.type === "date" ? (o(), $(d(He), {
|
|
1601
|
+
key: 10,
|
|
1602
|
+
"model-value": e.formData[t.field],
|
|
1603
|
+
fluid: "",
|
|
1604
|
+
"date-format": t.dateFormat || "dd/mm/yy",
|
|
1605
|
+
placeholder: t.placeholder,
|
|
1606
|
+
disabled: D(t),
|
|
1607
|
+
"onUpdate:modelValue": (s) => i("update:field", t.field, s)
|
|
1608
|
+
}, null, 8, ["model-value", "date-format", "placeholder", "disabled", "onUpdate:modelValue"])) : t.type === "datetime" ? (o(), $(d(He), {
|
|
1609
|
+
key: 11,
|
|
1610
|
+
"model-value": e.formData[t.field],
|
|
1611
|
+
fluid: "",
|
|
1612
|
+
"show-time": "",
|
|
1613
|
+
"hour-format": t.hourFormat || "24",
|
|
1614
|
+
"date-format": t.dateFormat || "dd/mm/yy",
|
|
1615
|
+
placeholder: t.placeholder,
|
|
1616
|
+
disabled: D(t),
|
|
1617
|
+
"onUpdate:modelValue": (s) => i("update:field", t.field, s)
|
|
1618
|
+
}, null, 8, ["model-value", "hour-format", "date-format", "placeholder", "disabled", "onUpdate:modelValue"])) : t.type === "cpf_cnpj" ? (o(), $(d(de), {
|
|
1619
|
+
key: 12,
|
|
1620
|
+
"model-value": M(e.formData[t.field]),
|
|
1621
|
+
fluid: "",
|
|
1622
|
+
maxlength: "18",
|
|
1623
|
+
placeholder: t.placeholder || "000.000.000-00",
|
|
1624
|
+
disabled: D(t),
|
|
1625
|
+
invalid: !!f[t.field],
|
|
1626
|
+
onInput: (s) => I(t.field, s),
|
|
1627
|
+
onBlur: (s) => Z(t)
|
|
1628
|
+
}, null, 8, ["model-value", "placeholder", "disabled", "invalid", "onInput", "onBlur"])) : t.type === "mask" ? ue((o(), $(d(de), {
|
|
1629
|
+
key: 13,
|
|
1630
|
+
"model-value": e.formData[t.field],
|
|
1631
|
+
fluid: "",
|
|
1632
|
+
placeholder: t.placeholder,
|
|
1633
|
+
disabled: D(t),
|
|
1634
|
+
invalid: !!f[t.field],
|
|
1635
|
+
"onUpdate:modelValue": (s) => i("update:field", t.field, s),
|
|
1636
|
+
onBlur: (s) => Z(t)
|
|
1637
|
+
}, null, 8, ["model-value", "placeholder", "disabled", "invalid", "onUpdate:modelValue", "onBlur"])), [
|
|
1638
|
+
[d(Ue), { mask: T(t.mask) }]
|
|
1639
|
+
]) : t.type === "cep" ? ue((o(), $(d(de), {
|
|
1640
|
+
key: 14,
|
|
1641
|
+
"model-value": e.formData[t.field],
|
|
1642
|
+
fluid: "",
|
|
1643
|
+
placeholder: t.placeholder || "00000-000",
|
|
1644
|
+
disabled: D(t),
|
|
1645
|
+
invalid: !!x[t.field],
|
|
1646
|
+
onInput: (s) => V(t, s)
|
|
1647
|
+
}, null, 8, ["model-value", "placeholder", "disabled", "invalid", "onInput"])), [
|
|
1648
|
+
[d(Ue), { mask: "#####-###" }]
|
|
1649
|
+
]) : t.type === "textarea" ? (o(), $(d(Vt), {
|
|
1650
|
+
key: 15,
|
|
1651
|
+
"model-value": e.formData[t.field],
|
|
1652
|
+
fluid: "",
|
|
1653
|
+
autofocus: j(t) || void 0,
|
|
1654
|
+
rows: t.rows || 3,
|
|
1655
|
+
placeholder: t.placeholder,
|
|
1656
|
+
disabled: D(t),
|
|
1657
|
+
"onUpdate:modelValue": (s) => i("update:field", t.field, s)
|
|
1658
|
+
}, null, 8, ["model-value", "autofocus", "rows", "placeholder", "disabled", "onUpdate:modelValue"])) : p("", !0),
|
|
1659
|
+
x[t.field] ? (o(), u("small", Gl, E(x[t.field]), 1)) : f[t.field] ? (o(), u("small", Yl, E(f[t.field]), 1)) : p("", !0)
|
|
1660
|
+
], 6))
|
|
1661
|
+
], void 0, t.field)), 128))
|
|
1662
|
+
], 4)
|
|
1663
|
+
]))), 128))
|
|
1664
|
+
]));
|
|
1665
|
+
}
|
|
1666
|
+
}), Jl = { class: "w-crud-form-footer" }, ot = /* @__PURE__ */ le({
|
|
1667
|
+
__name: "WCrudFormDialog",
|
|
1668
|
+
props: {
|
|
1669
|
+
visible: { type: Boolean },
|
|
1670
|
+
title: {},
|
|
1671
|
+
fields: {},
|
|
1672
|
+
formData: {},
|
|
1673
|
+
isEditing: { type: Boolean },
|
|
1674
|
+
saving: { type: Boolean },
|
|
1675
|
+
disabled: { type: Boolean, default: !1 },
|
|
1676
|
+
width: { default: "480px" },
|
|
1677
|
+
formColumns: { default: void 0 }
|
|
1678
|
+
},
|
|
1679
|
+
emits: ["update:visible", "update:field", "save"],
|
|
1680
|
+
setup(e, { emit: a }) {
|
|
1681
|
+
const l = e, n = a, i = N(null);
|
|
1682
|
+
function f() {
|
|
1683
|
+
i.value ? i.value.validateAll().length === 0 && n("save") : n("save");
|
|
1684
|
+
}
|
|
1685
|
+
return Ce(
|
|
1686
|
+
() => l.visible,
|
|
1687
|
+
(g) => {
|
|
1688
|
+
g && i.value && i.value.clearErrors();
|
|
1689
|
+
}
|
|
1690
|
+
), (g, x) => (o(), $(d(je), {
|
|
1691
|
+
visible: e.visible,
|
|
1692
|
+
header: e.title,
|
|
1693
|
+
style: me({ width: e.width }),
|
|
1694
|
+
modal: "",
|
|
1695
|
+
draggable: !1,
|
|
1696
|
+
class: "w-crud-form-dialog",
|
|
1697
|
+
"onUpdate:visible": x[2] || (x[2] = (h) => n("update:visible", h))
|
|
1698
|
+
}, {
|
|
1699
|
+
default: G(() => [
|
|
1700
|
+
c("form", {
|
|
1701
|
+
class: "w-crud-form",
|
|
1702
|
+
onSubmit: gt(f, ["prevent"])
|
|
1703
|
+
}, [
|
|
1704
|
+
S(Xl, {
|
|
1705
|
+
ref_key: "rendererRef",
|
|
1706
|
+
ref: i,
|
|
1707
|
+
fields: e.fields,
|
|
1708
|
+
"form-data": e.formData,
|
|
1709
|
+
"is-editing": e.isEditing,
|
|
1710
|
+
disabled: e.disabled,
|
|
1711
|
+
columns: e.formColumns,
|
|
1712
|
+
"onUpdate:field": x[0] || (x[0] = (h, V) => n("update:field", h, V))
|
|
1713
|
+
}, Be({ _: 2 }, [
|
|
1714
|
+
_(e.fields, (h) => ({
|
|
1715
|
+
name: `field-${h.field}`,
|
|
1716
|
+
fn: G((V) => [
|
|
1717
|
+
A(g.$slots, `field-${h.field}`, Le(Ne(V)))
|
|
1718
|
+
])
|
|
1719
|
+
})),
|
|
1720
|
+
_(e.fields.filter((h) => h.type === "image"), (h) => ({
|
|
1721
|
+
name: `image-${h.field}`,
|
|
1722
|
+
fn: G((V) => [
|
|
1723
|
+
A(g.$slots, `image-${h.field}`, Le(Ne(V)))
|
|
1724
|
+
])
|
|
1725
|
+
}))
|
|
1726
|
+
]), 1032, ["fields", "form-data", "is-editing", "disabled", "columns"]),
|
|
1727
|
+
c("div", Jl, [
|
|
1728
|
+
A(g.$slots, "footer", {
|
|
1729
|
+
saving: e.saving,
|
|
1730
|
+
disabled: e.disabled
|
|
1731
|
+
}, () => [
|
|
1732
|
+
S(d(L), {
|
|
1733
|
+
type: "button",
|
|
1734
|
+
label: e.disabled ? "Fechar" : "Cancelar",
|
|
1735
|
+
severity: "secondary",
|
|
1736
|
+
text: "",
|
|
1737
|
+
disabled: e.saving,
|
|
1738
|
+
onClick: x[1] || (x[1] = (h) => n("update:visible", !1))
|
|
1739
|
+
}, null, 8, ["label", "disabled"]),
|
|
1740
|
+
e.disabled ? p("", !0) : (o(), $(d(L), {
|
|
1741
|
+
key: 0,
|
|
1742
|
+
type: "submit",
|
|
1743
|
+
label: e.isEditing ? "Atualizar" : "Salvar",
|
|
1744
|
+
icon: "pi pi-check",
|
|
1745
|
+
loading: e.saving
|
|
1746
|
+
}, null, 8, ["label", "loading"]))
|
|
1747
|
+
])
|
|
1748
|
+
])
|
|
1749
|
+
], 32)
|
|
1750
|
+
]),
|
|
1751
|
+
_: 3
|
|
1752
|
+
}, 8, ["visible", "header", "style"]));
|
|
1753
|
+
}
|
|
1754
|
+
});
|
|
1755
|
+
function Zl(e, a) {
|
|
1756
|
+
const l = a[e.field];
|
|
1757
|
+
return e.format ? e.format(l, a) : l == null ? "" : typeof l == "boolean" ? l ? "Sim" : "Não" : String(l);
|
|
1758
|
+
}
|
|
1759
|
+
function Je(e, a) {
|
|
1760
|
+
return e.includes('"') || e.includes(a) || e.includes(`
|
|
1761
|
+
`) || e.includes("\r") ? `"${e.replace(/"/g, '""')}"` : e;
|
|
1762
|
+
}
|
|
1763
|
+
function Ql(e, a, l = {}) {
|
|
1764
|
+
const n = l.separator ?? ";", i = a.map((g) => Je(g.header, n)).join(n), f = e.map((g) => a.map((x) => Je(Zl(x, g), n)).join(n));
|
|
1765
|
+
return "\uFEFF" + [i, ...f].join(`\r
|
|
1766
|
+
`);
|
|
1767
|
+
}
|
|
1768
|
+
function _l(e, a = "export.csv") {
|
|
1769
|
+
const l = new Blob([e], { type: "text/csv;charset=utf-8;" }), n = URL.createObjectURL(l), i = document.createElement("a");
|
|
1770
|
+
i.href = n, i.download = a, document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(n);
|
|
1771
|
+
}
|
|
1772
|
+
const ea = { class: "w-crud" }, ta = {
|
|
1773
|
+
key: 0,
|
|
1774
|
+
class: "w-crud-header"
|
|
1775
|
+
}, la = { class: "w-crud-header-content" }, aa = { class: "w-crud-title" }, oa = {
|
|
1776
|
+
key: 0,
|
|
1777
|
+
class: "w-crud-subtitle"
|
|
1778
|
+
}, na = { class: "w-crud-header-actions" }, sa = {
|
|
1779
|
+
key: 0,
|
|
1780
|
+
class: "w-crud-kpis"
|
|
1781
|
+
}, ia = { class: "w-crud-kpi-content" }, ra = { class: "w-crud-kpi-label" }, ua = { class: "w-crud-kpi-value" }, da = { class: "w-crud-content-main" }, ca = {
|
|
1782
|
+
key: 0,
|
|
1783
|
+
class: "w-crud-filters",
|
|
1784
|
+
style: { display: "flex", "flex-wrap": "wrap", gap: "0.5rem", "align-items": "center", "margin-bottom": "0.75rem" }
|
|
1785
|
+
}, ma = {
|
|
1786
|
+
key: 1,
|
|
1787
|
+
class: "w-crud-table"
|
|
1788
|
+
}, fa = {
|
|
1789
|
+
key: 0,
|
|
1790
|
+
class: "w-crud-bulkbar",
|
|
1791
|
+
style: { display: "flex", "align-items": "center", gap: "0.5rem", "margin-bottom": "0.5rem", padding: "0.5rem 0.75rem", "border-radius": "8px", background: "var(--p-primary-50, #eef2ff)", color: "var(--p-primary-700, #3730a3)" }
|
|
1792
|
+
}, va = { style: { "font-weight": "600", "font-size": "0.85rem", "margin-right": "auto" } }, pa = { class: "w-crud-toolbar" }, ha = { class: "w-crud-toolbar-start" }, ga = { class: "w-crud-toolbar-end" }, ya = {
|
|
1793
|
+
key: 1,
|
|
1794
|
+
class: "w-crud-view-toggle"
|
|
1795
|
+
}, ba = { class: "w-crud-actions" }, wa = {
|
|
1796
|
+
key: 2,
|
|
1797
|
+
class: "w-crud-cards-wrap"
|
|
1798
|
+
}, ka = { class: "w-crud-toolbar w-crud-toolbar--standalone" }, $a = { class: "w-crud-toolbar-start" }, xa = { class: "w-crud-toolbar-end" }, Ca = {
|
|
1799
|
+
key: 1,
|
|
1800
|
+
class: "w-crud-view-toggle"
|
|
1801
|
+
}, Va = {
|
|
1802
|
+
key: 0,
|
|
1803
|
+
class: "w-crud-cards-loading"
|
|
1804
|
+
}, Sa = {
|
|
1805
|
+
key: 2,
|
|
1806
|
+
class: "w-crud-cards"
|
|
1807
|
+
}, Da = ["onClick", "onDblclick", "onContextmenu"], Ea = { class: "w-crud-card-body" }, Pa = {
|
|
1808
|
+
key: 0,
|
|
1809
|
+
class: "w-crud-card-label"
|
|
1810
|
+
}, Ra = { class: "w-crud-card-value" }, Fa = {
|
|
1811
|
+
key: 0,
|
|
1812
|
+
class: "w-crud-card-actions"
|
|
1813
|
+
}, Ma = {
|
|
1814
|
+
key: 0,
|
|
1815
|
+
class: "w-crud-rail"
|
|
1816
|
+
}, Ia = {
|
|
1817
|
+
key: 1,
|
|
1818
|
+
class: "w-crud-rail-sep"
|
|
1819
|
+
}, Aa = {
|
|
1820
|
+
key: 2,
|
|
1821
|
+
class: "w-crud-rail-sep"
|
|
1822
|
+
}, rn = /* @__PURE__ */ le({
|
|
1823
|
+
__name: "WCrudView",
|
|
1824
|
+
props: {
|
|
1825
|
+
crud: {},
|
|
1826
|
+
title: {},
|
|
1827
|
+
subtitle: {},
|
|
1828
|
+
showSearch: { type: Boolean, default: !0 },
|
|
1829
|
+
showHeader: { type: Boolean, default: !0 },
|
|
1830
|
+
dialogWidth: { default: "480px" },
|
|
1831
|
+
formColumns: {},
|
|
1832
|
+
autoInit: { type: Boolean, default: !0 },
|
|
1833
|
+
showKpi: { type: Boolean, default: !1 },
|
|
1834
|
+
kpiIcon: { default: "pi pi-list" },
|
|
1835
|
+
kpiLabel: { default: "Total de Registros" },
|
|
1836
|
+
extraKpis: { default: () => [] },
|
|
1837
|
+
expandable: { type: Boolean, default: !1 },
|
|
1838
|
+
viewToggle: { type: Boolean, default: !0 },
|
|
1839
|
+
defaultView: { default: "table" },
|
|
1840
|
+
cardFields: { default: 4 },
|
|
1841
|
+
actionRail: { type: Boolean, default: !0 },
|
|
1842
|
+
contextMenu: { type: Boolean, default: !0 },
|
|
1843
|
+
showPrint: { type: Boolean, default: !1 },
|
|
1844
|
+
exportCsv: { type: Boolean, default: !0 },
|
|
1845
|
+
csvFilename: { default: "export.csv" },
|
|
1846
|
+
csvScope: { default: "all" },
|
|
1847
|
+
csvPageSize: { default: 200 }
|
|
1848
|
+
},
|
|
1849
|
+
emits: ["row-expand", "row-collapse", "print"],
|
|
1850
|
+
setup(e, { emit: a }) {
|
|
1851
|
+
const l = e, n = a, i = yt(), { formatNumber: f } = Oe(), g = N({}), x = N(l.defaultView);
|
|
1852
|
+
function h(t) {
|
|
1853
|
+
return x.value === t;
|
|
1854
|
+
}
|
|
1855
|
+
function V(t) {
|
|
1856
|
+
x.value = t;
|
|
1857
|
+
}
|
|
1858
|
+
const z = R(
|
|
1859
|
+
() => (l.crud.pagination.page - 1) * l.crud.pagination.pageSize
|
|
1860
|
+
), D = R(
|
|
1861
|
+
() => l.crud.config.columns.filter((t) => t.visible !== !1).map((t) => t.type === "number" && !t.align ? { ...t, align: "right" } : t.type === "currency" && !t.align ? { ...t, align: "right" } : t)
|
|
1862
|
+
);
|
|
1863
|
+
function H(t) {
|
|
1864
|
+
if (t.align === "right") return "text-right";
|
|
1865
|
+
if (t.align === "center") return "text-center";
|
|
1866
|
+
}
|
|
1867
|
+
const J = R(() => D.value.slice(0, l.cardFields)), j = R(() => {
|
|
1868
|
+
const t = [];
|
|
1869
|
+
return l.crud.config.canEdit !== !1 && t.push({ action: "edit", icon: "pi pi-pencil", tooltip: "Editar" }), l.crud.config.canCreate !== !1 && t.push({
|
|
1870
|
+
action: "duplicate",
|
|
1871
|
+
icon: "pi pi-copy",
|
|
1872
|
+
tooltip: "Duplicar",
|
|
1873
|
+
severity: "info"
|
|
1874
|
+
}), l.crud.config.canDelete !== !1 && t.push({
|
|
1875
|
+
action: "delete",
|
|
1876
|
+
icon: "pi pi-trash",
|
|
1877
|
+
tooltip: "Excluir",
|
|
1878
|
+
severity: "danger"
|
|
1879
|
+
}), t;
|
|
1880
|
+
}), T = R(
|
|
1881
|
+
() => l.crud.config.rowActions ?? j.value
|
|
1882
|
+
), M = R(
|
|
1883
|
+
() => T.value.length > 0 || !!i["row-actions"]
|
|
1884
|
+
);
|
|
1885
|
+
function I(t, s) {
|
|
1886
|
+
if (t.handler) {
|
|
1887
|
+
t.handler(s);
|
|
1888
|
+
return;
|
|
1889
|
+
}
|
|
1890
|
+
t.action === "edit" ? l.crud.openEditDialog(s) : t.action === "view" ? l.crud.openViewDialog(s) : t.action === "duplicate" ? l.crud.openDuplicateDialog(s) : t.action === "delete" && l.crud.confirmDelete(s);
|
|
1891
|
+
}
|
|
1892
|
+
function B(t, s) {
|
|
1893
|
+
return t.visible ? t.visible(s) : !0;
|
|
1894
|
+
}
|
|
1895
|
+
function P(t, s) {
|
|
1896
|
+
return t.disabled ? t.disabled(s) : !1;
|
|
1897
|
+
}
|
|
1898
|
+
const Y = R(() => {
|
|
1899
|
+
const t = [];
|
|
1900
|
+
return l.showKpi && t.push({
|
|
1901
|
+
icon: l.kpiIcon,
|
|
1902
|
+
label: l.kpiLabel,
|
|
1903
|
+
value: f(l.crud.pagination.rows, 0)
|
|
1904
|
+
}), t.push(...l.extraKpis), t;
|
|
1905
|
+
}), ee = R(() => l.crud.config.canCreate !== !1), W = N(null), ne = R(() => l.crud.config.selectionMode === "multiple"), ae = R(
|
|
1906
|
+
() => l.crud.config.columns.filter((t) => t.filter)
|
|
1907
|
+
), ve = [
|
|
1908
|
+
{ label: "Sim", value: !0 },
|
|
1909
|
+
{ label: "Não", value: !1 }
|
|
1910
|
+
];
|
|
1911
|
+
function Z(t) {
|
|
1912
|
+
var s;
|
|
1913
|
+
return ((s = t.filter) == null ? void 0 : s.param) || t.field;
|
|
1914
|
+
}
|
|
1915
|
+
const ie = {};
|
|
1916
|
+
function ge(t, s) {
|
|
1917
|
+
const k = Z(t);
|
|
1918
|
+
ie[k] && clearTimeout(ie[k]), ie[k] = setTimeout(() => l.crud.setColumnFilter(k, s || null), 300);
|
|
1919
|
+
}
|
|
1920
|
+
const te = N(null);
|
|
1921
|
+
function Q(t) {
|
|
1922
|
+
W.value = t;
|
|
1923
|
+
}
|
|
1924
|
+
function se(t) {
|
|
1925
|
+
var s;
|
|
1926
|
+
l.contextMenu && (W.value = t.data, (s = te.value) == null || s.show(t.originalEvent));
|
|
1927
|
+
}
|
|
1928
|
+
function ce(t, s) {
|
|
1929
|
+
var k;
|
|
1930
|
+
l.contextMenu && (t.preventDefault(), W.value = s, (k = te.value) == null || k.show(t));
|
|
1931
|
+
}
|
|
1932
|
+
const he = R(() => {
|
|
1933
|
+
const t = W.value;
|
|
1934
|
+
if (!t) return [];
|
|
1935
|
+
const s = [
|
|
1936
|
+
{
|
|
1937
|
+
label: "Ver detalhes",
|
|
1938
|
+
icon: "pi pi-eye",
|
|
1939
|
+
command: () => l.crud.openViewDialog(t)
|
|
1940
|
+
}
|
|
1941
|
+
];
|
|
1942
|
+
for (const k of T.value)
|
|
1943
|
+
B(k, t) && s.push({
|
|
1944
|
+
label: k.tooltip ?? k.action,
|
|
1945
|
+
icon: k.icon,
|
|
1946
|
+
class: k.severity === "danger" ? "w-crud-ctx-danger" : void 0,
|
|
1947
|
+
disabled: P(k, t),
|
|
1948
|
+
command: () => I(k, t)
|
|
1949
|
+
});
|
|
1950
|
+
return l.showPrint && s.push({
|
|
1951
|
+
label: "Imprimir",
|
|
1952
|
+
icon: "pi pi-print",
|
|
1953
|
+
command: () => n("print", t)
|
|
1954
|
+
}), l.exportCsv && (s.push({ separator: !0 }), s.push({
|
|
1955
|
+
label: l.csvScope === "all" ? "Exportar tudo (CSV)" : "Exportar página (CSV)",
|
|
1956
|
+
icon: "pi pi-download",
|
|
1957
|
+
command: () => C()
|
|
1958
|
+
})), s;
|
|
1959
|
+
});
|
|
1960
|
+
function m() {
|
|
1961
|
+
W.value && n("print", W.value);
|
|
1962
|
+
}
|
|
1963
|
+
const w = N(!1);
|
|
1964
|
+
async function C() {
|
|
1965
|
+
if (!w.value) {
|
|
1966
|
+
w.value = !0;
|
|
1967
|
+
try {
|
|
1968
|
+
const t = l.csvScope === "page" ? l.crud.items.value : await l.crud.fetchAll(l.csvPageSize), s = Ql(t, D.value);
|
|
1969
|
+
_l(s, l.csvFilename);
|
|
1970
|
+
} finally {
|
|
1971
|
+
w.value = !1;
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
return bt(() => {
|
|
1976
|
+
l.autoInit && l.crud.init();
|
|
1977
|
+
}), (t, s) => {
|
|
1978
|
+
const k = Qe("tooltip");
|
|
1979
|
+
return o(), u("div", ea, [
|
|
1980
|
+
e.showHeader ? (o(), u("div", ta, [
|
|
1981
|
+
c("div", la, [
|
|
1982
|
+
c("h1", aa, E(e.title), 1),
|
|
1983
|
+
e.subtitle ? (o(), u("p", oa, E(e.subtitle), 1)) : p("", !0)
|
|
1984
|
+
]),
|
|
1985
|
+
c("div", na, [
|
|
1986
|
+
A(t.$slots, "header-actions"),
|
|
1987
|
+
ee.value && !e.actionRail ? (o(), $(d(L), {
|
|
1988
|
+
key: 0,
|
|
1989
|
+
label: "Novo",
|
|
1990
|
+
icon: "pi pi-plus",
|
|
1991
|
+
onClick: s[0] || (s[0] = (r) => e.crud.openCreateDialog())
|
|
1992
|
+
})) : p("", !0)
|
|
1993
|
+
])
|
|
1994
|
+
])) : p("", !0),
|
|
1995
|
+
A(t.$slots, "before-table", {}, () => [
|
|
1996
|
+
Y.value.length ? (o(), u("div", sa, [
|
|
1997
|
+
(o(!0), u(K, null, _(Y.value, (r, F) => (o(), u("div", {
|
|
1998
|
+
key: F,
|
|
1999
|
+
class: "w-crud-kpi"
|
|
2000
|
+
}, [
|
|
2001
|
+
c("div", {
|
|
2002
|
+
class: X(["w-crud-kpi-icon", r.severity ? `w-crud-kpi-icon--${r.severity}` : ""])
|
|
2003
|
+
}, [
|
|
2004
|
+
c("i", {
|
|
2005
|
+
class: X([r.icon]),
|
|
2006
|
+
style: me(r.color ? `color: ${r.color}` : "")
|
|
2007
|
+
}, null, 6)
|
|
2008
|
+
], 2),
|
|
2009
|
+
c("div", ia, [
|
|
2010
|
+
c("div", ra, E(r.label), 1),
|
|
2011
|
+
c("div", ua, E(r.value), 1)
|
|
2012
|
+
])
|
|
2013
|
+
]))), 128))
|
|
2014
|
+
])) : p("", !0)
|
|
2015
|
+
]),
|
|
2016
|
+
c("div", {
|
|
2017
|
+
class: X(["w-crud-content", { "w-crud-content--rail": e.actionRail }])
|
|
2018
|
+
}, [
|
|
2019
|
+
c("div", da, [
|
|
2020
|
+
ae.value.length ? (o(), u("div", ca, [
|
|
2021
|
+
(o(!0), u(K, null, _(ae.value, (r) => {
|
|
2022
|
+
var F, b, q, fe, pe, Ee, Pe, ye, xe;
|
|
2023
|
+
return o(), u(K, {
|
|
2024
|
+
key: r.field
|
|
2025
|
+
}, [
|
|
2026
|
+
(((F = r.filter) == null ? void 0 : F.type) || "text") === "text" ? (o(), $(d(de), {
|
|
2027
|
+
key: 0,
|
|
2028
|
+
"model-value": e.crud.columnFilters[Z(r)] ?? "",
|
|
2029
|
+
placeholder: ((b = r.filter) == null ? void 0 : b.placeholder) || r.header,
|
|
2030
|
+
size: "small",
|
|
2031
|
+
onInput: (re) => ge(r, re.target.value)
|
|
2032
|
+
}, null, 8, ["model-value", "placeholder", "onInput"])) : ((q = r.filter) == null ? void 0 : q.type) === "select" ? (o(), $(d(ze), {
|
|
2033
|
+
key: 1,
|
|
2034
|
+
"model-value": e.crud.columnFilters[Z(r)],
|
|
2035
|
+
options: (fe = r.filter) == null ? void 0 : fe.options,
|
|
2036
|
+
"option-label": "label",
|
|
2037
|
+
"option-value": "value",
|
|
2038
|
+
placeholder: ((pe = r.filter) == null ? void 0 : pe.placeholder) || r.header,
|
|
2039
|
+
"show-clear": "",
|
|
2040
|
+
size: "small",
|
|
2041
|
+
"onUpdate:modelValue": (re) => e.crud.setColumnFilter(Z(r), re)
|
|
2042
|
+
}, null, 8, ["model-value", "options", "placeholder", "onUpdate:modelValue"])) : ((Ee = r.filter) == null ? void 0 : Ee.type) === "boolean" ? (o(), $(d(ze), {
|
|
2043
|
+
key: 2,
|
|
2044
|
+
"model-value": e.crud.columnFilters[Z(r)],
|
|
2045
|
+
options: ve,
|
|
2046
|
+
"option-label": "label",
|
|
2047
|
+
"option-value": "value",
|
|
2048
|
+
placeholder: ((Pe = r.filter) == null ? void 0 : Pe.placeholder) || r.header,
|
|
2049
|
+
"show-clear": "",
|
|
2050
|
+
size: "small",
|
|
2051
|
+
"onUpdate:modelValue": (re) => e.crud.setColumnFilter(Z(r), re)
|
|
2052
|
+
}, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"])) : ((ye = r.filter) == null ? void 0 : ye.type) === "numeric" ? (o(), $(d(Te), {
|
|
2053
|
+
key: 3,
|
|
2054
|
+
"model-value": e.crud.columnFilters[Z(r)] ?? null,
|
|
2055
|
+
placeholder: ((xe = r.filter) == null ? void 0 : xe.placeholder) || r.header,
|
|
2056
|
+
size: "small",
|
|
2057
|
+
"onUpdate:modelValue": (re) => e.crud.setColumnFilter(Z(r), re)
|
|
2058
|
+
}, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"])) : p("", !0)
|
|
2059
|
+
], 64);
|
|
2060
|
+
}), 128)),
|
|
2061
|
+
Object.keys(e.crud.columnFilters).length ? (o(), $(d(L), {
|
|
2062
|
+
key: 0,
|
|
2063
|
+
label: "Limpar filtros",
|
|
2064
|
+
icon: "pi pi-filter-slash",
|
|
2065
|
+
text: "",
|
|
2066
|
+
size: "small",
|
|
2067
|
+
onClick: s[1] || (s[1] = (r) => e.crud.clearColumnFilters())
|
|
2068
|
+
})) : p("", !0)
|
|
2069
|
+
])) : p("", !0),
|
|
2070
|
+
x.value === "table" ? (o(), u("div", ma, [
|
|
2071
|
+
ne.value && e.crud.selectedItems.value.length ? (o(), u("div", fa, [
|
|
2072
|
+
c("span", va, E(e.crud.selectedItems.value.length) + " selecionado(s) ", 1),
|
|
2073
|
+
A(t.$slots, "bulk-actions", {
|
|
2074
|
+
selected: e.crud.selectedItems.value,
|
|
2075
|
+
crud: e.crud
|
|
2076
|
+
}, () => [
|
|
2077
|
+
(o(!0), u(K, null, _(e.crud.config.bulkActions || [], (r) => (o(), $(d(L), {
|
|
2078
|
+
key: r.action,
|
|
2079
|
+
label: r.label,
|
|
2080
|
+
icon: r.icon,
|
|
2081
|
+
severity: r.severity,
|
|
2082
|
+
size: "small",
|
|
2083
|
+
disabled: r.disabled ? r.disabled(e.crud.selectedItems.value) : !1,
|
|
2084
|
+
onClick: (F) => r.handler(e.crud.selectedItems.value)
|
|
2085
|
+
}, null, 8, ["label", "icon", "severity", "disabled", "onClick"]))), 128))
|
|
2086
|
+
]),
|
|
2087
|
+
ue(S(d(L), {
|
|
2088
|
+
icon: "pi pi-times",
|
|
2089
|
+
text: "",
|
|
2090
|
+
rounded: "",
|
|
2091
|
+
size: "small",
|
|
2092
|
+
onClick: s[2] || (s[2] = (r) => e.crud.clearSelection())
|
|
2093
|
+
}, null, 512), [
|
|
2094
|
+
[
|
|
2095
|
+
k,
|
|
2096
|
+
"Limpar seleção",
|
|
2097
|
+
void 0,
|
|
2098
|
+
{ top: !0 }
|
|
2099
|
+
]
|
|
2100
|
+
])
|
|
2101
|
+
])) : p("", !0),
|
|
2102
|
+
S(d(_e), {
|
|
2103
|
+
"expanded-rows": g.value,
|
|
2104
|
+
"onUpdate:expandedRows": s[6] || (s[6] = (r) => g.value = r),
|
|
2105
|
+
value: e.crud.items.value,
|
|
2106
|
+
loading: e.crud.loading.value,
|
|
2107
|
+
paginator: "",
|
|
2108
|
+
rows: e.crud.pagination.pageSize,
|
|
2109
|
+
"total-records": e.crud.pagination.rows,
|
|
2110
|
+
"rows-per-page-options": [10, 20, 50],
|
|
2111
|
+
"paginator-template": "CurrentPageReport PrevPageLink NextPageLink",
|
|
2112
|
+
"current-page-report-template": "Página {currentPage} de {totalPages}",
|
|
2113
|
+
pt: { pcPaginator: { root: { class: "w-crud-paginator" } } },
|
|
2114
|
+
lazy: "",
|
|
2115
|
+
"striped-rows": "",
|
|
2116
|
+
"removable-sort": "",
|
|
2117
|
+
size: "small",
|
|
2118
|
+
"sort-field": e.crud.sort.field ?? void 0,
|
|
2119
|
+
"sort-order": e.crud.sort.order,
|
|
2120
|
+
"data-key": e.crud.config.pk || "id",
|
|
2121
|
+
selection: ne.value ? e.crud.selectedItems.value : e.actionRail || e.contextMenu ? W.value : void 0,
|
|
2122
|
+
"selection-mode": ne.value ? void 0 : e.actionRail || e.contextMenu ? "single" : void 0,
|
|
2123
|
+
"context-menu": e.contextMenu,
|
|
2124
|
+
"context-menu-selection": e.contextMenu ? W.value : void 0,
|
|
2125
|
+
"onUpdate:selection": s[7] || (s[7] = (r) => ne.value ? e.crud.selectedItems.value = r : W.value = r),
|
|
2126
|
+
"onUpdate:contextMenuSelection": s[8] || (s[8] = (r) => W.value = r),
|
|
2127
|
+
onRowContextmenu: se,
|
|
2128
|
+
onPage: e.crud.onPage,
|
|
2129
|
+
onSort: s[9] || (s[9] = (r) => e.crud.onSort({ sortField: r.sortField, sortOrder: r.sortOrder })),
|
|
2130
|
+
onRowExpand: s[10] || (s[10] = (r) => n("row-expand", r.data)),
|
|
2131
|
+
onRowCollapse: s[11] || (s[11] = (r) => n("row-collapse", r.data))
|
|
2132
|
+
}, Be({
|
|
2133
|
+
header: G(() => [
|
|
2134
|
+
c("div", pa, [
|
|
2135
|
+
c("div", ha, [
|
|
2136
|
+
e.showSearch ? (o(), $(d(Se), { key: 0 }, {
|
|
2137
|
+
default: G(() => [
|
|
2138
|
+
S(d(De), { class: "pi pi-search" }),
|
|
2139
|
+
S(d(de), {
|
|
2140
|
+
"model-value": e.crud.search.value,
|
|
2141
|
+
placeholder: "Buscar...",
|
|
2142
|
+
class: "w-72",
|
|
2143
|
+
onInput: e.crud.onSearch
|
|
2144
|
+
}, null, 8, ["model-value", "onInput"])
|
|
2145
|
+
]),
|
|
2146
|
+
_: 1
|
|
2147
|
+
})) : p("", !0),
|
|
2148
|
+
A(t.$slots, "toolbar-start"),
|
|
2149
|
+
A(t.$slots, "toolbar-filters")
|
|
2150
|
+
]),
|
|
2151
|
+
c("div", ga, [
|
|
2152
|
+
A(t.$slots, "toolbar-actions"),
|
|
2153
|
+
e.exportCsv ? ue((o(), $(d(L), {
|
|
2154
|
+
key: 0,
|
|
2155
|
+
icon: "pi pi-download",
|
|
2156
|
+
text: "",
|
|
2157
|
+
size: "small",
|
|
2158
|
+
loading: w.value,
|
|
2159
|
+
onClick: C
|
|
2160
|
+
}, null, 8, ["loading"])), [
|
|
2161
|
+
[
|
|
2162
|
+
k,
|
|
2163
|
+
e.csvScope === "all" ? "Exportar tudo (CSV)" : "Exportar página (CSV)",
|
|
2164
|
+
void 0,
|
|
2165
|
+
{ top: !0 }
|
|
2166
|
+
]
|
|
2167
|
+
]) : p("", !0),
|
|
2168
|
+
e.viewToggle ? (o(), u("div", ya, [
|
|
2169
|
+
S(d(L), {
|
|
2170
|
+
icon: "pi pi-table",
|
|
2171
|
+
size: "small",
|
|
2172
|
+
text: !h("table"),
|
|
2173
|
+
outlined: h("table"),
|
|
2174
|
+
onClick: s[3] || (s[3] = (r) => V("table"))
|
|
2175
|
+
}, null, 8, ["text", "outlined"]),
|
|
2176
|
+
S(d(L), {
|
|
2177
|
+
icon: "pi pi-th-large",
|
|
2178
|
+
size: "small",
|
|
2179
|
+
text: !h("cards"),
|
|
2180
|
+
outlined: h("cards"),
|
|
2181
|
+
onClick: s[4] || (s[4] = (r) => V("cards"))
|
|
2182
|
+
}, null, 8, ["text", "outlined"])
|
|
2183
|
+
])) : p("", !0),
|
|
2184
|
+
!e.showHeader && ee.value && !e.actionRail ? (o(), $(d(L), {
|
|
2185
|
+
key: 2,
|
|
2186
|
+
label: "Novo",
|
|
2187
|
+
icon: "pi pi-plus",
|
|
2188
|
+
onClick: s[5] || (s[5] = (r) => e.crud.openCreateDialog())
|
|
2189
|
+
})) : p("", !0)
|
|
2190
|
+
])
|
|
2191
|
+
])
|
|
2192
|
+
]),
|
|
2193
|
+
empty: G(() => [
|
|
2194
|
+
A(t.$slots, "empty", {}, () => [
|
|
2195
|
+
s[19] || (s[19] = c("div", { class: "w-crud-empty" }, [
|
|
2196
|
+
c("div", { class: "w-crud-empty-icon" }, [
|
|
2197
|
+
c("i", { class: "pi pi-inbox" })
|
|
2198
|
+
]),
|
|
2199
|
+
c("p", { class: "w-crud-empty-title" }, "Nenhum registro encontrado"),
|
|
2200
|
+
c("p", { class: "w-crud-empty-text" }, "Tente ajustar sua busca ou crie um novo registro")
|
|
2201
|
+
], -1))
|
|
2202
|
+
])
|
|
2203
|
+
]),
|
|
2204
|
+
default: G(() => [
|
|
2205
|
+
ne.value ? (o(), $(d($e), {
|
|
2206
|
+
key: 0,
|
|
2207
|
+
"selection-mode": "multiple",
|
|
2208
|
+
style: { width: "3rem" }
|
|
2209
|
+
})) : p("", !0),
|
|
2210
|
+
e.expandable ? (o(), $(d($e), {
|
|
2211
|
+
key: 1,
|
|
2212
|
+
expander: "",
|
|
2213
|
+
style: { width: "3rem" }
|
|
2214
|
+
})) : p("", !0),
|
|
2215
|
+
(o(!0), u(K, null, _(D.value, (r) => (o(), $(d($e), {
|
|
2216
|
+
key: r.field,
|
|
2217
|
+
field: r.field,
|
|
2218
|
+
header: r.header,
|
|
2219
|
+
sortable: r.sortable,
|
|
2220
|
+
style: me(r.style),
|
|
2221
|
+
"header-class": H(r),
|
|
2222
|
+
"body-class": H(r)
|
|
2223
|
+
}, {
|
|
2224
|
+
body: G(({ data: F }) => [
|
|
2225
|
+
A(t.$slots, `column-${r.field}`, {
|
|
2226
|
+
data: F,
|
|
2227
|
+
value: F[r.field]
|
|
2228
|
+
}, () => [
|
|
2229
|
+
S(We, {
|
|
2230
|
+
column: r,
|
|
2231
|
+
value: F[r.field],
|
|
2232
|
+
"row-data": F
|
|
2233
|
+
}, null, 8, ["column", "value", "row-data"])
|
|
2234
|
+
])
|
|
2235
|
+
]),
|
|
2236
|
+
_: 2
|
|
2237
|
+
}, 1032, ["field", "header", "sortable", "style", "header-class", "body-class"]))), 128)),
|
|
2238
|
+
M.value && !e.actionRail ? (o(), $(d($e), {
|
|
2239
|
+
key: 2,
|
|
2240
|
+
"header-class": "w-crud-actions-header",
|
|
2241
|
+
style: me({
|
|
2242
|
+
width: `${(T.value.length + (d(i)["row-actions"] ? 1 : 0)) * 2.5 + 1}rem`
|
|
2243
|
+
})
|
|
2244
|
+
}, {
|
|
2245
|
+
body: G(({ data: r }) => [
|
|
2246
|
+
c("div", ba, [
|
|
2247
|
+
(o(!0), u(K, null, _(T.value, (F) => (o(), u(K, {
|
|
2248
|
+
key: F.action
|
|
2249
|
+
}, [
|
|
2250
|
+
B(F, r) ? ue((o(), $(d(L), {
|
|
2251
|
+
key: 0,
|
|
2252
|
+
icon: F.icon,
|
|
2253
|
+
text: "",
|
|
2254
|
+
rounded: "",
|
|
2255
|
+
size: "small",
|
|
2256
|
+
severity: F.severity,
|
|
2257
|
+
disabled: P(F, r),
|
|
2258
|
+
onClick: (b) => I(F, r)
|
|
2259
|
+
}, null, 8, ["icon", "severity", "disabled", "onClick"])), [
|
|
2260
|
+
[
|
|
2261
|
+
k,
|
|
2262
|
+
F.tooltip,
|
|
2263
|
+
void 0,
|
|
2264
|
+
{ top: !0 }
|
|
2265
|
+
]
|
|
2266
|
+
]) : p("", !0)
|
|
2267
|
+
], 64))), 128)),
|
|
2268
|
+
A(t.$slots, "row-actions", {
|
|
2269
|
+
data: r,
|
|
2270
|
+
crud: e.crud
|
|
2271
|
+
})
|
|
2272
|
+
])
|
|
2273
|
+
]),
|
|
2274
|
+
_: 3
|
|
2275
|
+
}, 8, ["style"])) : p("", !0)
|
|
2276
|
+
]),
|
|
2277
|
+
_: 2
|
|
2278
|
+
}, [
|
|
2279
|
+
e.expandable ? {
|
|
2280
|
+
name: "expansion",
|
|
2281
|
+
fn: G((r) => [
|
|
2282
|
+
A(t.$slots, "expansion", {
|
|
2283
|
+
data: r.data
|
|
2284
|
+
})
|
|
2285
|
+
]),
|
|
2286
|
+
key: "0"
|
|
2287
|
+
} : void 0
|
|
2288
|
+
]), 1032, ["expanded-rows", "value", "loading", "rows", "total-records", "sort-field", "sort-order", "data-key", "selection", "selection-mode", "context-menu", "context-menu-selection", "onPage"])
|
|
2289
|
+
])) : (o(), u("div", wa, [
|
|
2290
|
+
c("div", ka, [
|
|
2291
|
+
c("div", $a, [
|
|
2292
|
+
e.showSearch ? (o(), $(d(Se), { key: 0 }, {
|
|
2293
|
+
default: G(() => [
|
|
2294
|
+
S(d(De), { class: "pi pi-search" }),
|
|
2295
|
+
S(d(de), {
|
|
2296
|
+
"model-value": e.crud.search.value,
|
|
2297
|
+
placeholder: "Buscar...",
|
|
2298
|
+
class: "w-72",
|
|
2299
|
+
onInput: e.crud.onSearch
|
|
2300
|
+
}, null, 8, ["model-value", "onInput"])
|
|
2301
|
+
]),
|
|
2302
|
+
_: 1
|
|
2303
|
+
})) : p("", !0),
|
|
2304
|
+
A(t.$slots, "toolbar-start"),
|
|
2305
|
+
A(t.$slots, "toolbar-filters")
|
|
2306
|
+
]),
|
|
2307
|
+
c("div", xa, [
|
|
2308
|
+
A(t.$slots, "toolbar-actions"),
|
|
2309
|
+
e.exportCsv ? ue((o(), $(d(L), {
|
|
2310
|
+
key: 0,
|
|
2311
|
+
icon: "pi pi-download",
|
|
2312
|
+
text: "",
|
|
2313
|
+
size: "small",
|
|
2314
|
+
loading: w.value,
|
|
2315
|
+
onClick: C
|
|
2316
|
+
}, null, 8, ["loading"])), [
|
|
2317
|
+
[
|
|
2318
|
+
k,
|
|
2319
|
+
e.csvScope === "all" ? "Exportar tudo (CSV)" : "Exportar página (CSV)",
|
|
2320
|
+
void 0,
|
|
2321
|
+
{ top: !0 }
|
|
2322
|
+
]
|
|
2323
|
+
]) : p("", !0),
|
|
2324
|
+
e.viewToggle ? (o(), u("div", Ca, [
|
|
2325
|
+
S(d(L), {
|
|
2326
|
+
icon: "pi pi-table",
|
|
2327
|
+
size: "small",
|
|
2328
|
+
text: !h("table"),
|
|
2329
|
+
outlined: h("table"),
|
|
2330
|
+
onClick: s[12] || (s[12] = (r) => V("table"))
|
|
2331
|
+
}, null, 8, ["text", "outlined"]),
|
|
2332
|
+
S(d(L), {
|
|
2333
|
+
icon: "pi pi-th-large",
|
|
2334
|
+
size: "small",
|
|
2335
|
+
text: !h("cards"),
|
|
2336
|
+
outlined: h("cards"),
|
|
2337
|
+
onClick: s[13] || (s[13] = (r) => V("cards"))
|
|
2338
|
+
}, null, 8, ["text", "outlined"])
|
|
2339
|
+
])) : p("", !0),
|
|
2340
|
+
!e.showHeader && ee.value && !e.actionRail ? (o(), $(d(L), {
|
|
2341
|
+
key: 2,
|
|
2342
|
+
label: "Novo",
|
|
2343
|
+
icon: "pi pi-plus",
|
|
2344
|
+
onClick: s[14] || (s[14] = (r) => e.crud.openCreateDialog())
|
|
2345
|
+
})) : p("", !0)
|
|
2346
|
+
])
|
|
2347
|
+
]),
|
|
2348
|
+
e.crud.loading.value ? (o(), u("div", Va, [...s[20] || (s[20] = [
|
|
2349
|
+
c("i", { class: "pi pi-spin pi-spinner" }, null, -1)
|
|
2350
|
+
])])) : e.crud.items.value.length ? (o(), u("div", Sa, [
|
|
2351
|
+
(o(!0), u(K, null, _(e.crud.items.value, (r, F) => (o(), u("div", {
|
|
2352
|
+
key: r[e.crud.config.pk || "id"] ?? F,
|
|
2353
|
+
class: X(["w-crud-card", { "w-crud-card--selected": W.value === r }]),
|
|
2354
|
+
onClick: (b) => Q(r),
|
|
2355
|
+
onDblclick: (b) => e.crud.config.canEdit !== !1 && e.crud.openEditDialog(r),
|
|
2356
|
+
onContextmenu: (b) => ce(b, r)
|
|
2357
|
+
}, [
|
|
2358
|
+
c("div", Ea, [
|
|
2359
|
+
(o(!0), u(K, null, _(J.value, (b, q) => (o(), u("div", {
|
|
2360
|
+
key: b.field,
|
|
2361
|
+
class: X(["w-crud-card-row", { "w-crud-card-row--title": q === 0 }])
|
|
2362
|
+
}, [
|
|
2363
|
+
q !== 0 ? (o(), u("span", Pa, E(b.header), 1)) : p("", !0),
|
|
2364
|
+
c("span", Ra, [
|
|
2365
|
+
A(t.$slots, `column-${b.field}`, {
|
|
2366
|
+
data: r,
|
|
2367
|
+
value: r[b.field]
|
|
2368
|
+
}, () => [
|
|
2369
|
+
S(We, {
|
|
2370
|
+
column: b,
|
|
2371
|
+
value: r[b.field],
|
|
2372
|
+
"row-data": r
|
|
2373
|
+
}, null, 8, ["column", "value", "row-data"])
|
|
2374
|
+
])
|
|
2375
|
+
])
|
|
2376
|
+
], 2))), 128))
|
|
2377
|
+
]),
|
|
2378
|
+
M.value && !e.actionRail ? (o(), u("div", Fa, [
|
|
2379
|
+
(o(!0), u(K, null, _(T.value, (b) => (o(), u(K, {
|
|
2380
|
+
key: b.action
|
|
2381
|
+
}, [
|
|
2382
|
+
B(b, r) ? ue((o(), $(d(L), {
|
|
2383
|
+
key: 0,
|
|
2384
|
+
icon: b.icon,
|
|
2385
|
+
text: "",
|
|
2386
|
+
rounded: "",
|
|
2387
|
+
size: "small",
|
|
2388
|
+
severity: b.severity,
|
|
2389
|
+
disabled: P(b, r),
|
|
2390
|
+
onClick: (q) => I(b, r)
|
|
2391
|
+
}, null, 8, ["icon", "severity", "disabled", "onClick"])), [
|
|
2392
|
+
[
|
|
2393
|
+
k,
|
|
2394
|
+
b.tooltip,
|
|
2395
|
+
void 0,
|
|
2396
|
+
{ top: !0 }
|
|
2397
|
+
]
|
|
2398
|
+
]) : p("", !0)
|
|
2399
|
+
], 64))), 128)),
|
|
2400
|
+
A(t.$slots, "row-actions", {
|
|
2401
|
+
data: r,
|
|
2402
|
+
crud: e.crud
|
|
2403
|
+
})
|
|
2404
|
+
])) : p("", !0)
|
|
2405
|
+
], 42, Da))), 128))
|
|
2406
|
+
])) : A(t.$slots, "empty", {}, () => [
|
|
2407
|
+
s[21] || (s[21] = wt('<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))
|
|
2408
|
+
], void 0, 1),
|
|
2409
|
+
e.crud.items.value.length ? (o(), $(d(kt), {
|
|
2410
|
+
key: 3,
|
|
2411
|
+
rows: e.crud.pagination.pageSize,
|
|
2412
|
+
"total-records": e.crud.pagination.rows,
|
|
2413
|
+
first: z.value,
|
|
2414
|
+
"rows-per-page-options": [10, 20, 50],
|
|
2415
|
+
template: "CurrentPageReport PrevPageLink NextPageLink",
|
|
2416
|
+
"current-page-report-template": "Página {currentPage} de {totalPages}",
|
|
2417
|
+
class: "w-crud-paginator",
|
|
2418
|
+
onPage: e.crud.onPage
|
|
2419
|
+
}, null, 8, ["rows", "total-records", "first", "onPage"])) : p("", !0)
|
|
2420
|
+
]))
|
|
2421
|
+
]),
|
|
2422
|
+
e.actionRail ? (o(), u("aside", Ma, [
|
|
2423
|
+
ee.value ? ue((o(), $(d(L), {
|
|
2424
|
+
key: 0,
|
|
2425
|
+
icon: "pi pi-plus",
|
|
2426
|
+
rounded: "",
|
|
2427
|
+
onClick: s[15] || (s[15] = (r) => e.crud.openCreateDialog())
|
|
2428
|
+
}, null, 512)), [
|
|
2429
|
+
[
|
|
2430
|
+
k,
|
|
2431
|
+
"Novo",
|
|
2432
|
+
void 0,
|
|
2433
|
+
{ left: !0 }
|
|
2434
|
+
]
|
|
2435
|
+
]) : p("", !0),
|
|
2436
|
+
ee.value && T.value.length ? (o(), u("div", Ia)) : p("", !0),
|
|
2437
|
+
(o(!0), u(K, null, _(T.value, (r) => (o(), u(K, {
|
|
2438
|
+
key: r.action
|
|
2439
|
+
}, [
|
|
2440
|
+
!W.value || B(r, W.value) ? ue((o(), $(d(L), {
|
|
2441
|
+
key: 0,
|
|
2442
|
+
icon: r.icon,
|
|
2443
|
+
text: "",
|
|
2444
|
+
rounded: "",
|
|
2445
|
+
severity: r.severity,
|
|
2446
|
+
disabled: !W.value || P(r, W.value),
|
|
2447
|
+
onClick: (F) => W.value && I(r, W.value)
|
|
2448
|
+
}, null, 8, ["icon", "severity", "disabled", "onClick"])), [
|
|
2449
|
+
[
|
|
2450
|
+
k,
|
|
2451
|
+
r.tooltip,
|
|
2452
|
+
void 0,
|
|
2453
|
+
{ left: !0 }
|
|
2454
|
+
]
|
|
2455
|
+
]) : p("", !0)
|
|
2456
|
+
], 64))), 128)),
|
|
2457
|
+
A(t.$slots, "rail-actions", {
|
|
2458
|
+
selected: W.value,
|
|
2459
|
+
crud: e.crud
|
|
2460
|
+
}),
|
|
2461
|
+
e.showPrint || e.exportCsv ? (o(), u("div", Aa)) : p("", !0),
|
|
2462
|
+
e.showPrint ? ue((o(), $(d(L), {
|
|
2463
|
+
key: 3,
|
|
2464
|
+
icon: "pi pi-print",
|
|
2465
|
+
text: "",
|
|
2466
|
+
rounded: "",
|
|
2467
|
+
disabled: !W.value,
|
|
2468
|
+
onClick: m
|
|
2469
|
+
}, null, 8, ["disabled"])), [
|
|
2470
|
+
[
|
|
2471
|
+
k,
|
|
2472
|
+
"Imprimir",
|
|
2473
|
+
void 0,
|
|
2474
|
+
{ left: !0 }
|
|
2475
|
+
]
|
|
2476
|
+
]) : p("", !0),
|
|
2477
|
+
e.exportCsv ? ue((o(), $(d(L), {
|
|
2478
|
+
key: 4,
|
|
2479
|
+
icon: "pi pi-download",
|
|
2480
|
+
text: "",
|
|
2481
|
+
rounded: "",
|
|
2482
|
+
loading: w.value,
|
|
2483
|
+
onClick: C
|
|
2484
|
+
}, null, 8, ["loading"])), [
|
|
2485
|
+
[
|
|
2486
|
+
k,
|
|
2487
|
+
e.csvScope === "all" ? "Exportar tudo (CSV)" : "Exportar página (CSV)",
|
|
2488
|
+
void 0,
|
|
2489
|
+
{ left: !0 }
|
|
2490
|
+
]
|
|
2491
|
+
]) : p("", !0)
|
|
2492
|
+
])) : p("", !0)
|
|
2493
|
+
], 2),
|
|
2494
|
+
e.contextMenu ? (o(), $(d($t), {
|
|
2495
|
+
key: 1,
|
|
2496
|
+
ref_key: "cm",
|
|
2497
|
+
ref: te,
|
|
2498
|
+
model: he.value
|
|
2499
|
+
}, null, 8, ["model"])) : p("", !0),
|
|
2500
|
+
A(t.$slots, "form-dialog", {
|
|
2501
|
+
crud: e.crud,
|
|
2502
|
+
dialogWidth: e.dialogWidth
|
|
2503
|
+
}, () => {
|
|
2504
|
+
var r;
|
|
2505
|
+
return [
|
|
2506
|
+
S(ot, {
|
|
2507
|
+
visible: e.crud.dialogVisible.value,
|
|
2508
|
+
title: e.crud.dialogTitle.value,
|
|
2509
|
+
fields: e.crud.config.form,
|
|
2510
|
+
"form-data": e.crud.formData,
|
|
2511
|
+
"is-editing": e.crud.isEditing.value,
|
|
2512
|
+
saving: e.crud.saving.value,
|
|
2513
|
+
disabled: ((r = e.crud.viewMode) == null ? void 0 : r.value) ?? !1,
|
|
2514
|
+
width: e.dialogWidth,
|
|
2515
|
+
"form-columns": e.formColumns ?? e.crud.config.formColumns,
|
|
2516
|
+
"onUpdate:visible": s[16] || (s[16] = (F) => {
|
|
2517
|
+
e.crud.dialogVisible.value = F, F || (e.crud.editingItem.value = null);
|
|
2518
|
+
}),
|
|
2519
|
+
"onUpdate:field": s[17] || (s[17] = (F, b) => e.crud.setFormField(F, b)),
|
|
2520
|
+
onSave: s[18] || (s[18] = (F) => e.crud.save())
|
|
2521
|
+
}, Be({ _: 2 }, [
|
|
2522
|
+
_(e.crud.config.form, (F) => ({
|
|
2523
|
+
name: `field-${F.field}`,
|
|
2524
|
+
fn: G((b) => [
|
|
2525
|
+
A(t.$slots, `field-${F.field}`, Le(Ne(b)))
|
|
2526
|
+
])
|
|
2527
|
+
}))
|
|
2528
|
+
]), 1032, ["visible", "title", "fields", "form-data", "is-editing", "saving", "disabled", "width", "form-columns"])
|
|
2529
|
+
];
|
|
2530
|
+
})
|
|
2531
|
+
]);
|
|
2532
|
+
};
|
|
2533
|
+
}
|
|
2534
|
+
}), Ua = /* @__PURE__ */ le({
|
|
2535
|
+
__name: "WStatusTag",
|
|
2536
|
+
props: {
|
|
2537
|
+
value: {},
|
|
2538
|
+
map: {}
|
|
2539
|
+
},
|
|
2540
|
+
setup(e) {
|
|
2541
|
+
const a = e, l = {
|
|
2542
|
+
ativo: { label: "Ativo", severity: "success" },
|
|
2543
|
+
ativa: { label: "Ativa", severity: "success" },
|
|
2544
|
+
inativo: { label: "Inativo", severity: "danger" },
|
|
2545
|
+
inativa: { label: "Inativa", severity: "danger" },
|
|
2546
|
+
suspensa: { label: "Suspensa", severity: "warn" },
|
|
2547
|
+
suspenso: { label: "Suspenso", severity: "warn" },
|
|
2548
|
+
cancelada: { label: "Cancelada", severity: "danger" },
|
|
2549
|
+
cancelado: { label: "Cancelado", severity: "danger" },
|
|
2550
|
+
pendente: { label: "Pendente", severity: "warn" },
|
|
2551
|
+
confirmada: { label: "Confirmada", severity: "success" },
|
|
2552
|
+
confirmado: { label: "Confirmado", severity: "success" },
|
|
2553
|
+
vencida: { label: "Vencida", severity: "danger" },
|
|
2554
|
+
vencido: { label: "Vencido", severity: "danger" },
|
|
2555
|
+
concluido: { label: "Concluído", severity: "success" },
|
|
2556
|
+
concluida: { label: "Concluída", severity: "success" },
|
|
2557
|
+
em_progresso: { label: "Em Progresso", severity: "info" },
|
|
2558
|
+
em_andamento: { label: "Em Andamento", severity: "info" },
|
|
2559
|
+
expirado: { label: "Expirado", severity: "secondary" },
|
|
2560
|
+
expirada: { label: "Expirada", severity: "secondary" },
|
|
2561
|
+
aberto: { label: "Aberto", severity: "info" },
|
|
2562
|
+
aberta: { label: "Aberta", severity: "info" },
|
|
2563
|
+
fechado: { label: "Fechado", severity: "secondary" },
|
|
2564
|
+
fechada: { label: "Fechada", severity: "secondary" },
|
|
2565
|
+
pago: { label: "Pago", severity: "success" },
|
|
2566
|
+
paga: { label: "Paga", severity: "success" },
|
|
2567
|
+
inadimplente: { label: "Inadimplente", severity: "danger" }
|
|
2568
|
+
}, n = R(() => (a.map ?? l)[a.value] ?? { label: a.value, severity: "secondary" });
|
|
2569
|
+
return (i, f) => (o(), $(d(et), {
|
|
2570
|
+
value: n.value.label,
|
|
2571
|
+
severity: n.value.severity
|
|
2572
|
+
}, null, 8, ["value", "severity"]));
|
|
2573
|
+
}
|
|
2574
|
+
}), Ba = { class: "w-page-header" }, La = { class: "w-page-header-content" }, Na = { class: "w-page-header-title" }, Ta = {
|
|
2575
|
+
key: 0,
|
|
2576
|
+
class: "w-page-header-subtitle"
|
|
2577
|
+
}, za = { class: "w-page-header-actions" }, un = /* @__PURE__ */ le({
|
|
2578
|
+
__name: "WPageHeader",
|
|
2579
|
+
props: {
|
|
2580
|
+
title: {},
|
|
2581
|
+
subtitle: {},
|
|
2582
|
+
actionLabel: {},
|
|
2583
|
+
actionIcon: {}
|
|
2584
|
+
},
|
|
2585
|
+
emits: ["action"],
|
|
2586
|
+
setup(e, { emit: a }) {
|
|
2587
|
+
const l = a;
|
|
2588
|
+
return (n, i) => (o(), u("div", Ba, [
|
|
2589
|
+
c("div", La, [
|
|
2590
|
+
c("h2", Na, E(e.title), 1),
|
|
2591
|
+
e.subtitle ? (o(), u("p", Ta, E(e.subtitle), 1)) : p("", !0)
|
|
2592
|
+
]),
|
|
2593
|
+
c("div", za, [
|
|
2594
|
+
A(n.$slots, "actions"),
|
|
2595
|
+
e.actionLabel ? (o(), $(d(L), {
|
|
2596
|
+
key: 0,
|
|
2597
|
+
label: e.actionLabel,
|
|
2598
|
+
icon: e.actionIcon,
|
|
2599
|
+
onClick: i[0] || (i[0] = (f) => l("action"))
|
|
2600
|
+
}, null, 8, ["label", "icon"])) : p("", !0)
|
|
2601
|
+
])
|
|
2602
|
+
]));
|
|
2603
|
+
}
|
|
2604
|
+
}), Wa = { class: "w-empty-state" }, Oa = { class: "w-empty-state-icon" }, ja = { class: "w-empty-state-title" }, qa = {
|
|
2605
|
+
key: 0,
|
|
2606
|
+
class: "w-empty-state-description"
|
|
2607
|
+
}, dn = /* @__PURE__ */ le({
|
|
2608
|
+
__name: "WEmptyState",
|
|
2609
|
+
props: {
|
|
2610
|
+
icon: {},
|
|
2611
|
+
title: {},
|
|
2612
|
+
description: {},
|
|
2613
|
+
actionLabel: {},
|
|
2614
|
+
actionIcon: {}
|
|
2615
|
+
},
|
|
2616
|
+
emits: ["action"],
|
|
2617
|
+
setup(e, { emit: a }) {
|
|
2618
|
+
const l = a;
|
|
2619
|
+
return (n, i) => (o(), u("div", Wa, [
|
|
2620
|
+
c("div", Oa, [
|
|
2621
|
+
c("i", {
|
|
2622
|
+
class: X(e.icon)
|
|
2623
|
+
}, null, 2)
|
|
2624
|
+
]),
|
|
2625
|
+
c("p", ja, E(e.title), 1),
|
|
2626
|
+
e.description ? (o(), u("p", qa, E(e.description), 1)) : p("", !0),
|
|
2627
|
+
e.actionLabel ? (o(), $(d(L), {
|
|
2628
|
+
key: 1,
|
|
2629
|
+
label: e.actionLabel,
|
|
2630
|
+
icon: e.actionIcon,
|
|
2631
|
+
size: "small",
|
|
2632
|
+
class: "mt-3",
|
|
2633
|
+
onClick: i[0] || (i[0] = (f) => l("action"))
|
|
2634
|
+
}, null, 8, ["label", "icon"])) : p("", !0)
|
|
2635
|
+
]));
|
|
2636
|
+
}
|
|
2637
|
+
});
|
|
2638
|
+
/*!
|
|
2639
|
+
* vue-router v4.6.4
|
|
2640
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
2641
|
+
* @license MIT
|
|
2642
|
+
*/
|
|
2643
|
+
Symbol(process.env.NODE_ENV !== "production" ? "navigation failure" : "");
|
|
2644
|
+
Symbol(process.env.NODE_ENV !== "production" ? "router view location matched" : "");
|
|
2645
|
+
Symbol(process.env.NODE_ENV !== "production" ? "router view depth" : "");
|
|
2646
|
+
const Ha = Symbol(process.env.NODE_ENV !== "production" ? "router" : "");
|
|
2647
|
+
Symbol(process.env.NODE_ENV !== "production" ? "route location" : "");
|
|
2648
|
+
Symbol(process.env.NODE_ENV !== "production" ? "router view location" : "");
|
|
2649
|
+
/*!
|
|
2650
|
+
* vue-router v4.6.4
|
|
2651
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
2652
|
+
* @license MIT
|
|
2653
|
+
*/
|
|
2654
|
+
function Ka() {
|
|
2655
|
+
return Ze(Ha);
|
|
2656
|
+
}
|
|
2657
|
+
const Ga = { class: "w-detail-header" }, Ya = { class: "w-detail-header-left" }, Xa = { class: "w-detail-header-content" }, Ja = { class: "w-detail-header-title" }, Za = {
|
|
2658
|
+
key: 0,
|
|
2659
|
+
class: "w-detail-header-subtitle"
|
|
2660
|
+
}, Qa = { class: "w-detail-header-actions" }, cn = /* @__PURE__ */ le({
|
|
2661
|
+
__name: "WDetailHeader",
|
|
2662
|
+
props: {
|
|
2663
|
+
title: {},
|
|
2664
|
+
subtitle: {},
|
|
2665
|
+
icon: {},
|
|
2666
|
+
backRoute: {},
|
|
2667
|
+
backTo: {},
|
|
2668
|
+
status: {},
|
|
2669
|
+
statusMap: {}
|
|
2670
|
+
},
|
|
2671
|
+
setup(e) {
|
|
2672
|
+
const a = e, l = Ka();
|
|
2673
|
+
function n() {
|
|
2674
|
+
a.backTo ? l.push(typeof a.backTo == "string" ? { name: a.backTo } : a.backTo) : a.backRoute ? l.push({ name: a.backRoute }) : l.back();
|
|
2675
|
+
}
|
|
2676
|
+
return (i, f) => (o(), u("div", Ga, [
|
|
2677
|
+
c("div", Ya, [
|
|
2678
|
+
S(d(L), {
|
|
2679
|
+
icon: "pi pi-arrow-left",
|
|
2680
|
+
text: "",
|
|
2681
|
+
rounded: "",
|
|
2682
|
+
onClick: n
|
|
2683
|
+
}),
|
|
2684
|
+
e.icon ? (o(), u("i", {
|
|
2685
|
+
key: 0,
|
|
2686
|
+
class: X([e.icon, "w-detail-header-icon"])
|
|
2687
|
+
}, null, 2)) : p("", !0),
|
|
2688
|
+
c("div", Xa, [
|
|
2689
|
+
c("h2", Ja, E(e.title), 1),
|
|
2690
|
+
e.subtitle ? (o(), u("p", Za, E(e.subtitle), 1)) : p("", !0)
|
|
2691
|
+
]),
|
|
2692
|
+
e.status ? (o(), $(Ua, {
|
|
2693
|
+
key: 1,
|
|
2694
|
+
value: e.status,
|
|
2695
|
+
map: e.statusMap
|
|
2696
|
+
}, null, 8, ["value", "map"])) : p("", !0)
|
|
2697
|
+
]),
|
|
2698
|
+
c("div", Qa, [
|
|
2699
|
+
A(i.$slots, "actions")
|
|
2700
|
+
])
|
|
2701
|
+
]));
|
|
2702
|
+
}
|
|
2703
|
+
}), _a = { class: "w-info-card" }, eo = {
|
|
2704
|
+
key: 0,
|
|
2705
|
+
class: "w-info-card-title"
|
|
2706
|
+
}, to = { class: "w-info-card-grid" }, lo = { class: "w-info-card-label" }, ao = { class: "w-info-card-value" }, mn = /* @__PURE__ */ le({
|
|
2707
|
+
__name: "WInfoCard",
|
|
2708
|
+
props: {
|
|
2709
|
+
title: {},
|
|
2710
|
+
fields: {}
|
|
2711
|
+
},
|
|
2712
|
+
setup(e) {
|
|
2713
|
+
const { formatCurrency: a, formatDate: l, formatNumber: n } = Oe();
|
|
2714
|
+
function i(f) {
|
|
2715
|
+
const g = f.value;
|
|
2716
|
+
return g == null || g === "" ? "-" : f.format === "currency" ? a(Number(g)) : f.format === "date" ? l(String(g)) : f.format === "datetime" ? l(String(g), "DD/MM/YYYY HH:mm") : f.format === "number" ? n(Number(g)) : String(g);
|
|
2717
|
+
}
|
|
2718
|
+
return (f, g) => (o(), u("div", _a, [
|
|
2719
|
+
e.title ? (o(), u("h3", eo, E(e.title), 1)) : p("", !0),
|
|
2720
|
+
c("div", to, [
|
|
2721
|
+
(o(!0), u(K, null, _(e.fields, (x) => (o(), u("div", {
|
|
2722
|
+
key: x.label,
|
|
2723
|
+
class: "w-info-card-field"
|
|
2724
|
+
}, [
|
|
2725
|
+
c("span", lo, E(x.label), 1),
|
|
2726
|
+
c("span", ao, E(i(x)), 1)
|
|
2727
|
+
]))), 128))
|
|
2728
|
+
])
|
|
2729
|
+
]));
|
|
2730
|
+
}
|
|
2731
|
+
}), oo = {
|
|
2732
|
+
key: 0,
|
|
2733
|
+
class: "w-kpi-card__loading"
|
|
2734
|
+
}, no = { class: "w-kpi-card__loading-content" }, so = { class: "w-kpi-card__header" }, io = {
|
|
2735
|
+
key: 0,
|
|
2736
|
+
class: "w-kpi-card__icon"
|
|
2737
|
+
}, ro = {
|
|
2738
|
+
key: 1,
|
|
2739
|
+
class: "w-kpi-card__trend"
|
|
2740
|
+
}, uo = { class: "w-kpi-card__content" }, co = { class: "w-kpi-card__label" }, mo = { class: "w-kpi-card__value" }, fo = {
|
|
2741
|
+
key: 0,
|
|
2742
|
+
class: "w-kpi-card__hint"
|
|
2743
|
+
}, vo = {
|
|
2744
|
+
key: 0,
|
|
2745
|
+
class: "w-kpi-card__footer"
|
|
2746
|
+
}, po = /* @__PURE__ */ le({
|
|
2747
|
+
__name: "WKpiCard",
|
|
2748
|
+
props: {
|
|
2749
|
+
label: {},
|
|
2750
|
+
value: {},
|
|
2751
|
+
icon: {},
|
|
2752
|
+
hint: {},
|
|
2753
|
+
severity: {},
|
|
2754
|
+
trend: {},
|
|
2755
|
+
loading: { type: Boolean }
|
|
2756
|
+
},
|
|
2757
|
+
setup(e) {
|
|
2758
|
+
return (a, l) => (o(), u("article", {
|
|
2759
|
+
class: X(["w-kpi-card", e.severity ? `w-kpi-card--${e.severity}` : ""])
|
|
2760
|
+
}, [
|
|
2761
|
+
e.loading ? (o(), u("div", oo, [
|
|
2762
|
+
S(d(Re), {
|
|
2763
|
+
shape: "circle",
|
|
2764
|
+
size: "2.75rem"
|
|
2765
|
+
}),
|
|
2766
|
+
c("div", no, [
|
|
2767
|
+
S(d(Re), {
|
|
2768
|
+
width: "6rem",
|
|
2769
|
+
height: "0.75rem"
|
|
2770
|
+
}),
|
|
2771
|
+
S(d(Re), {
|
|
2772
|
+
width: "7.5rem",
|
|
2773
|
+
height: "1.5rem"
|
|
2774
|
+
}),
|
|
2775
|
+
S(d(Re), {
|
|
2776
|
+
width: "5rem",
|
|
2777
|
+
height: "0.75rem"
|
|
2778
|
+
})
|
|
2779
|
+
])
|
|
2780
|
+
])) : (o(), u(K, { key: 1 }, [
|
|
2781
|
+
c("div", so, [
|
|
2782
|
+
e.icon || a.$slots.icon ? (o(), u("div", io, [
|
|
2783
|
+
A(a.$slots, "icon", {}, () => [
|
|
2784
|
+
e.icon ? (o(), u("i", {
|
|
2785
|
+
key: 0,
|
|
2786
|
+
class: X(e.icon)
|
|
2787
|
+
}, null, 2)) : p("", !0)
|
|
2788
|
+
])
|
|
2789
|
+
])) : p("", !0),
|
|
2790
|
+
e.trend || a.$slots.trend ? (o(), u("div", ro, [
|
|
2791
|
+
A(a.$slots, "trend", {}, () => [
|
|
2792
|
+
e.trend ? (o(), u("span", {
|
|
2793
|
+
key: 0,
|
|
2794
|
+
class: X(["w-kpi-card__trend-badge", e.trend.direction ? `w-kpi-card__trend-badge--${e.trend.direction}` : ""])
|
|
2795
|
+
}, E(e.trend.value), 3)) : p("", !0)
|
|
2796
|
+
])
|
|
2797
|
+
])) : p("", !0)
|
|
2798
|
+
]),
|
|
2799
|
+
c("div", uo, [
|
|
2800
|
+
c("p", co, E(e.label), 1),
|
|
2801
|
+
c("div", mo, [
|
|
2802
|
+
A(a.$slots, "value", {}, () => [
|
|
2803
|
+
be(E(e.value), 1)
|
|
2804
|
+
])
|
|
2805
|
+
]),
|
|
2806
|
+
e.hint || a.$slots.hint ? (o(), u("p", fo, [
|
|
2807
|
+
A(a.$slots, "hint", {}, () => [
|
|
2808
|
+
be(E(e.hint), 1)
|
|
2809
|
+
])
|
|
2810
|
+
])) : p("", !0)
|
|
2811
|
+
]),
|
|
2812
|
+
a.$slots.footer ? (o(), u("footer", vo, [
|
|
2813
|
+
A(a.$slots, "footer")
|
|
2814
|
+
])) : p("", !0)
|
|
2815
|
+
], 64))
|
|
2816
|
+
], 2));
|
|
2817
|
+
}
|
|
2818
|
+
}), fn = /* @__PURE__ */ le({
|
|
2819
|
+
__name: "WKpiGrid",
|
|
2820
|
+
props: {
|
|
2821
|
+
items: { default: () => [] },
|
|
2822
|
+
columns: { default: 4 },
|
|
2823
|
+
dense: { type: Boolean, default: !1 }
|
|
2824
|
+
},
|
|
2825
|
+
setup(e) {
|
|
2826
|
+
const a = e, l = R(() => [
|
|
2827
|
+
a.columns === "auto" ? "w-kpi-grid--auto" : `w-kpi-grid--cols-${a.columns}`,
|
|
2828
|
+
{ "w-kpi-grid--dense": a.dense }
|
|
2829
|
+
]);
|
|
2830
|
+
return (n, i) => (o(), u("div", {
|
|
2831
|
+
class: X(["w-kpi-grid", l.value])
|
|
2832
|
+
}, [
|
|
2833
|
+
n.$slots.item ? (o(!0), u(K, { key: 0 }, _(e.items, (f, g) => A(n.$slots, "item", {
|
|
2834
|
+
key: g,
|
|
2835
|
+
item: f,
|
|
2836
|
+
index: g
|
|
2837
|
+
})), 128)) : (o(!0), u(K, { key: 1 }, _(e.items, (f, g) => (o(), $(po, {
|
|
2838
|
+
key: g,
|
|
2839
|
+
label: f.label,
|
|
2840
|
+
value: f.value,
|
|
2841
|
+
icon: f.icon,
|
|
2842
|
+
severity: f.severity || "primary",
|
|
2843
|
+
hint: f.hint,
|
|
2844
|
+
trend: f.trend,
|
|
2845
|
+
loading: f.loading
|
|
2846
|
+
}, null, 8, ["label", "value", "icon", "severity", "hint", "trend", "loading"]))), 128))
|
|
2847
|
+
], 2));
|
|
2848
|
+
}
|
|
2849
|
+
}), ho = { class: "w-section-header__main" }, go = {
|
|
2850
|
+
key: 0,
|
|
2851
|
+
class: "w-section-header__icon"
|
|
2852
|
+
}, yo = { class: "w-section-header__content" }, bo = { class: "w-section-header__title-row" }, wo = { class: "w-section-header__title" }, ko = {
|
|
2853
|
+
key: 0,
|
|
2854
|
+
class: "w-section-header__subtitle"
|
|
2855
|
+
}, $o = {
|
|
2856
|
+
key: 0,
|
|
2857
|
+
class: "w-section-header__actions"
|
|
2858
|
+
}, vn = /* @__PURE__ */ le({
|
|
2859
|
+
__name: "WSectionHeader",
|
|
2860
|
+
props: {
|
|
2861
|
+
title: {},
|
|
2862
|
+
subtitle: {},
|
|
2863
|
+
icon: {},
|
|
2864
|
+
compact: { type: Boolean }
|
|
2865
|
+
},
|
|
2866
|
+
setup(e) {
|
|
2867
|
+
return (a, l) => (o(), u("div", {
|
|
2868
|
+
class: X(["w-section-header", { "w-section-header--compact": e.compact }])
|
|
2869
|
+
}, [
|
|
2870
|
+
c("div", ho, [
|
|
2871
|
+
e.icon || a.$slots.icon ? (o(), u("div", go, [
|
|
2872
|
+
A(a.$slots, "icon", {}, () => [
|
|
2873
|
+
e.icon ? (o(), u("i", {
|
|
2874
|
+
key: 0,
|
|
2875
|
+
class: X(e.icon)
|
|
2876
|
+
}, null, 2)) : p("", !0)
|
|
2877
|
+
])
|
|
2878
|
+
])) : p("", !0),
|
|
2879
|
+
c("div", yo, [
|
|
2880
|
+
c("div", bo, [
|
|
2881
|
+
c("h3", wo, E(e.title), 1),
|
|
2882
|
+
A(a.$slots, "meta")
|
|
2883
|
+
]),
|
|
2884
|
+
e.subtitle ? (o(), u("p", ko, E(e.subtitle), 1)) : p("", !0)
|
|
2885
|
+
])
|
|
2886
|
+
]),
|
|
2887
|
+
a.$slots.actions ? (o(), u("div", $o, [
|
|
2888
|
+
A(a.$slots, "actions")
|
|
2889
|
+
])) : p("", !0)
|
|
2890
|
+
], 2));
|
|
2891
|
+
}
|
|
2892
|
+
}), xo = {
|
|
2893
|
+
key: 0,
|
|
2894
|
+
class: "w-form-section__header"
|
|
2895
|
+
}, Co = { class: "w-form-section__content" }, Vo = { class: "w-form-section__title" }, So = {
|
|
2896
|
+
key: 0,
|
|
2897
|
+
class: "w-form-section__description"
|
|
2898
|
+
}, Do = {
|
|
2899
|
+
key: 0,
|
|
2900
|
+
class: "w-form-section__actions"
|
|
2901
|
+
}, Eo = { class: "w-form-section__body" }, pn = /* @__PURE__ */ le({
|
|
2902
|
+
__name: "WFormSection",
|
|
2903
|
+
props: {
|
|
2904
|
+
title: {},
|
|
2905
|
+
description: {},
|
|
2906
|
+
variant: {}
|
|
2907
|
+
},
|
|
2908
|
+
setup(e) {
|
|
2909
|
+
return (a, l) => (o(), u("section", {
|
|
2910
|
+
class: X(["w-form-section", e.variant ? `w-form-section--${e.variant}` : ""])
|
|
2911
|
+
}, [
|
|
2912
|
+
e.title || e.description || a.$slots.actions ? (o(), u("div", xo, [
|
|
2913
|
+
c("div", Co, [
|
|
2914
|
+
c("h3", Vo, E(e.title), 1),
|
|
2915
|
+
e.description ? (o(), u("p", So, E(e.description), 1)) : p("", !0)
|
|
2916
|
+
]),
|
|
2917
|
+
a.$slots.actions ? (o(), u("div", Do, [
|
|
2918
|
+
A(a.$slots, "actions")
|
|
2919
|
+
])) : p("", !0)
|
|
2920
|
+
])) : p("", !0),
|
|
2921
|
+
c("div", Eo, [
|
|
2922
|
+
A(a.$slots, "default")
|
|
2923
|
+
])
|
|
2924
|
+
], 2));
|
|
2925
|
+
}
|
|
2926
|
+
}), Po = {
|
|
2927
|
+
key: 0,
|
|
2928
|
+
class: "w-action-bar__primary"
|
|
2929
|
+
}, Ro = {
|
|
2930
|
+
key: 1,
|
|
2931
|
+
class: "w-action-bar__filters"
|
|
2932
|
+
}, Fo = {
|
|
2933
|
+
key: 2,
|
|
2934
|
+
class: "w-action-bar__secondary"
|
|
2935
|
+
}, hn = /* @__PURE__ */ le({
|
|
2936
|
+
__name: "WActionBar",
|
|
2937
|
+
props: {
|
|
2938
|
+
align: { default: "between" },
|
|
2939
|
+
stackOnMobile: { type: Boolean, default: !0 }
|
|
2940
|
+
},
|
|
2941
|
+
setup(e) {
|
|
2942
|
+
return (a, l) => (o(), u("div", {
|
|
2943
|
+
class: X(["w-action-bar", [`w-action-bar--${e.align}`, { "w-action-bar--stack": e.stackOnMobile }]])
|
|
2944
|
+
}, [
|
|
2945
|
+
a.$slots.primary || a.$slots.default ? (o(), u("div", Po, [
|
|
2946
|
+
A(a.$slots, "primary", {}, () => [
|
|
2947
|
+
A(a.$slots, "default")
|
|
2948
|
+
])
|
|
2949
|
+
])) : p("", !0),
|
|
2950
|
+
a.$slots.filters ? (o(), u("div", Ro, [
|
|
2951
|
+
A(a.$slots, "filters")
|
|
2952
|
+
])) : p("", !0),
|
|
2953
|
+
a.$slots.secondary ? (o(), u("div", Fo, [
|
|
2954
|
+
A(a.$slots, "secondary")
|
|
2955
|
+
])) : p("", !0)
|
|
2956
|
+
], 2));
|
|
2957
|
+
}
|
|
2958
|
+
}), Mo = { class: "w-progress-flow__marker" }, Io = { class: "w-progress-flow__content" }, Ao = { class: "w-progress-flow__label" }, Uo = {
|
|
2959
|
+
key: 0,
|
|
2960
|
+
class: "w-progress-flow__description"
|
|
2961
|
+
}, gn = /* @__PURE__ */ le({
|
|
2962
|
+
__name: "WProgressFlow",
|
|
2963
|
+
props: {
|
|
2964
|
+
steps: {},
|
|
2965
|
+
currentStep: {},
|
|
2966
|
+
orientation: { default: "horizontal" }
|
|
2967
|
+
},
|
|
2968
|
+
setup(e) {
|
|
2969
|
+
const a = e, l = R(() => a.steps.findIndex((i) => i.key === a.currentStep));
|
|
2970
|
+
function n(i) {
|
|
2971
|
+
return i < l.value ? "done" : i === l.value ? "current" : "pending";
|
|
2972
|
+
}
|
|
2973
|
+
return (i, f) => (o(), u("div", {
|
|
2974
|
+
class: X(["w-progress-flow", `w-progress-flow--${e.orientation}`])
|
|
2975
|
+
}, [
|
|
2976
|
+
(o(!0), u(K, null, _(e.steps, (g, x) => (o(), u("div", {
|
|
2977
|
+
key: g.key,
|
|
2978
|
+
class: X(["w-progress-flow__step", `w-progress-flow__step--${n(x)}`])
|
|
2979
|
+
}, [
|
|
2980
|
+
A(i.$slots, "step", {
|
|
2981
|
+
step: g,
|
|
2982
|
+
index: x,
|
|
2983
|
+
state: n(x)
|
|
2984
|
+
}, () => [
|
|
2985
|
+
c("div", Mo, [
|
|
2986
|
+
c("span", null, E(x + 1), 1)
|
|
2987
|
+
]),
|
|
2988
|
+
c("div", Io, [
|
|
2989
|
+
c("p", Ao, E(g.label), 1),
|
|
2990
|
+
g.description ? (o(), u("p", Uo, E(g.description), 1)) : p("", !0)
|
|
2991
|
+
])
|
|
2992
|
+
])
|
|
2993
|
+
], 2))), 128))
|
|
2994
|
+
], 2));
|
|
2995
|
+
}
|
|
2996
|
+
});
|
|
2997
|
+
export {
|
|
2998
|
+
hl as W,
|
|
2999
|
+
hn as _,
|
|
3000
|
+
nl as a,
|
|
3001
|
+
We as b,
|
|
3002
|
+
ot as c,
|
|
3003
|
+
rn as d,
|
|
3004
|
+
cn as e,
|
|
3005
|
+
dn as f,
|
|
3006
|
+
Xl as g,
|
|
3007
|
+
pn as h,
|
|
3008
|
+
mn as i,
|
|
3009
|
+
po as j,
|
|
3010
|
+
fn as k,
|
|
3011
|
+
sl as l,
|
|
3012
|
+
un as m,
|
|
3013
|
+
gn as n,
|
|
3014
|
+
vn as o,
|
|
3015
|
+
Ua as p,
|
|
3016
|
+
Rl as q,
|
|
3017
|
+
_l as r,
|
|
3018
|
+
Qt as s,
|
|
3019
|
+
Xt as t,
|
|
3020
|
+
_t as u,
|
|
3021
|
+
Jt as v,
|
|
3022
|
+
Ql as w
|
|
3023
|
+
};
|
|
3024
|
+
//# sourceMappingURL=WProgressFlow.vue_vue_type_script_setup_true_lang-BVlG1in1.js.map
|