diefra_ecm_ui 1.2.1 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,36 +1,36 @@
1
- import { jsx as e, jsxs as p, Fragment as ce } from "react/jsx-runtime";
2
- import { useCallback as P, useEffect as j, memo as q, useState as U, useMemo as Y, useRef as X, forwardRef as oe, createElement as M } from "react";
3
- import { useFormContext as J, useController as Q, useFormState as de } from "react-hook-form";
1
+ import { jsx as e, jsxs as y, Fragment as de } from "react/jsx-runtime";
2
+ import { useCallback as U, useEffect as P, memo as q, useState as Y, useMemo as J, useRef as ee, forwardRef as oe, createElement as te } from "react";
3
+ import { useFormContext as W, useController as Z, useFormState as ae } from "react-hook-form";
4
4
  import { IMaskInput as pe } from "react-imask";
5
5
  import { useSection as G, useFluigRuntime as z } from "@fluig-kit/ecm";
6
- import { isValid as ae, eachDayOfInterval as ve, endOfWeek as ye, endOfMonth as be, startOfWeek as ge, startOfMonth as Ne, getYear as ke, subMonths as we, setMonth as _e, setYear as Oe, addMonths as Re, isSameMonth as Se, isSameDay as xe, format as ue, isToday as $e, parse as Ae } from "date-fns";
7
- function Ie({ title: t, isOpen: i, onOpen: a, onClose: u, content: c, footer: d, width: m }) {
8
- const o = P(
9
- (v) => {
10
- v.key === "Escape" && u();
6
+ import { isValid as ue, eachDayOfInterval as ve, endOfWeek as ye, endOfMonth as ge, startOfWeek as be, startOfMonth as Ne, getYear as ke, subMonths as we, setMonth as $e, setYear as Oe, addMonths as _e, isSameMonth as Re, isSameDay as Se, format as fe, isToday as Ae, parse as xe } from "date-fns";
7
+ function Ie({ title: t, isOpen: n, onOpen: f, onClose: o, content: c, footer: a, width: m }) {
8
+ const d = U(
9
+ (p) => {
10
+ p.key === "Escape" && o();
11
11
  },
12
- [u]
12
+ [o]
13
13
  );
14
- return j(() => (i && (document.addEventListener("keydown", o), a == null || a(), document.body.style.overflow = "hidden"), () => {
15
- document.removeEventListener("keydown", o), document.body.style.overflow = "auto";
16
- }), [i, o, a]), i ? /* @__PURE__ */ e("div", { className: "modal-overlay", onClick: u, "aria-modal": "true", role: "dialog", children: /* @__PURE__ */ p("div", { style: { maxWidth: m }, className: "modal-container", onClick: (v) => v.stopPropagation(), children: [
17
- /* @__PURE__ */ p("div", { className: "modal-header", children: [
14
+ return P(() => (n && (document.addEventListener("keydown", d), f == null || f(), document.body.style.overflow = "hidden"), () => {
15
+ document.removeEventListener("keydown", d), document.body.style.overflow = "auto";
16
+ }), [n, d, f]), n ? /* @__PURE__ */ e("div", { className: "modal-overlay", onClick: o, "aria-modal": "true", role: "dialog", children: /* @__PURE__ */ y("div", { style: { maxWidth: m }, className: "modal-container", onClick: (p) => p.stopPropagation(), children: [
17
+ /* @__PURE__ */ y("div", { className: "modal-header", children: [
18
18
  /* @__PURE__ */ e("h3", { children: t }),
19
- /* @__PURE__ */ e("div", { className: "btn-close-modal", onClick: u, role: "button", "aria-label": "Fechar modal", children: /* @__PURE__ */ e("i", { className: "flaticon flaticon-close icon-sm", "aria-hidden": "true" }) })
19
+ /* @__PURE__ */ e("div", { className: "btn-close-modal", onClick: o, role: "button", "aria-label": "Fechar modal", children: /* @__PURE__ */ e("i", { className: "flaticon flaticon-close icon-sm", "aria-hidden": "true" }) })
20
20
  ] }),
21
21
  /* @__PURE__ */ e("div", { className: "modal-content", children: c }),
22
- d && /* @__PURE__ */ e("div", { className: "modal-footer", children: d })
22
+ a && /* @__PURE__ */ e("div", { className: "modal-footer", children: a })
23
23
  ] }) }) : null;
24
24
  }
25
- function Ve({ text: t, title: i = "Ajuda & Informações", width: a = "500px", className: u = "" }) {
26
- const [c, d] = U(!1), m = (o) => {
27
- o.preventDefault(), o.stopPropagation(), d(!0);
25
+ function Ve({ text: t, title: n = "Ajuda & Informações", width: f = "500px", className: o = "" }) {
26
+ const [c, a] = Y(!1), m = (d) => {
27
+ d.preventDefault(), d.stopPropagation(), a(!0);
28
28
  };
29
- return /* @__PURE__ */ p(ce, { children: [
29
+ return /* @__PURE__ */ y(de, { children: [
30
30
  /* @__PURE__ */ e(
31
31
  "div",
32
32
  {
33
- className: `dfe-help-indicator ${u}`,
33
+ className: `dfe-help-indicator ${o}`,
34
34
  onClick: m,
35
35
  role: "button",
36
36
  tabIndex: 0,
@@ -42,17 +42,17 @@ function Ve({ text: t, title: i = "Ajuda & Informações", width: a = "500px", c
42
42
  /* @__PURE__ */ e(
43
43
  Ie,
44
44
  {
45
- title: i,
45
+ title: n,
46
46
  isOpen: c,
47
- onClose: () => d(!1),
48
- width: a,
47
+ onClose: () => a(!1),
48
+ width: f,
49
49
  content: /* @__PURE__ */ e("div", { className: "dfe-help-modal-body", children: t }),
50
- footer: /* @__PURE__ */ e("div", { className: "dfe-help-modal-footer", children: /* @__PURE__ */ e("button", { type: "button", className: "btn btn-info dfe-help-btn", onClick: () => d(!1), children: "Entendido" }) })
50
+ footer: /* @__PURE__ */ e("div", { className: "dfe-help-modal-footer", children: /* @__PURE__ */ e("button", { type: "button", className: "btn btn-info dfe-help-btn", onClick: () => a(!1), children: "Entendido" }) })
51
51
  }
52
52
  )
53
53
  ] });
54
54
  }
55
- const Z = q(Ve), De = {
55
+ const M = q(Ve), De = {
56
56
  cpf: "000.000.000-00",
57
57
  cnpj: "00.000.000/0000-00",
58
58
  telefone: "(00) 00000-0000",
@@ -60,256 +60,294 @@ const Z = q(Ve), De = {
60
60
  };
61
61
  function Ee({
62
62
  name: t,
63
- label: i = "",
64
- placeholder: a = "",
65
- type: u = "text",
63
+ label: n = "",
64
+ placeholder: f = "",
65
+ type: o = "text",
66
66
  mask: c,
67
- className: d = "",
67
+ className: a = "",
68
68
  forceReadOnly: m = !1,
69
- forceHidden: o = !1,
69
+ forceHidden: d = !1,
70
+ prefix: p,
71
+ suffix: s,
70
72
  helpText: v,
71
- helpTitle: l,
72
- helpWidth: y,
73
- valueManual: $,
74
- onChangeManual: R,
75
- errorManual: C
73
+ helpTitle: x,
74
+ helpWidth: I,
75
+ valueManual: F,
76
+ onChangeManual: b,
77
+ errorManual: _
76
78
  }) {
77
- var L, W;
78
- const b = $ !== void 0 && !!R, { isReadOnly: S, isHidden: E } = G(), O = m || !!S(t), g = o || !!E(t), { isView: r } = z();
79
- let n = null;
79
+ var K, Q;
80
+ const R = F !== void 0 && !!b, { isReadOnly: S, isHidden: N } = G(), r = m || !!S(t), i = d || !!N(t), { isView: l } = z();
81
+ let u = null;
80
82
  try {
81
- n = J();
83
+ u = W();
82
84
  } catch {
83
85
  }
84
- const s = !b && n ? Q({ name: t, control: n.control }) : null, f = !b && n ? de({ name: t }) : null, N = b ? $ : s == null ? void 0 : s.field.value, I = b ? C : (W = (L = f == null ? void 0 : f.errors) == null ? void 0 : L[t]) == null ? void 0 : W.message, B = Y(() => c ? De[c] ?? c : null, [c]), V = P((H) => {
85
- if (!H) return "";
86
- const F = H.replace(/\D/g, "");
87
- return (Number(F) / 100).toFixed(2);
88
- }, []), _ = P((H) => {
89
- if (H === "" || H === null || H === void 0) return "";
90
- const F = Number(H);
91
- return isNaN(F) ? "" : F.toLocaleString("pt-BR", {
92
- style: "currency",
93
- currency: "BRL"
94
- });
95
- }, []), w = (H) => {
96
- let F = H;
97
- u === "monetary" && (F = V(H)), b ? R == null || R(F) : s == null || s.field.onChange(F);
98
- }, k = () => {
99
- b || s == null || s.field.onBlur();
100
- }, A = Y(() => u === "monetary" ? _(N) : String(N ?? ""), [N, u, _]);
101
- if (g) return null;
102
- const h = `form-control ${O ? "readOnly" : ""} ${I ? "border-red" : ""} ${d}`, D = () => B ? /* @__PURE__ */ e(
86
+ const h = !R && u ? Z({ name: t, control: u.control }) : null, E = !R && u ? ae({ name: t }) : null, H = R ? F : h == null ? void 0 : h.field.value, V = R ? _ : (Q = (K = E == null ? void 0 : E.errors) == null ? void 0 : K[t]) == null ? void 0 : Q.message, O = J(() => c ? De[c] ?? c : null, [c]), $ = U(
87
+ (C) => {
88
+ if (!C) return "";
89
+ let w = C;
90
+ if (s)
91
+ if (w.endsWith(s))
92
+ w = w.slice(0, -s.length);
93
+ else {
94
+ const L = w.lastIndexOf(s);
95
+ L !== -1 && (w = w.substring(0, L) + w.substring(L + s.length));
96
+ }
97
+ if (p)
98
+ if (w.startsWith(p))
99
+ w = w.slice(p.length);
100
+ else {
101
+ const L = w.indexOf(p);
102
+ L !== -1 && (w = w.substring(0, L) + w.substring(L + p.length));
103
+ }
104
+ if (o === "monetary") {
105
+ const L = w.replace(/\D/g, "");
106
+ return L ? (Number(L) / 100).toFixed(2) : "";
107
+ }
108
+ return o === "number" && (w = w.replace(/[^\d.,-]/g, ""), w = w.replace(/\./g, "").replace(",", ".")), w;
109
+ },
110
+ [p, s, o]
111
+ ), k = U(
112
+ (C) => {
113
+ if (C === "" || C === null || C === void 0) return "";
114
+ let w = String(C);
115
+ if (o === "monetary") {
116
+ const L = Number(C);
117
+ return isNaN(L) ? "" : L.toLocaleString("pt-BR", { style: "currency", currency: "BRL" });
118
+ }
119
+ if (o === "number") {
120
+ w = w.replace(".", ",");
121
+ const L = w.split(",");
122
+ L[0] = L[0].replace(/\B(?=(\d{3})+(?!\d))/g, "."), w = L.join(",");
123
+ }
124
+ return p && (w = `${p}${w}`), s && (w = `${w}${s}`), w;
125
+ },
126
+ [p, s, o]
127
+ ), B = (C) => {
128
+ const w = `${p || ""}${s || ""}`;
129
+ if (!C || C === p || C === s || C === w) {
130
+ R ? b == null || b("") : h == null || h.field.onChange("");
131
+ return;
132
+ }
133
+ const L = $(C);
134
+ R ? b == null || b(L) : h == null || h.field.onChange(L);
135
+ }, g = () => {
136
+ R || h == null || h.field.onBlur();
137
+ }, D = J(() => k(H), [H, k]);
138
+ if (i) return null;
139
+ const j = `form-control ${r ? "readOnly" : ""} ${V ? "border-red" : ""} ${a}`, X = () => O ? /* @__PURE__ */ e(
103
140
  pe,
104
141
  {
105
- mask: B,
106
- value: A,
142
+ mask: O,
143
+ value: D,
107
144
  unmask: !0,
108
- onAccept: (H) => w(H),
109
- placeholder: a,
110
- readOnly: O,
111
- className: h,
112
- inputRef: b || s == null ? void 0 : s.field.ref,
113
- onBlur: k
145
+ onAccept: (C) => B(C),
146
+ placeholder: f,
147
+ readOnly: r,
148
+ className: j,
149
+ inputRef: R || h == null ? void 0 : h.field.ref,
150
+ onBlur: g
114
151
  }
115
152
  ) : /* @__PURE__ */ e(
116
153
  "input",
117
154
  {
118
- type: u === "number" ? "number" : "text",
119
- value: A,
120
- onChange: (H) => w(H.target.value),
121
- onBlur: k,
122
- placeholder: a,
123
- readOnly: O,
124
- className: h
155
+ type: "text",
156
+ inputMode: o === "number" || o === "monetary" ? "numeric" : void 0,
157
+ value: D,
158
+ onChange: (C) => B(C.target.value),
159
+ onBlur: g,
160
+ placeholder: f,
161
+ readOnly: r,
162
+ className: j
125
163
  }
126
164
  );
127
- return r ? /* @__PURE__ */ p("div", { className: "form-group", children: [
128
- i && /* @__PURE__ */ e("label", { children: i }),
129
- /* @__PURE__ */ p("div", { className: v ? "dfe-flex-input-wrapper" : "", children: [
130
- /* @__PURE__ */ e("span", { className: h, children: A || "-" }),
131
- v && /* @__PURE__ */ e(Z, { text: v, title: l, width: y })
165
+ return l ? /* @__PURE__ */ y("div", { className: "form-group", children: [
166
+ n && /* @__PURE__ */ e("label", { children: n }),
167
+ /* @__PURE__ */ y("div", { className: v ? "dfe-flex-input-wrapper" : "", children: [
168
+ /* @__PURE__ */ e("span", { className: j, children: D || "-" }),
169
+ v && /* @__PURE__ */ e(M, { text: v, title: x, width: I })
132
170
  ] })
133
- ] }) : /* @__PURE__ */ p("div", { className: `form-group ${g ? "hidden" : ""}`, children: [
134
- i && /* @__PURE__ */ e("label", { children: i }),
135
- /* @__PURE__ */ p("div", { className: v ? "dfe-flex-input-wrapper" : "", children: [
136
- D(),
137
- v && /* @__PURE__ */ e(Z, { text: v, title: l, width: y })
171
+ ] }) : /* @__PURE__ */ y("div", { className: `form-group ${i ? "hidden" : ""}`, children: [
172
+ n && /* @__PURE__ */ e("label", { children: n }),
173
+ /* @__PURE__ */ y("div", { className: v ? "dfe-flex-input-wrapper" : "", children: [
174
+ X(),
175
+ v && /* @__PURE__ */ e(M, { text: v, title: x, width: I })
138
176
  ] }),
139
- !b && /* @__PURE__ */ e("input", { type: "hidden", name: t, value: N || "" }),
140
- I && /* @__PURE__ */ e("p", { className: "text-danger", children: String(I) })
177
+ !R && /* @__PURE__ */ e("input", { type: "hidden", name: t, value: H || "" }),
178
+ V && /* @__PURE__ */ e("p", { className: "text-danger", children: String(V) })
141
179
  ] });
142
180
  }
143
- const dt = q(Ee);
181
+ const ot = q(Ee);
144
182
  function Be({
145
183
  name: t,
146
- label: i = "",
147
- options: a = [],
148
- placeholder: u = "",
184
+ label: n = "",
185
+ options: f = [],
186
+ placeholder: o = "",
149
187
  labelKey: c = "label",
150
- valueKey: d = "value",
188
+ valueKey: a = "value",
151
189
  enableSearch: m = !1,
152
- searchPlaceholder: o = "Buscar...",
153
- loading: v = !1,
154
- onSearchChange: l,
155
- debounceTime: y = 300,
156
- onSelect: $,
157
- forceReadOnly: R = !1,
158
- forceHidden: C = !1,
190
+ searchPlaceholder: d = "Buscar...",
191
+ loading: p = !1,
192
+ onSearchChange: s,
193
+ debounceTime: v = 300,
194
+ onSelect: x,
195
+ forceReadOnly: I = !1,
196
+ forceHidden: F = !1,
159
197
  helpText: b,
160
- helpTitle: S,
161
- helpWidth: E,
162
- valueManual: O,
163
- onChangeManual: g,
198
+ helpTitle: _,
199
+ helpWidth: R,
200
+ valueManual: S,
201
+ onChangeManual: N,
164
202
  errorManual: r
165
203
  }) {
166
- var se;
167
- const n = O !== void 0 && !!g, { isReadOnly: s, isHidden: f } = G(), N = R || !!s(t), I = C || !!f(t), { isView: B } = z();
168
- let V = "", _ = () => {
169
- }, w, k = null, A = () => {
204
+ var re;
205
+ const i = S !== void 0 && !!N, { isReadOnly: l, isHidden: u } = G(), h = I || !!l(t), E = F || !!u(t), { isView: H } = z();
206
+ let V = "", O = () => {
207
+ }, $, k = null, B = () => {
170
208
  };
171
- if (n)
172
- V = O;
209
+ if (i)
210
+ V = S;
173
211
  else
174
212
  try {
175
- const x = J(), T = Q({ name: t, control: x.control });
176
- V = T.field.value, _ = T.field.onChange, w = T.field.ref, k = (se = T.fieldState) == null ? void 0 : se.error, A = x.clearErrors;
213
+ const A = W(), T = Z({ name: t, control: A.control });
214
+ V = T.field.value, O = T.field.onChange, $ = T.field.ref, k = (re = T.fieldState) == null ? void 0 : re.error, B = A.clearErrors;
177
215
  } catch {
178
216
  }
179
- const [h, D] = U(!1), [L, W] = U(""), H = X(null), F = X(l);
180
- j(() => {
181
- F.current = l;
182
- }, [l]), j(() => {
183
- const x = (T) => {
184
- H.current && !H.current.contains(T.target) && D(!1);
217
+ const [g, D] = Y(!1), [j, X] = Y(""), K = ee(null), Q = ee(s);
218
+ P(() => {
219
+ Q.current = s;
220
+ }, [s]), P(() => {
221
+ const A = (T) => {
222
+ K.current && !K.current.contains(T.target) && D(!1);
185
223
  };
186
- return document.addEventListener("mousedown", x), () => document.removeEventListener("mousedown", x);
187
- }, []), j(() => {
188
- h || W("");
189
- }, [h]), j(() => {
224
+ return document.addEventListener("mousedown", A), () => document.removeEventListener("mousedown", A);
225
+ }, []), P(() => {
226
+ g || X("");
227
+ }, [g]), P(() => {
190
228
  if (!m) return;
191
- const x = setTimeout(() => {
229
+ const A = setTimeout(() => {
192
230
  var T;
193
- (T = F.current) == null || T.call(F, L);
194
- }, y);
195
- return () => clearTimeout(x);
196
- }, [L, m, y]);
197
- const K = Y(() => m && !l && L.trim() ? a.filter(
198
- (x) => String((x == null ? void 0 : x[c]) ?? "").toLowerCase().includes(L.toLowerCase())
199
- ) : a ?? [], [a, m, l, L, c]), te = Y(() => {
231
+ (T = Q.current) == null || T.call(Q, j);
232
+ }, v);
233
+ return () => clearTimeout(A);
234
+ }, [j, m, v]);
235
+ const C = J(() => m && !s && j.trim() ? f.filter(
236
+ (A) => String((A == null ? void 0 : A[c]) ?? "").toLowerCase().includes(j.toLowerCase())
237
+ ) : f ?? [], [f, m, s, j, c]), w = J(() => {
200
238
  if (V == null) return "";
201
239
  if (typeof V == "object")
202
- return String(V[d] ?? "");
203
- const x = (a || []).find((T) => String(T == null ? void 0 : T[d]) === String(V));
204
- return String(x ? (x == null ? void 0 : x[c]) ?? "" : V);
205
- }, [V, a, d, c]), he = (x) => {
206
- N || (n ? g == null || g(x[d]) : (_(x[d]), A == null || A(t)), $ == null || $(x), D(!1));
240
+ return String(V[a] ?? "");
241
+ const A = (f || []).find((T) => String(T == null ? void 0 : T[a]) === String(V));
242
+ return String(A ? (A == null ? void 0 : A[c]) ?? "" : V);
243
+ }, [V, f, a, c]), L = (A) => {
244
+ h || (i ? N == null || N(A[a]) : (O(A[a]), B == null || B(t)), x == null || x(A), D(!1));
207
245
  };
208
- return I ? null : /* @__PURE__ */ p("div", { className: `select-wrapper form-group ${I ? "hidden" : ""}`, ref: H, children: [
209
- /* @__PURE__ */ e("label", { className: "control-label", children: i }),
210
- B ? /* @__PURE__ */ p("div", { className: b ? "dfe-flex-input-wrapper" : "", children: [
211
- /* @__PURE__ */ e("span", { className: "form-control", style: b ? { flex: 1 } : void 0, children: te || "-" }),
212
- b && /* @__PURE__ */ e(Z, { text: b, title: S, width: E })
213
- ] }) : /* @__PURE__ */ p(ce, { children: [
214
- /* @__PURE__ */ p("div", { className: b ? "dfe-flex-input-wrapper" : "", children: [
215
- /* @__PURE__ */ p(
246
+ return E ? null : /* @__PURE__ */ y("div", { className: `select-wrapper form-group ${E ? "hidden" : ""}`, ref: K, children: [
247
+ /* @__PURE__ */ e("label", { className: "control-label", children: n }),
248
+ H ? /* @__PURE__ */ y("div", { className: b ? "dfe-flex-input-wrapper" : "", children: [
249
+ /* @__PURE__ */ e("span", { className: "form-control", style: b ? { flex: 1 } : void 0, children: w || "-" }),
250
+ b && /* @__PURE__ */ e(M, { text: b, title: _, width: R })
251
+ ] }) : /* @__PURE__ */ y(de, { children: [
252
+ /* @__PURE__ */ y("div", { className: b ? "dfe-flex-input-wrapper" : "", children: [
253
+ /* @__PURE__ */ y(
216
254
  "div",
217
255
  {
218
- className: `select-control ${k ? "border-red" : ""} ${N ? "readOnly" : ""}`,
219
- onClick: () => !N && D((x) => !x),
220
- ref: w,
256
+ className: `select-control ${k ? "border-red" : ""} ${h ? "readOnly" : ""}`,
257
+ onClick: () => !h && D((A) => !A),
258
+ ref: $,
221
259
  style: b ? { flex: 1 } : void 0,
222
260
  children: [
223
- /* @__PURE__ */ e("span", { className: `select-display ${N ? "readOnly" : ""}`, children: te || u }),
261
+ /* @__PURE__ */ e("span", { className: `select-display ${h ? "readOnly" : ""}`, children: w || o }),
224
262
  /* @__PURE__ */ e("i", { className: "flaticon flaticon-chevron-down select-icon" })
225
263
  ]
226
264
  }
227
265
  ),
228
- b && /* @__PURE__ */ e(Z, { text: b, title: S, width: E })
266
+ b && /* @__PURE__ */ e(M, { text: b, title: _, width: R })
229
267
  ] }),
230
- h && !N && /* @__PURE__ */ p("div", { className: "select-dropdown", children: [
268
+ g && !h && /* @__PURE__ */ y("div", { className: "select-dropdown", children: [
231
269
  m && /* @__PURE__ */ e("div", { className: "select-search", children: /* @__PURE__ */ e(
232
270
  "input",
233
271
  {
234
272
  type: "text",
235
273
  className: "select-search-input",
236
- value: L,
237
- onChange: (x) => W(x.target.value),
238
- placeholder: v ? "Carregando..." : o,
274
+ value: j,
275
+ onChange: (A) => X(A.target.value),
276
+ placeholder: p ? "Carregando..." : d,
239
277
  autoFocus: !0,
240
- onClick: (x) => x.stopPropagation()
278
+ onClick: (A) => A.stopPropagation()
241
279
  }
242
280
  ) }),
243
- /* @__PURE__ */ e("ul", { className: "select-options", children: v ? /* @__PURE__ */ e("li", { className: "select-option readOnly", children: "Carregando..." }) : K.length > 0 ? K.map((x) => /* @__PURE__ */ e("li", { onClick: () => he(x), className: "select-option handleHover", children: x[c] }, x[d])) : /* @__PURE__ */ e("li", { className: "select-option readOnly", children: "Sem resultados" }) })
281
+ /* @__PURE__ */ e("ul", { className: "select-options", children: p ? /* @__PURE__ */ e("li", { className: "select-option readOnly", children: "Carregando..." }) : C.length > 0 ? C.map((A) => /* @__PURE__ */ e("li", { onClick: () => L(A), className: "select-option handleHover", children: A[c] }, A[a])) : /* @__PURE__ */ e("li", { className: "select-option readOnly", children: "Sem resultados" }) })
244
282
  ] })
245
283
  ] }),
246
- !n && /* @__PURE__ */ e("input", { type: "hidden", name: t, value: V || "" }),
284
+ !i && /* @__PURE__ */ e("input", { type: "hidden", name: t, value: V || "" }),
247
285
  (k || r) && /* @__PURE__ */ e("p", { className: "text-danger", children: String((k == null ? void 0 : k.message) ?? r) })
248
286
  ] });
249
287
  }
250
- const re = q(Be);
288
+ const ne = q(Be);
251
289
  function at({
252
290
  name: t,
253
- options: i = [],
254
- label: a = "",
255
- valueKey: u = "value",
291
+ options: n = [],
292
+ label: f = "",
293
+ valueKey: o = "value",
256
294
  labelKey: c = "label",
257
- forceReadOnly: d = !1,
295
+ forceReadOnly: a = !1,
258
296
  forceHidden: m = !1,
259
- valueManual: o,
260
- onChangeManual: v
297
+ valueManual: d,
298
+ onChangeManual: p
261
299
  }) {
262
- var B, V;
263
- let l = null;
300
+ var H, V;
301
+ let s = null;
264
302
  try {
265
- l = J();
303
+ s = W();
266
304
  } catch {
267
305
  }
268
- const y = o !== void 0 && !!v, { isView: $, isReadOnly: R } = z(), { isReadOnly: C, isHidden: b } = G(), S = C ? C(t) : !1, E = b ? b(t) : !1, O = d || S, g = m || E, r = O || R || $, n = () => i ? i.reduce(
269
- (_, w) => {
270
- const k = String(w[u]);
271
- if (y)
272
- _[k] = !!(o != null && o[k]);
273
- else if (l) {
274
- const A = l.getValues(k);
275
- _[k] = A === "on";
306
+ const v = d !== void 0 && !!p, { isView: x, isReadOnly: I } = z(), { isReadOnly: F, isHidden: b } = G(), _ = F ? F(t) : !1, R = b ? b(t) : !1, S = a || _, N = m || R, r = S || I || x, i = () => n ? n.reduce(
307
+ (O, $) => {
308
+ const k = String($[o]);
309
+ if (v)
310
+ O[k] = !!(d != null && d[k]);
311
+ else if (s) {
312
+ const B = s.getValues(k);
313
+ O[k] = B === "on";
276
314
  } else
277
- _[k] = !1;
278
- return _;
315
+ O[k] = !1;
316
+ return O;
279
317
  },
280
318
  {}
281
- ) : {}, s = !y && l ? l.watch(t) : void 0, f = Y(() => y && o ? o : s && typeof s == "object" ? s : n(), [s, o, i]);
282
- j(() => {
283
- if (y || !l) return;
284
- const _ = l.getValues(t);
285
- (!_ || typeof _ != "object") && l.setValue(t, f, {
319
+ ) : {}, l = !v && s ? s.watch(t) : void 0, u = J(() => v && d ? d : l && typeof l == "object" ? l : i(), [l, d, n]);
320
+ P(() => {
321
+ if (v || !s) return;
322
+ const O = s.getValues(t);
323
+ (!O || typeof O != "object") && s.setValue(t, u, {
286
324
  shouldDirty: !1,
287
325
  shouldValidate: !1
288
326
  });
289
- }, [f, t, l, y]);
290
- const N = (_, w) => {
327
+ }, [u, t, s, v]);
328
+ const h = (O, $) => {
291
329
  if (r) return;
292
- const k = { ...f, [_]: w };
293
- if (y) {
294
- v && v(k);
330
+ const k = { ...u, [O]: $ };
331
+ if (v) {
332
+ p && p(k);
295
333
  return;
296
334
  }
297
- l && (l.setValue(t, k, {
335
+ s && (s.setValue(t, k, {
298
336
  shouldDirty: !0,
299
337
  shouldValidate: !0
300
- }), l.setValue(_, w ? "on" : "", { shouldValidate: !1 }));
301
- }, I = y ? null : (V = (B = l == null ? void 0 : l.formState) == null ? void 0 : B.errors) == null ? void 0 : V[t];
302
- return /* @__PURE__ */ p("div", { className: `form-group ${g ? "hidden" : ""}`, children: [
303
- a && /* @__PURE__ */ e("label", { children: a }),
338
+ }), s.setValue(O, $ ? "on" : "", { shouldValidate: !1 }));
339
+ }, E = v ? null : (V = (H = s == null ? void 0 : s.formState) == null ? void 0 : H.errors) == null ? void 0 : V[t];
340
+ return /* @__PURE__ */ y("div", { className: `form-group ${N ? "hidden" : ""}`, children: [
341
+ f && /* @__PURE__ */ e("label", { children: f }),
304
342
  /* @__PURE__ */ e(
305
343
  "div",
306
344
  {
307
345
  className: `checkbox-group-custom ${r ? "readOnly" : ""}`,
308
- children: i.map((_) => {
309
- const w = String(_[u]), k = f[w] === !0;
310
- return /* @__PURE__ */ p("div", { children: [
311
- !y && l && /* @__PURE__ */ e("input", { type: "hidden", ...l.register(w) }),
312
- /* @__PURE__ */ p(
346
+ children: n.map((O) => {
347
+ const $ = String(O[o]), k = u[$] === !0;
348
+ return /* @__PURE__ */ y("div", { children: [
349
+ !v && s && /* @__PURE__ */ e("input", { type: "hidden", ...s.register($) }),
350
+ /* @__PURE__ */ y(
313
351
  "label",
314
352
  {
315
353
  className: `custom-checkbox ${k ? "checked" : ""} ${r ? "readOnly" : ""}`,
@@ -320,149 +358,149 @@ function at({
320
358
  type: "checkbox",
321
359
  checked: k,
322
360
  disabled: r,
323
- onChange: (A) => N(w, A.target.checked)
361
+ onChange: (B) => h($, B.target.checked)
324
362
  }
325
363
  ),
326
364
  /* @__PURE__ */ e("span", { className: "checkmark" }),
327
- /* @__PURE__ */ e("span", { children: _[c] })
365
+ /* @__PURE__ */ e("span", { children: O[c] })
328
366
  ]
329
367
  }
330
368
  )
331
- ] }, w);
369
+ ] }, $);
332
370
  })
333
371
  }
334
372
  ),
335
- I && /* @__PURE__ */ e("p", { className: "text-danger", children: String(I.message) })
373
+ E && /* @__PURE__ */ e("p", { className: "text-danger", children: String(E.message) })
336
374
  ] });
337
375
  }
338
- function Ce({
376
+ function He({
339
377
  name: t,
340
- label: i = "",
341
- options: a = [],
342
- valueKey: u = "value",
378
+ label: n = "",
379
+ options: f = [],
380
+ valueKey: o = "value",
343
381
  labelKey: c = "label",
344
- iconKey: d = "icon",
382
+ iconKey: a = "icon",
345
383
  forceReadOnly: m = !1,
346
- forceHidden: o = !1,
347
- valueManual: v,
348
- onChangeManual: l,
349
- errorManual: y
384
+ forceHidden: d = !1,
385
+ valueManual: p,
386
+ onChangeManual: s,
387
+ errorManual: v
350
388
  }) {
351
- var B, V;
352
- const $ = v !== void 0 && !!l, { isReadOnly: R, isHidden: C } = G(), b = m || !!R(t), S = o || !!C(t), { isView: E, isReadOnly: O } = z();
353
- let g = null;
389
+ var H, V;
390
+ const x = p !== void 0 && !!s, { isReadOnly: I, isHidden: F } = G(), b = m || !!I(t), _ = d || !!F(t), { isView: R, isReadOnly: S } = z();
391
+ let N = null;
354
392
  try {
355
- g = J();
393
+ N = W();
356
394
  } catch {
357
395
  }
358
- const r = !$ && g ? Q({ name: t, control: g.control, defaultValue: "" }) : null, n = !$ && g ? de({ name: t }) : null, s = $ ? y : (V = (B = n == null ? void 0 : n.errors) == null ? void 0 : B[t]) == null ? void 0 : V.message, f = b || O || E, N = $ ? v : (r == null ? void 0 : r.field.value) ?? "", I = P(
359
- (_) => {
360
- f || ($ ? l == null || l(_) : (r == null || r.field.onChange(_), r == null || r.field.onBlur()));
396
+ const r = !x && N ? Z({ name: t, control: N.control, defaultValue: "" }) : null, i = !x && N ? ae({ name: t }) : null, l = x ? v : (V = (H = i == null ? void 0 : i.errors) == null ? void 0 : H[t]) == null ? void 0 : V.message, u = b || S || R, h = x ? p : (r == null ? void 0 : r.field.value) ?? "", E = U(
397
+ (O) => {
398
+ u || (x ? s == null || s(O) : (r == null || r.field.onChange(O), r == null || r.field.onBlur()));
361
399
  },
362
- [f, $, l, r]
400
+ [u, x, s, r]
363
401
  );
364
- return /* @__PURE__ */ p("div", { className: `form-group column ${S ? "hidden" : ""}`, children: [
365
- i && /* @__PURE__ */ e("label", { className: "control-label", children: i }),
366
- /* @__PURE__ */ e("div", { className: `btn-group ${f ? "view-mode" : ""}`, "data-field-name": t, children: a.map((_) => {
367
- const w = _[u], k = N === w, A = _.color ? { "--customColor": _.color } : void 0;
402
+ return /* @__PURE__ */ y("div", { className: `form-group column ${_ ? "hidden" : ""}`, children: [
403
+ n && /* @__PURE__ */ e("label", { className: "control-label", children: n }),
404
+ /* @__PURE__ */ e("div", { className: `btn-group ${u ? "view-mode" : ""}`, "data-field-name": t, children: f.map((O) => {
405
+ const $ = O[o], k = h === $, B = O.color ? { "--customColor": O.color } : void 0;
368
406
  return (
369
407
  // Trocado de <label> para <div> para evitar comportamentos nativos de clique do HTML
370
- /* @__PURE__ */ p(
408
+ /* @__PURE__ */ y(
371
409
  "div",
372
410
  {
373
- style: A,
411
+ style: B,
374
412
  className: `btn fs-ellipsis ${k ? "active" : ""}`,
375
- onClick: () => I(w),
413
+ onClick: () => E($),
376
414
  children: [
377
- _[d] && /* @__PURE__ */ e("i", { className: `${_[d]} icon-sm` }),
415
+ O[a] && /* @__PURE__ */ e("i", { className: `${O[a]} icon-sm` }),
378
416
  " ",
379
- _[c]
417
+ O[c]
380
418
  ]
381
419
  },
382
- w
420
+ $
383
421
  )
384
422
  );
385
423
  }) }),
386
- !$ && /* @__PURE__ */ e("input", { type: "hidden", name: t, value: N || "", ref: r == null ? void 0 : r.field.ref }),
387
- (s || y) && /* @__PURE__ */ e("p", { className: "text-danger", children: String(s ?? y) })
424
+ !x && /* @__PURE__ */ e("input", { type: "hidden", name: t, value: h || "", ref: r == null ? void 0 : r.field.ref }),
425
+ (l || v) && /* @__PURE__ */ e("p", { className: "text-danger", children: String(l ?? v) })
388
426
  ] });
389
427
  }
390
- const ut = q(Ce), He = ({
428
+ const ut = q(He), Le = ({
391
429
  name: t,
392
- label: i = "",
393
- placeholder: a = "",
394
- className: u = "",
430
+ label: n = "",
431
+ placeholder: f = "",
432
+ className: o = "",
395
433
  rows: c = 4,
396
- maxLength: d,
434
+ maxLength: a,
397
435
  forceReadOnly: m = !1,
398
- forceHidden: o = !1,
399
- valueManual: v,
400
- onChangeManual: l,
401
- errorManual: y
436
+ forceHidden: d = !1,
437
+ valueManual: p,
438
+ onChangeManual: s,
439
+ errorManual: v
402
440
  }) => {
403
- var f;
404
- const $ = v !== void 0 && !!l, { isReadOnly: R, isHidden: C } = G(), b = m || !!R(t), S = o || !!C(t), { isView: E } = z(), O = X(null);
405
- let g = {
406
- value: v ?? "",
407
- onChange: (N) => l == null ? void 0 : l(N)
441
+ var u;
442
+ const x = p !== void 0 && !!s, { isReadOnly: I, isHidden: F } = G(), b = m || !!I(t), _ = d || !!F(t), { isView: R } = z(), S = ee(null);
443
+ let N = {
444
+ value: p ?? "",
445
+ onChange: (h) => s == null ? void 0 : s(h)
408
446
  }, r = null;
409
- if (!$)
447
+ if (!x)
410
448
  try {
411
- const { control: N } = J(), I = Q({ name: t, control: N });
412
- g = I.field, r = (f = I.fieldState) == null ? void 0 : f.error;
449
+ const { control: h } = W(), E = Z({ name: t, control: h });
450
+ N = E.field, r = (u = E.fieldState) == null ? void 0 : u.error;
413
451
  } catch {
414
452
  }
415
- const n = () => {
416
- O.current && (O.current.style.height = "auto", O.current.style.height = `${O.current.scrollHeight}px`);
453
+ const i = () => {
454
+ S.current && (S.current.style.height = "auto", S.current.style.height = `${S.current.scrollHeight}px`);
417
455
  };
418
- if (j(() => {
419
- n();
420
- }, [g.value]), E)
421
- return /* @__PURE__ */ p("div", { className: `form-group ${S ? "hidden" : ""}`, children: [
422
- /* @__PURE__ */ e("label", { children: i }),
423
- /* @__PURE__ */ e("span", { className: "form-control", children: g.value || "-" })
456
+ if (P(() => {
457
+ i();
458
+ }, [N.value]), R)
459
+ return /* @__PURE__ */ y("div", { className: `form-group ${_ ? "hidden" : ""}`, children: [
460
+ /* @__PURE__ */ e("label", { children: n }),
461
+ /* @__PURE__ */ e("span", { className: "form-control", children: N.value || "-" })
424
462
  ] });
425
- const s = `form-control ${b ? "readOnly" : ""} ${r || y ? "border-red" : ""} ${u}`;
426
- return /* @__PURE__ */ p("div", { className: `form-group ${S ? "hidden" : ""}`, children: [
427
- i && /* @__PURE__ */ e("label", { children: i }),
463
+ const l = `form-control ${b ? "readOnly" : ""} ${r || v ? "border-red" : ""} ${o}`;
464
+ return /* @__PURE__ */ y("div", { className: `form-group ${_ ? "hidden" : ""}`, children: [
465
+ n && /* @__PURE__ */ e("label", { children: n }),
428
466
  /* @__PURE__ */ e(
429
467
  "textarea",
430
468
  {
431
- ref: O,
469
+ ref: S,
432
470
  rows: c,
433
- maxLength: d,
434
- value: g.value || "",
435
- placeholder: a,
471
+ maxLength: a,
472
+ value: N.value || "",
473
+ placeholder: f,
436
474
  readOnly: b,
437
- className: s,
475
+ className: l,
438
476
  style: {
439
477
  resize: "none",
440
478
  maxHeight: "400px",
441
479
  overflowY: "auto"
442
480
  },
443
- onChange: (N) => {
444
- $ ? l == null || l(N.target.value) : g.onChange(N);
481
+ onChange: (h) => {
482
+ x ? s == null || s(h.target.value) : N.onChange(h);
445
483
  },
446
- onInput: n
484
+ onInput: i
447
485
  }
448
486
  ),
449
- (r || y) && /* @__PURE__ */ e("p", { className: "text-danger", children: String((r == null ? void 0 : r.message) ?? y) })
487
+ (r || v) && /* @__PURE__ */ e("p", { className: "text-danger", children: String((r == null ? void 0 : r.message) ?? v) })
450
488
  ] });
451
- }, ft = q(He);
489
+ }, ft = q(Le);
452
490
  /**
453
491
  * @license lucide-react v0.575.0 - ISC
454
492
  *
455
493
  * This source code is licensed under the ISC license.
456
494
  * See the LICENSE file in the root directory of this source tree.
457
495
  */
458
- const fe = (...t) => t.filter((i, a, u) => !!i && i.trim() !== "" && u.indexOf(i) === a).join(" ").trim();
496
+ const me = (...t) => t.filter((n, f, o) => !!n && n.trim() !== "" && o.indexOf(n) === f).join(" ").trim();
459
497
  /**
460
498
  * @license lucide-react v0.575.0 - ISC
461
499
  *
462
500
  * This source code is licensed under the ISC license.
463
501
  * See the LICENSE file in the root directory of this source tree.
464
502
  */
465
- const Le = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
503
+ const Ce = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
466
504
  /**
467
505
  * @license lucide-react v0.575.0 - ISC
468
506
  *
@@ -471,7 +509,7 @@ const Le = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
471
509
  */
472
510
  const Fe = (t) => t.replace(
473
511
  /^([A-Z])|[\s-_]+(\w)/g,
474
- (i, a, u) => u ? u.toUpperCase() : a.toLowerCase()
512
+ (n, f, o) => o ? o.toUpperCase() : f.toLowerCase()
475
513
  );
476
514
  /**
477
515
  * @license lucide-react v0.575.0 - ISC
@@ -479,9 +517,9 @@ const Fe = (t) => t.replace(
479
517
  * This source code is licensed under the ISC license.
480
518
  * See the LICENSE file in the root directory of this source tree.
481
519
  */
482
- const ne = (t) => {
483
- const i = Fe(t);
484
- return i.charAt(0).toUpperCase() + i.slice(1);
520
+ const ie = (t) => {
521
+ const n = Fe(t);
522
+ return n.charAt(0).toUpperCase() + n.slice(1);
485
523
  };
486
524
  /**
487
525
  * @license lucide-react v0.575.0 - ISC
@@ -489,7 +527,7 @@ const ne = (t) => {
489
527
  * This source code is licensed under the ISC license.
490
528
  * See the LICENSE file in the root directory of this source tree.
491
529
  */
492
- var Te = {
530
+ var je = {
493
531
  xmlns: "http://www.w3.org/2000/svg",
494
532
  width: 24,
495
533
  height: 24,
@@ -506,9 +544,9 @@ var Te = {
506
544
  * This source code is licensed under the ISC license.
507
545
  * See the LICENSE file in the root directory of this source tree.
508
546
  */
509
- const je = (t) => {
510
- for (const i in t)
511
- if (i.startsWith("aria-") || i === "role" || i === "title")
547
+ const Te = (t) => {
548
+ for (const n in t)
549
+ if (n.startsWith("aria-") || n === "role" || n === "title")
512
550
  return !0;
513
551
  return !1;
514
552
  };
@@ -521,29 +559,29 @@ const je = (t) => {
521
559
  const Pe = oe(
522
560
  ({
523
561
  color: t = "currentColor",
524
- size: i = 24,
525
- strokeWidth: a = 2,
526
- absoluteStrokeWidth: u,
562
+ size: n = 24,
563
+ strokeWidth: f = 2,
564
+ absoluteStrokeWidth: o,
527
565
  className: c = "",
528
- children: d,
566
+ children: a,
529
567
  iconNode: m,
530
- ...o
531
- }, v) => M(
568
+ ...d
569
+ }, p) => te(
532
570
  "svg",
533
571
  {
534
- ref: v,
535
- ...Te,
536
- width: i,
537
- height: i,
572
+ ref: p,
573
+ ...je,
574
+ width: n,
575
+ height: n,
538
576
  stroke: t,
539
- strokeWidth: u ? Number(a) * 24 / Number(i) : a,
540
- className: fe("lucide", c),
541
- ...!d && !je(o) && { "aria-hidden": "true" },
542
- ...o
577
+ strokeWidth: o ? Number(f) * 24 / Number(n) : f,
578
+ className: me("lucide", c),
579
+ ...!a && !Te(d) && { "aria-hidden": "true" },
580
+ ...d
543
581
  },
544
582
  [
545
- ...m.map(([l, y]) => M(l, y)),
546
- ...Array.isArray(d) ? d : [d]
583
+ ...m.map(([s, v]) => te(s, v)),
584
+ ...Array.isArray(a) ? a : [a]
547
585
  ]
548
586
  )
549
587
  );
@@ -553,20 +591,20 @@ const Pe = oe(
553
591
  * This source code is licensed under the ISC license.
554
592
  * See the LICENSE file in the root directory of this source tree.
555
593
  */
556
- const ee = (t, i) => {
557
- const a = oe(
558
- ({ className: u, ...c }, d) => M(Pe, {
559
- ref: d,
560
- iconNode: i,
561
- className: fe(
562
- `lucide-${Le(ne(t))}`,
594
+ const se = (t, n) => {
595
+ const f = oe(
596
+ ({ className: o, ...c }, a) => te(Pe, {
597
+ ref: a,
598
+ iconNode: n,
599
+ className: me(
600
+ `lucide-${Ce(ie(t))}`,
563
601
  `lucide-${t}`,
564
- u
602
+ o
565
603
  ),
566
604
  ...c
567
605
  })
568
606
  );
569
- return a.displayName = ne(t), a;
607
+ return f.displayName = ie(t), f;
570
608
  };
571
609
  /**
572
610
  * @license lucide-react v0.575.0 - ISC
@@ -579,25 +617,25 @@ const Ue = [
579
617
  ["path", { d: "M16 2v4", key: "4m81vk" }],
580
618
  ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
581
619
  ["path", { d: "M3 10h18", key: "8toen8" }]
582
- ], Ye = ee("calendar", Ue);
620
+ ], Ye = se("calendar", Ue);
583
621
  /**
584
622
  * @license lucide-react v0.575.0 - ISC
585
623
  *
586
624
  * This source code is licensed under the ISC license.
587
625
  * See the LICENSE file in the root directory of this source tree.
588
626
  */
589
- const Je = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]], ze = ee("chevron-left", Je);
627
+ const Je = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]], We = se("chevron-left", Je);
590
628
  /**
591
629
  * @license lucide-react v0.575.0 - ISC
592
630
  *
593
631
  * This source code is licensed under the ISC license.
594
632
  * See the LICENSE file in the root directory of this source tree.
595
633
  */
596
- const qe = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]], Ge = ee("chevron-right", qe), me = "dd/MM/yyyy", ie = (t) => {
634
+ const ze = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]], qe = se("chevron-right", ze), he = "dd/MM/yyyy", le = (t) => {
597
635
  if (!t) return null;
598
- const i = Ae(t, me, /* @__PURE__ */ new Date());
599
- return ae(i) ? i : null;
600
- }, We = (t) => t ? ue(t, me) : "", Qe = [
636
+ const n = xe(t, he, /* @__PURE__ */ new Date());
637
+ return ue(n) ? n : null;
638
+ }, Ge = (t) => t ? fe(t, he) : "", Qe = [
601
639
  { value: 0, label: "Janeiro" },
602
640
  { value: 1, label: "Fevereiro" },
603
641
  { value: 2, label: "Março" },
@@ -610,99 +648,99 @@ const qe = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]], Ge = ee("chevron-r
610
648
  { value: 9, label: "Outubro" },
611
649
  { value: 10, label: "Novembro" },
612
650
  { value: 11, label: "Dezembro" }
613
- ], le = 1940, Ze = 2100, Xe = Array.from({ length: Ze - le + 1 }, (t, i) => {
614
- const a = le + i;
615
- return { value: a, label: String(a) };
651
+ ], ce = 1940, Ze = 2100, Xe = Array.from({ length: Ze - ce + 1 }, (t, n) => {
652
+ const f = ce + n;
653
+ return { value: f, label: String(f) };
616
654
  });
617
655
  function Ke({
618
656
  name: t,
619
- label: i = "",
620
- placeholder: a = "dd/mm/aaaa",
621
- className: u = "",
657
+ label: n = "",
658
+ placeholder: f = "dd/mm/aaaa",
659
+ className: o = "",
622
660
  forceReadOnly: c = !1,
623
- forceHidden: d = !1,
661
+ forceHidden: a = !1,
624
662
  valueManual: m,
625
- onChangeManual: o,
626
- errorManual: v
663
+ onChangeManual: d,
664
+ errorManual: p
627
665
  }) {
628
- var A;
629
- const l = m !== void 0 && !!o, { isReadOnly: y, isHidden: $ } = G(), R = c || !!y(t), C = d || !!$(t), { isView: b } = z();
630
- let S = "", E = () => {
631
- }, O, g = null, r = () => {
666
+ var B;
667
+ const s = m !== void 0 && !!d, { isReadOnly: v, isHidden: x } = G(), I = c || !!v(t), F = a || !!x(t), { isView: b } = z();
668
+ let _ = "", R = () => {
669
+ }, S, N = null, r = () => {
632
670
  };
633
- if (l)
634
- S = m;
671
+ if (s)
672
+ _ = m;
635
673
  else
636
674
  try {
637
- const h = J(), D = Q({ name: t, control: h.control });
638
- S = D.field.value, E = D.field.onChange, O = D.field.ref, g = (A = D.fieldState) == null ? void 0 : A.error, r = h.clearErrors;
675
+ const g = W(), D = Z({ name: t, control: g.control });
676
+ _ = D.field.value, R = D.field.onChange, S = D.field.ref, N = (B = D.fieldState) == null ? void 0 : B.error, r = g.clearErrors;
639
677
  } catch {
640
678
  }
641
- const [n, s] = U(!1), [f, N] = U(/* @__PURE__ */ new Date()), I = X(null);
642
- j(() => {
643
- if (n) {
644
- const h = ie(S);
645
- N(h && ae(h) ? h : /* @__PURE__ */ new Date());
679
+ const [i, l] = Y(!1), [u, h] = Y(/* @__PURE__ */ new Date()), E = ee(null);
680
+ P(() => {
681
+ if (i) {
682
+ const g = le(_);
683
+ h(g && ue(g) ? g : /* @__PURE__ */ new Date());
646
684
  }
647
- }, [n, S]), j(() => {
648
- const h = (D) => {
649
- I.current && !I.current.contains(D.target) && s(!1);
685
+ }, [i, _]), P(() => {
686
+ const g = (D) => {
687
+ E.current && !E.current.contains(D.target) && l(!1);
650
688
  };
651
- return document.addEventListener("mousedown", h), () => document.removeEventListener("mousedown", h);
689
+ return document.addEventListener("mousedown", g), () => document.removeEventListener("mousedown", g);
652
690
  }, []);
653
- const B = Y(() => ie(S), [S]), V = (h) => {
654
- if (R) return;
655
- const D = We(h);
656
- l ? o == null || o(D) : (E(D), r == null || r(t)), s(!1);
657
- }, _ = Y(() => ve({
658
- start: ge(Ne(f)),
659
- end: ye(be(f))
660
- }), [f]), w = f.getMonth(), k = ke(f);
661
- return /* @__PURE__ */ p("div", { className: `dfe-datepicker-wrapper form-group ${C ? "hidden" : ""} ${u}`, ref: I, children: [
662
- /* @__PURE__ */ e("label", { className: "control-label", children: i }),
663
- b ? /* @__PURE__ */ e("span", { className: "form-control", children: S || "-" }) : (
691
+ const H = J(() => le(_), [_]), V = (g) => {
692
+ if (I) return;
693
+ const D = Ge(g);
694
+ s ? d == null || d(D) : (R(D), r == null || r(t)), l(!1);
695
+ }, O = J(() => ve({
696
+ start: be(Ne(u)),
697
+ end: ye(ge(u))
698
+ }), [u]), $ = u.getMonth(), k = ke(u);
699
+ return /* @__PURE__ */ y("div", { className: `dfe-datepicker-wrapper form-group ${F ? "hidden" : ""} ${o}`, ref: E, children: [
700
+ /* @__PURE__ */ e("label", { className: "control-label", children: n }),
701
+ b ? /* @__PURE__ */ e("span", { className: "form-control", children: _ || "-" }) : (
664
702
  /* Container isolador de contexto posicional */
665
- /* @__PURE__ */ p("div", { className: "dfe-datepicker-inner-container", children: [
666
- /* @__PURE__ */ p(
703
+ /* @__PURE__ */ y("div", { className: "dfe-datepicker-inner-container", children: [
704
+ /* @__PURE__ */ y(
667
705
  "div",
668
706
  {
669
- className: `dfe-datepicker-control ${g ? "border-red" : ""} ${R ? "readOnly" : ""}`,
670
- onClick: () => !R && s((h) => !h),
671
- ref: O,
707
+ className: `dfe-datepicker-control ${N ? "border-red" : ""} ${I ? "readOnly" : ""}`,
708
+ onClick: () => !I && l((g) => !g),
709
+ ref: S,
672
710
  children: [
673
- /* @__PURE__ */ e("span", { className: `dfe-datepicker-display ${R ? "readOnly" : ""}`, children: S || a }),
711
+ /* @__PURE__ */ e("span", { className: `dfe-datepicker-display ${I ? "readOnly" : ""}`, children: _ || f }),
674
712
  /* @__PURE__ */ e(Ye, { size: 16, className: "dfe-datepicker-icon" })
675
713
  ]
676
714
  }
677
715
  ),
678
- n && !R && /* @__PURE__ */ p("div", { className: "dfe-datepicker-dropdown", onClick: (h) => h.stopPropagation(), children: [
679
- /* @__PURE__ */ p("div", { className: "dfe-datepicker-header", children: [
716
+ i && !I && /* @__PURE__ */ y("div", { className: "dfe-datepicker-dropdown", onClick: (g) => g.stopPropagation(), children: [
717
+ /* @__PURE__ */ y("div", { className: "dfe-datepicker-header", children: [
680
718
  /* @__PURE__ */ e(
681
719
  "button",
682
720
  {
683
721
  type: "button",
684
- onClick: () => N(we(f, 1)),
722
+ onClick: () => h(we(u, 1)),
685
723
  className: "dfe-datepicker-nav-btn",
686
- children: /* @__PURE__ */ e(ze, { size: 16 })
724
+ children: /* @__PURE__ */ e(We, { size: 16 })
687
725
  }
688
726
  ),
689
- /* @__PURE__ */ p("div", { className: "dfe-datepicker-selectors", children: [
727
+ /* @__PURE__ */ y("div", { className: "dfe-datepicker-selectors", children: [
690
728
  /* @__PURE__ */ e(
691
- re,
729
+ ne,
692
730
  {
693
731
  name: "datepicker_internal_month",
694
- valueManual: w,
695
- onChangeManual: (h) => N(_e(f, Number(h))),
732
+ valueManual: $,
733
+ onChangeManual: (g) => h($e(u, Number(g))),
696
734
  options: Qe,
697
735
  placeholder: "Mês"
698
736
  }
699
737
  ),
700
738
  /* @__PURE__ */ e(
701
- re,
739
+ ne,
702
740
  {
703
741
  name: "datepicker_internal_year",
704
742
  valueManual: k,
705
- onChangeManual: (h) => N(Oe(f, Number(h))),
743
+ onChangeManual: (g) => h(Oe(u, Number(g))),
706
744
  options: Xe,
707
745
  enableSearch: !0,
708
746
  searchPlaceholder: "Buscar ano...",
@@ -714,24 +752,24 @@ function Ke({
714
752
  "button",
715
753
  {
716
754
  type: "button",
717
- onClick: () => N(Re(f, 1)),
755
+ onClick: () => h(_e(u, 1)),
718
756
  className: "dfe-datepicker-nav-btn",
719
- children: /* @__PURE__ */ e(Ge, { size: 16 })
757
+ children: /* @__PURE__ */ e(qe, { size: 16 })
720
758
  }
721
759
  )
722
760
  ] }),
723
- /* @__PURE__ */ e("div", { className: "dfe-datepicker-grid-header", children: ["D", "S", "T", "Q", "Q", "S", "S"].map((h, D) => /* @__PURE__ */ e("span", { children: h }, D)) }),
724
- /* @__PURE__ */ e("div", { className: "dfe-datepicker-grid", children: _.map((h, D) => {
725
- const L = !Se(h, f), W = B && xe(h, B);
761
+ /* @__PURE__ */ e("div", { className: "dfe-datepicker-grid-header", children: ["D", "S", "T", "Q", "Q", "S", "S"].map((g, D) => /* @__PURE__ */ e("span", { children: g }, D)) }),
762
+ /* @__PURE__ */ e("div", { className: "dfe-datepicker-grid", children: O.map((g, D) => {
763
+ const j = !Re(g, u), X = H && Se(g, H);
726
764
  return /* @__PURE__ */ e(
727
765
  "div",
728
766
  {
729
- onClick: () => !L && V(h),
767
+ onClick: () => !j && V(g),
730
768
  className: `dfe-datepicker-day
731
- ${W ? "selected" : "handleHover"}
732
- ${L ? "outside" : ""}
733
- ${$e(h) ? "today" : ""}`,
734
- children: ue(h, "d")
769
+ ${X ? "selected" : "handleHover"}
770
+ ${j ? "outside" : ""}
771
+ ${Ae(g) ? "today" : ""}`,
772
+ children: fe(g, "d")
735
773
  },
736
774
  D
737
775
  );
@@ -739,30 +777,30 @@ function Ke({
739
777
  ] })
740
778
  ] })
741
779
  ),
742
- !l && /* @__PURE__ */ e("input", { type: "hidden", name: t, value: S || "" }),
743
- (g || v) && /* @__PURE__ */ e("p", { className: "text-danger", children: String((g == null ? void 0 : g.message) ?? v) })
780
+ !s && /* @__PURE__ */ e("input", { type: "hidden", name: t, value: _ || "" }),
781
+ (N || p) && /* @__PURE__ */ e("p", { className: "text-danger", children: String((N == null ? void 0 : N.message) ?? p) })
744
782
  ] });
745
783
  }
746
784
  const mt = q(Ke);
747
785
  function Me({
748
786
  mapping: t = {},
749
- defaultLabel: i = "Não reconhecido",
750
- className: a = "",
751
- hidden: u = !1,
787
+ defaultLabel: n = "Não reconhecido",
788
+ className: f = "",
789
+ hidden: o = !1,
752
790
  label: c
753
791
  }) {
754
- const { activityId: d } = z(), m = Y(() => !t || d === null || d === void 0 ? null : t[d], [d, t]);
792
+ const { activityId: a } = z(), m = J(() => !t || a === null || a === void 0 ? null : t[a], [a, t]);
755
793
  if (!m)
756
- return /* @__PURE__ */ p("div", { className: `form-group ${u ? "hidden" : ""}`, children: [
794
+ return /* @__PURE__ */ y("div", { className: `form-group ${o ? "hidden" : ""}`, children: [
757
795
  c && /* @__PURE__ */ e("label", { children: c }),
758
- /* @__PURE__ */ e("div", { className: `status-badge default ${a}`, children: i })
796
+ /* @__PURE__ */ e("div", { className: `status-badge default ${f}`, children: n })
759
797
  ] });
760
- const o = {
798
+ const d = {
761
799
  "--customColor": m.color
762
800
  };
763
- return /* @__PURE__ */ p("div", { className: `form-group ${u ? "hidden" : ""}`, children: [
801
+ return /* @__PURE__ */ y("div", { className: `form-group ${o ? "hidden" : ""}`, children: [
764
802
  c && /* @__PURE__ */ e("label", { children: c }),
765
- /* @__PURE__ */ p("div", { className: `status-badge ${a}`, style: o, children: [
803
+ /* @__PURE__ */ y("div", { className: `status-badge ${f}`, style: d, children: [
766
804
  m.icon && /* @__PURE__ */ e("i", { className: m.icon }),
767
805
  /* @__PURE__ */ e("span", { children: m.label })
768
806
  ] })
@@ -771,315 +809,315 @@ function Me({
771
809
  const ht = q(Me);
772
810
  function et({
773
811
  name: t,
774
- control: i,
775
- defaultRowValue: a,
776
- isView: u,
812
+ control: n,
813
+ defaultRowValue: f,
814
+ isView: o,
777
815
  isReadOnly: c,
778
- filters: d = []
816
+ filters: a = []
779
817
  }) {
780
- const { field: m } = Q({ name: t, control: i }), [o, v] = U([]), [l, y] = U([]), $ = () => Date.now() + Math.random(), R = (n) => {
818
+ const { field: m } = Z({ name: t, control: n }), [d, p] = Y([]), [s, v] = Y([]), x = () => Date.now() + Math.random(), I = (i) => {
781
819
  try {
782
- const s = JSON.parse(n);
783
- return Array.isArray(s) ? s.map((f) => ({
784
- ...f,
785
- _uid: f._uid || $()
820
+ const l = JSON.parse(i);
821
+ return Array.isArray(l) ? l.map((u) => ({
822
+ ...u,
823
+ _uid: u._uid || x()
786
824
  })) : [];
787
- } catch (s) {
788
- return console.error(`Erro ao ler dados da tabela "${t}":`, s), [];
825
+ } catch (l) {
826
+ return console.error(`Erro ao ler dados da tabela "${t}":`, l), [];
789
827
  }
790
828
  };
791
- j(() => {
792
- if (!(o.length > 0 && !u) && m.value && typeof m.value == "string") {
793
- const n = JSON.stringify(o);
794
- if (m.value === n) return;
795
- const s = R(m.value);
796
- v(s);
829
+ P(() => {
830
+ if (!(d.length > 0 && !o) && m.value && typeof m.value == "string") {
831
+ const i = JSON.stringify(d);
832
+ if (m.value === i) return;
833
+ const l = I(m.value);
834
+ p(l);
797
835
  }
798
- }, [m.value, u]), j(() => {
836
+ }, [m.value, o]), P(() => {
799
837
  if (c) return;
800
- const n = JSON.stringify(o);
801
- m.value !== n && m.onChange(n);
802
- }, [o, m, c]);
803
- const C = P(() => {
804
- const n = { _uid: $(), ...a };
805
- v((s) => [...s, n]);
806
- }, [a]), b = P(() => {
807
- v((n) => n.filter((s) => !l.includes(s._uid))), y([]);
808
- }, [l]), S = P((n, s, f) => {
809
- v((N) => N.map((I) => I._uid === n ? { ...I, [s]: f } : I));
810
- }, []), E = P((n) => {
811
- y((s) => s.includes(n) ? s.filter((f) => f !== n) : [...s, n]);
812
- }, []), O = P(
813
- (n) => {
814
- y(n ? o.map((s) => s._uid) : []);
838
+ const i = JSON.stringify(d);
839
+ m.value !== i && m.onChange(i);
840
+ }, [d, m, c]);
841
+ const F = U(() => {
842
+ const i = { _uid: x(), ...f };
843
+ p((l) => [...l, i]);
844
+ }, [f]), b = U(() => {
845
+ p((i) => i.filter((l) => !s.includes(l._uid))), v([]);
846
+ }, [s]), _ = U((i, l, u) => {
847
+ p((h) => h.map((E) => E._uid === i ? { ...E, [l]: u } : E));
848
+ }, []), R = U((i) => {
849
+ v((l) => l.includes(i) ? l.filter((u) => u !== i) : [...l, i]);
850
+ }, []), S = U(
851
+ (i) => {
852
+ v(i ? d.map((l) => l._uid) : []);
815
853
  },
816
- [o]
817
- ), g = o.length > 0 && l.length === o.length, r = Y(() => !d || d.length === 0 ? o : o.filter(
818
- (n) => d.every((s) => {
819
- if ("custom" in s)
820
- return s.custom(n);
821
- const f = n[s.field];
822
- switch (s.operator) {
854
+ [d]
855
+ ), N = d.length > 0 && s.length === d.length, r = J(() => !a || a.length === 0 ? d : d.filter(
856
+ (i) => a.every((l) => {
857
+ if ("custom" in l)
858
+ return l.custom(i);
859
+ const u = i[l.field];
860
+ switch (l.operator) {
823
861
  case "===":
824
- return f === s.value;
862
+ return u === l.value;
825
863
  case "!==":
826
- return f !== s.value;
864
+ return u !== l.value;
827
865
  case ">":
828
- return f > s.value;
866
+ return u > l.value;
829
867
  case "<":
830
- return f < s.value;
868
+ return u < l.value;
831
869
  case ">=":
832
- return f >= s.value;
870
+ return u >= l.value;
833
871
  case "<=":
834
- return f <= s.value;
872
+ return u <= l.value;
835
873
  default:
836
874
  return !0;
837
875
  }
838
876
  })
839
- ), [o, d]);
877
+ ), [d, a]);
840
878
  return {
841
879
  field: m,
842
- tableRows: o,
880
+ tableRows: d,
843
881
  visibleRows: r,
844
- selectedRowIds: l,
845
- isAllSelected: g,
882
+ selectedRowIds: s,
883
+ isAllSelected: N,
846
884
  handle: {
847
- addRow: C,
885
+ addRow: F,
848
886
  removeRows: b,
849
- updateCellValue: S,
850
- toggleSelection: E,
851
- toggleSelectAll: O
887
+ updateCellValue: _,
888
+ toggleSelection: R,
889
+ toggleSelectAll: S
852
890
  }
853
891
  };
854
892
  }
855
893
  const pt = ({
856
894
  name: t,
857
- title: i = "Tabela Dinâmica",
858
- columns: a,
859
- defaultRowValue: u = {},
895
+ title: n = "Tabela Dinâmica",
896
+ columns: f,
897
+ defaultRowValue: o = {},
860
898
  forceReadOnly: c = !1,
861
- layout: d = "fluid",
899
+ layout: a = "fluid",
862
900
  actions: m = !0,
863
- filters: o = []
901
+ filters: d = []
864
902
  }) => {
865
- const { control: v } = J(), { isView: l, isReadOnly: y } = z(), { isReadOnly: $ } = G(), R = c || l || y || $ && $(t), { field: C, visibleRows: b, selectedRowIds: S, isAllSelected: E, handle: O } = et({
903
+ const { control: p } = W(), { isView: s, isReadOnly: v } = z(), { isReadOnly: x } = G(), I = c || s || v || x && x(t), { field: F, visibleRows: b, selectedRowIds: _, isAllSelected: R, handle: S } = et({
866
904
  name: t,
867
- control: v,
868
- defaultRowValue: u,
869
- isView: l,
870
- isReadOnly: !!R,
871
- filters: o
872
- }), g = d === "fixed";
873
- return /* @__PURE__ */ p("div", { className: `table-wrapper ${g ? "table-fixed" : "table-fluid"}`, children: [
874
- /* @__PURE__ */ e("input", { type: "hidden", ...C }),
875
- /* @__PURE__ */ p("div", { className: "header-handle", children: [
876
- /* @__PURE__ */ e("h3", { children: i }),
877
- !R && m && /* @__PURE__ */ p("div", { className: "handle-actions", children: [
878
- /* @__PURE__ */ p(
905
+ control: p,
906
+ defaultRowValue: o,
907
+ isView: s,
908
+ isReadOnly: !!I,
909
+ filters: d
910
+ }), N = a === "fixed";
911
+ return /* @__PURE__ */ y("div", { className: `table-wrapper ${N ? "table-fixed" : "table-fluid"}`, children: [
912
+ /* @__PURE__ */ e("input", { type: "hidden", ...F }),
913
+ /* @__PURE__ */ y("div", { className: "header-handle", children: [
914
+ /* @__PURE__ */ e("h3", { children: n }),
915
+ !I && m && /* @__PURE__ */ y("div", { className: "handle-actions", children: [
916
+ /* @__PURE__ */ y(
879
917
  "button",
880
918
  {
881
919
  type: "button",
882
- className: `btn ${S.length > 0 ? "btn-danger" : "btn-primary"}`,
883
- disabled: S.length === 0,
884
- onClick: O.removeRows,
920
+ className: `btn ${_.length > 0 ? "btn-danger" : "btn-primary"}`,
921
+ disabled: _.length === 0,
922
+ onClick: S.removeRows,
885
923
  children: [
886
924
  "Remover (",
887
- S.length,
925
+ _.length,
888
926
  ")"
889
927
  ]
890
928
  }
891
929
  ),
892
- /* @__PURE__ */ e("button", { type: "button", className: "btn-add", onClick: O.addRow, children: "Adicionar" })
930
+ /* @__PURE__ */ e("button", { type: "button", className: "btn-add", onClick: S.addRow, children: "Adicionar" })
893
931
  ] })
894
932
  ] }),
895
- /* @__PURE__ */ e("div", { className: "table-scroll", children: /* @__PURE__ */ p("table", { className: "table-custom", children: [
896
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ p("tr", { children: [
897
- !R && /* @__PURE__ */ e("th", { style: { width: "50px" }, children: /* @__PURE__ */ e(
933
+ /* @__PURE__ */ e("div", { className: "table-scroll", children: /* @__PURE__ */ y("table", { className: "table-custom", children: [
934
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ y("tr", { children: [
935
+ !I && /* @__PURE__ */ e("th", { style: { width: "50px" }, children: /* @__PURE__ */ e(
898
936
  "input",
899
937
  {
900
938
  type: "checkbox",
901
- checked: E,
902
- onChange: (r) => O.toggleSelectAll(r.target.checked)
939
+ checked: R,
940
+ onChange: (r) => S.toggleSelectAll(r.target.checked)
903
941
  }
904
942
  ) }),
905
- a.map((r) => /* @__PURE__ */ e(
943
+ f.map((r) => /* @__PURE__ */ e(
906
944
  "th",
907
945
  {
908
- style: r.width ? { minWidth: g ? r.width : "100%" } : { width: "max-content" },
946
+ style: r.width ? { minWidth: N ? r.width : "100%" } : { width: "max-content" },
909
947
  children: r.label
910
948
  },
911
949
  String(r.key)
912
950
  ))
913
951
  ] }) }),
914
- /* @__PURE__ */ p("tbody", { children: [
915
- b.map((r, n) => /* @__PURE__ */ p("tr", { children: [
916
- !R && /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
952
+ /* @__PURE__ */ y("tbody", { children: [
953
+ b.map((r, i) => /* @__PURE__ */ y("tr", { children: [
954
+ !I && /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
917
955
  "input",
918
956
  {
919
957
  type: "checkbox",
920
- checked: S.includes(r._uid),
921
- onChange: () => O.toggleSelection(r._uid)
958
+ checked: _.includes(r._uid),
959
+ onChange: () => S.toggleSelection(r._uid)
922
960
  }
923
961
  ) }),
924
- a.map((s) => /* @__PURE__ */ e("td", { children: s.render ? s.render.length <= 1 ? s.render({
962
+ f.map((l) => /* @__PURE__ */ e("td", { children: l.render ? l.render.length <= 1 ? l.render({
925
963
  row: r,
926
- index: n,
927
- updateRow: (f, N) => O.updateCellValue(r._uid, String(f), N),
928
- isLocked: !!R,
929
- isView: !!l
930
- }) : s.render(
964
+ index: i,
965
+ updateRow: (u, h) => S.updateCellValue(r._uid, String(u), h),
966
+ isLocked: !!I,
967
+ isView: !!s
968
+ }) : l.render(
931
969
  r,
932
- n,
933
- (f, N) => O.updateCellValue(r._uid, f, N),
934
- !!R,
935
- !!l
936
- ) : r[s.key] }, `${r._uid}-${String(s.key)}`))
970
+ i,
971
+ (u, h) => S.updateCellValue(r._uid, u, h),
972
+ !!I,
973
+ !!s
974
+ ) : r[l.key] }, `${r._uid}-${String(l.key)}`))
937
975
  ] }, r._uid)),
938
- b.length === 0 && /* @__PURE__ */ e("tr", { className: "empty-row", children: /* @__PURE__ */ e("td", { colSpan: 100, className: "text-center", children: R ? "Nenhum registro encontrado." : "Nenhum registro." }) })
976
+ b.length === 0 && /* @__PURE__ */ e("tr", { className: "empty-row", children: /* @__PURE__ */ e("td", { colSpan: 100, className: "text-center", children: I ? "Nenhum registro encontrado." : "Nenhum registro." }) })
939
977
  ] })
940
978
  ] }) })
941
979
  ] });
942
- }, tt = (t, i) => {
943
- const [a, u] = U(null);
980
+ }, tt = (t, n) => {
981
+ const [f, o] = Y(null);
944
982
  let c = null;
945
983
  try {
946
- c = J().watch;
984
+ c = W().watch;
947
985
  } catch {
948
986
  }
949
- const d = i !== void 0 ? i : c ? c(t) : void 0, m = P(() => {
987
+ const a = n !== void 0 ? n : c ? c(t) : void 0, m = U(() => {
950
988
  try {
951
- const v = window.top.__REACT_ATTACHMENT_BRIDGE__;
952
- if (v) {
953
- const l = v.getAttachment(t, d);
954
- u(l || (d ? { name: d, documentId: 0 } : null));
989
+ const p = window.top.__REACT_ATTACHMENT_BRIDGE__;
990
+ if (p) {
991
+ const s = p.getAttachment(t, a);
992
+ o(s || (a ? { name: a, documentId: 0 } : null));
955
993
  } else
956
- u(d ? { name: d, documentId: 0 } : null);
994
+ o(a ? { name: a, documentId: 0 } : null);
957
995
  } catch {
958
- u(d ? { name: d, documentId: 0 } : null);
996
+ o(a ? { name: a, documentId: 0 } : null);
959
997
  }
960
- }, [t, d, i]);
961
- return j(() => {
998
+ }, [t, a, n]);
999
+ return P(() => {
962
1000
  m();
963
- const o = setInterval(m, 2e3);
964
- return () => clearInterval(o);
965
- }, [m]), { attachment: a, sync: m };
1001
+ const d = setInterval(m, 2e3);
1002
+ return () => clearInterval(d);
1003
+ }, [m]), { attachment: f, sync: m };
966
1004
  }, st = ({
967
1005
  name: t,
968
- label: i,
969
- help: a,
970
- valueManual: u,
1006
+ label: n,
1007
+ help: f,
1008
+ valueManual: o,
971
1009
  onChangeManual: c,
972
- forceReadOnly: d = !1,
1010
+ forceReadOnly: a = !1,
973
1011
  forceHidden: m = !1,
974
- helpText: o,
975
- helpTitle: v,
976
- helpWidth: l
1012
+ helpText: d,
1013
+ helpTitle: p,
1014
+ helpWidth: s
977
1015
  }) => {
978
- const y = !!c, { isReadOnly: $, isHidden: R } = G(), { isView: C } = z(), b = d || C || !!$(t), S = m || !!R(t), [E, O] = U(!1);
979
- let g = null;
1016
+ const v = !!c, { isReadOnly: x, isHidden: I } = G(), { isView: F } = z(), b = a || F || !!x(t), _ = m || !!I(t), [R, S] = Y(!1);
1017
+ let N = null;
980
1018
  try {
981
- g = J().control;
1019
+ N = W().control;
982
1020
  } catch {
983
1021
  }
984
- const r = g && !y ? Q({ name: t, control: g }).field : {
985
- value: u,
986
- onChange: (w) => c == null ? void 0 : c(w)
987
- }, { attachment: n, sync: s } = tt(t, u), f = () => {
988
- var w;
1022
+ const r = N && !v ? Z({ name: t, control: N }).field : {
1023
+ value: o,
1024
+ onChange: ($) => c == null ? void 0 : c($)
1025
+ }, { attachment: i, sync: l } = tt(t, o), u = () => {
1026
+ var $;
989
1027
  try {
990
1028
  const k = window.top;
991
1029
  return {
992
1030
  bridge: k.__REACT_ATTACHMENT_BRIDGE__,
993
- toast: (w = k.FLUIGC) == null ? void 0 : w.toast
1031
+ toast: ($ = k.FLUIGC) == null ? void 0 : $.toast
994
1032
  };
995
1033
  } catch {
996
1034
  return { bridge: null, toast: null };
997
1035
  }
998
- }, N = P(() => {
1036
+ }, h = U(() => {
999
1037
  if (b) return;
1000
- const w = document.createElement("input");
1001
- w.type = "file", w.onchange = (k) => {
1002
- const A = k.target.files[0];
1003
- if (!A) return;
1004
- const { bridge: h, toast: D } = f();
1005
- O(!0), h ? h.upload(A, t, (L) => {
1006
- y ? c == null || c(L.name) : r.onChange(L.name), setTimeout(() => {
1007
- O(!1), s();
1038
+ const $ = document.createElement("input");
1039
+ $.type = "file", $.onchange = (k) => {
1040
+ const B = k.target.files[0];
1041
+ if (!B) return;
1042
+ const { bridge: g, toast: D } = u();
1043
+ S(!0), g ? g.upload(B, t, (j) => {
1044
+ v ? c == null || c(j.name) : r.onChange(j.name), setTimeout(() => {
1045
+ S(!1), l();
1008
1046
  }, 1e3), D && D({
1009
1047
  title: "Sucesso",
1010
1048
  message: "Arquivo enviado",
1011
1049
  type: "success"
1012
1050
  });
1013
- }) : (y ? c == null || c(A.name) : r.onChange(A.name), O(!1));
1014
- }, w.click();
1015
- }, [t, r, s, c, b, y]), I = (w) => {
1016
- if (w.stopPropagation(), b) return;
1017
- const k = (n == null ? void 0 : n.name) || u || r.value;
1051
+ }) : (v ? c == null || c(B.name) : r.onChange(B.name), S(!1));
1052
+ }, $.click();
1053
+ }, [t, r, l, c, b, v]), E = ($) => {
1054
+ if ($.stopPropagation(), b) return;
1055
+ const k = (i == null ? void 0 : i.name) || o || r.value;
1018
1056
  if (!k) return;
1019
- const { bridge: A, toast: h } = f();
1020
- A ? A.removeByFileName(k) ? (y ? c == null || c("") : r.onChange(""), s()) : h && h({
1057
+ const { bridge: B, toast: g } = u();
1058
+ B ? B.removeByFileName(k) ? (v ? c == null || c("") : r.onChange(""), l()) : g && g({
1021
1059
  title: "Erro",
1022
1060
  message: "Erro ao remover anexo",
1023
1061
  type: "danger"
1024
- }) : (y ? c == null || c("") : r.onChange(""), s());
1025
- }, B = !!n && !E, V = (n == null ? void 0 : n.name) || u || r.value, _ = [
1062
+ }) : (v ? c == null || c("") : r.onChange(""), l());
1063
+ }, H = !!i && !R, V = (i == null ? void 0 : i.name) || o || r.value, O = [
1026
1064
  "fluig-attachment__box",
1027
- B ? "fluig-attachment__box--has-file" : "",
1028
- E ? "fluig-attachment__box--uploading" : "",
1029
- b && !B ? "readOnly" : "",
1030
- b && B ? "fluig-attachment__box--readonly-view" : ""
1065
+ H ? "fluig-attachment__box--has-file" : "",
1066
+ R ? "fluig-attachment__box--uploading" : "",
1067
+ b && !H ? "readOnly" : "",
1068
+ b && H ? "fluig-attachment__box--readonly-view" : ""
1031
1069
  ].join(" ");
1032
- return S ? null : /* @__PURE__ */ p("div", { className: "form-group fluig-attachment", children: [
1033
- i && /* @__PURE__ */ e("label", { className: "fluig-attachment__label", children: i }),
1034
- /* @__PURE__ */ p("div", { className: o ? "dfe-flex-input-wrapper" : "", children: [
1035
- /* @__PURE__ */ p(
1070
+ return _ ? null : /* @__PURE__ */ y("div", { className: "form-group fluig-attachment", children: [
1071
+ n && /* @__PURE__ */ e("label", { className: "fluig-attachment__label", children: n }),
1072
+ /* @__PURE__ */ y("div", { className: d ? "dfe-flex-input-wrapper" : "", children: [
1073
+ /* @__PURE__ */ y(
1036
1074
  "div",
1037
1075
  {
1038
- className: _,
1039
- style: o ? { flex: 1 } : void 0,
1076
+ className: O,
1077
+ style: d ? { flex: 1 } : void 0,
1040
1078
  onClick: () => {
1041
- if (B) {
1042
- const w = f(), k = (n == null ? void 0 : n.physicalFileName) || (n == null ? void 0 : n.description) || (n == null ? void 0 : n.name) || V;
1043
- w.bridge && k && w.bridge.view(k);
1079
+ if (H) {
1080
+ const $ = u(), k = (i == null ? void 0 : i.physicalFileName) || (i == null ? void 0 : i.description) || (i == null ? void 0 : i.name) || V;
1081
+ $.bridge && k && $.bridge.view(k);
1044
1082
  } else
1045
- N();
1083
+ h();
1046
1084
  },
1047
1085
  children: [
1048
- /* @__PURE__ */ p("span", { className: "fluig-attachment__content", children: [
1086
+ /* @__PURE__ */ y("span", { className: "fluig-attachment__content", children: [
1049
1087
  /* @__PURE__ */ e(
1050
1088
  "i",
1051
1089
  {
1052
- className: `flaticon icon-sm ${E ? "flaticon-loading" : B ? "flaticon-file" : "flaticon-paperclip"} fluig-attachment__icon`
1090
+ className: `flaticon icon-sm ${R ? "flaticon-loading" : H ? "flaticon-file" : "flaticon-paperclip"} fluig-attachment__icon`
1053
1091
  }
1054
1092
  ),
1055
- /* @__PURE__ */ e("span", { className: "fluig-attachment__filename", children: E ? " Enviando..." : B ? V : b ? "Nenhum arquivo" : a || "Anexar" })
1093
+ /* @__PURE__ */ e("span", { className: "fluig-attachment__filename", children: R ? " Enviando..." : H ? V : b ? "Nenhum arquivo" : f || "Anexar" })
1056
1094
  ] }),
1057
- B && !b && /* @__PURE__ */ e(
1095
+ H && !b && /* @__PURE__ */ e(
1058
1096
  "button",
1059
1097
  {
1060
1098
  type: "button",
1061
1099
  className: "fluig-attachment__btn-remove btn btn-link text-danger",
1062
- onClick: I,
1100
+ onClick: E,
1063
1101
  children: /* @__PURE__ */ e("i", { className: "flaticon flaticon-trash icon-sm" })
1064
1102
  }
1065
1103
  )
1066
1104
  ]
1067
1105
  }
1068
1106
  ),
1069
- o && /* @__PURE__ */ e(Z, { text: o, title: v, width: l })
1107
+ d && /* @__PURE__ */ e(M, { text: d, title: p, width: s })
1070
1108
  ] }),
1071
- !y && g && /* @__PURE__ */ e("input", { type: "hidden", name: t, value: r.value || "" })
1109
+ !v && N && /* @__PURE__ */ e("input", { type: "hidden", name: t, value: r.value || "" })
1072
1110
  ] });
1073
1111
  }, vt = q(st);
1074
1112
  export {
1075
1113
  vt as Attachment,
1076
1114
  at as Checkbox,
1077
1115
  mt as DatePicker,
1078
- Z as Help,
1079
- dt as Input,
1116
+ M as Help,
1117
+ ot as Input,
1080
1118
  Ie as Modal,
1081
1119
  ut as RadioBtn,
1082
- re as Select,
1120
+ ne as Select,
1083
1121
  pt as SimpleTable,
1084
1122
  ht as StatusBadge,
1085
1123
  ft as TextArea