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