diefra_ecm_ui 1.2.2 → 1.2.4

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