@wgalleti/primevue-components 0.9.4 → 0.9.6

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