@wgalleti/primevue-components 0.9.3 → 0.9.5

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