@wgalleti/primevue-components 0.6.1 → 0.8.0

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