diefra_ecm_ui 1.2.2 → 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 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";
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
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
- 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 G, useFluigRuntime as z } 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 $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
- [f]
12
+ [o]
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 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: 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: 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 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: o = "" }) {
26
+ const [c, a] = Y(!1), m = (d) => {
27
+ d.preventDefault(), d.stopPropagation(), a(!0);
28
28
  };
29
- return /* @__PURE__ */ v(oe, { children: [
29
+ return /* @__PURE__ */ y(de, { children: [
30
30
  /* @__PURE__ */ e(
31
31
  "div",
32
32
  {
33
- className: `dfe-help-indicator ${f}`,
33
+ className: `dfe-help-indicator ${o}`,
34
34
  onClick: m,
35
35
  role: "button",
36
36
  tabIndex: 0,
@@ -44,435 +44,433 @@ 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: () => 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 ee = q(Ee), Ve = {
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",
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: o = "text",
66
66
  mask: c,
67
- className: d = "",
67
+ className: a = "",
68
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,
69
+ forceHidden: d = !1,
70
+ prefix: p,
71
+ suffix: s,
72
+ helpText: v,
73
+ helpTitle: x,
74
+ helpWidth: I,
75
+ valueManual: F,
76
76
  onChangeManual: b,
77
77
  errorManual: _
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 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;
82
82
  try {
83
- a = W();
83
+ u = W();
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 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]);
103
138
  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(
139
+ const j = `form-control ${r ? "readOnly" : ""} ${V ? "border-red" : ""} ${a}`, X = () => O ? /* @__PURE__ */ e(
109
140
  pe,
110
141
  {
111
- mask: x,
112
- value: E,
142
+ mask: O,
143
+ value: D,
113
144
  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
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
121
151
  }
122
152
  ) : /* @__PURE__ */ e(
123
153
  "input",
124
154
  {
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
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
133
163
  }
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: [
164
+ );
165
+ return l ? /* @__PURE__ */ y("div", { className: "form-group", children: [
168
166
  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 })
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 })
172
170
  ] })
173
- ] }) : /* @__PURE__ */ v("div", { className: `form-group ${i ? "hidden" : ""}`, children: [
171
+ ] }) : /* @__PURE__ */ y("div", { className: `form-group ${i ? "hidden" : ""}`, children: [
174
172
  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 })
173
+ /* @__PURE__ */ y("div", { className: v ? "dfe-flex-input-wrapper" : "", children: [
174
+ X(),
175
+ v && /* @__PURE__ */ e(M, { text: v, title: x, width: I })
178
176
  ] }),
179
- !$ && /* @__PURE__ */ e("input", { type: "hidden", name: t, value: L || "" }),
180
- 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) })
181
179
  ] });
182
180
  }
183
- const dt = q(De);
184
- function Le({
181
+ const ot = q(Ee);
182
+ function Be({
185
183
  name: t,
186
184
  label: n = "",
187
- options: u = [],
188
- placeholder: f = "",
185
+ options: f = [],
186
+ placeholder: o = "",
189
187
  labelKey: c = "label",
190
- valueKey: d = "value",
188
+ valueKey: a = "value",
191
189
  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,
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,
199
197
  helpText: b,
200
198
  helpTitle: _,
201
- helpWidth: $,
202
- valueManual: R,
199
+ helpWidth: R,
200
+ valueManual: S,
203
201
  onChangeManual: N,
204
- errorManual: s
202
+ errorManual: r
205
203
  }) {
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 = () => {
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 = () => {
210
208
  };
211
209
  if (i)
212
- I = R;
210
+ V = S;
213
211
  else
214
212
  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;
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;
217
215
  } catch {
218
216
  }
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);
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);
225
223
  };
226
- return document.addEventListener("mousedown", S), () => document.removeEventListener("mousedown", S);
227
- }, []), T(() => {
228
- y || J("");
229
- }, [y]), T(() => {
224
+ return document.addEventListener("mousedown", A), () => document.removeEventListener("mousedown", A);
225
+ }, []), P(() => {
226
+ g || X("");
227
+ }, [g]), P(() => {
230
228
  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));
229
+ const A = setTimeout(() => {
230
+ var T;
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(() => {
238
+ if (V == null) return "";
239
+ if (typeof V == "object")
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));
247
245
  };
248
- return V ? null : /* @__PURE__ */ v("div", { className: `select-wrapper form-group ${V ? "hidden" : ""}`, ref: X, children: [
246
+ return E ? null : /* @__PURE__ */ y("div", { className: `select-wrapper form-group ${E ? "hidden" : ""}`, ref: K, children: [
249
247
  /* @__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(
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(
256
254
  "div",
257
255
  {
258
- className: `select-control ${k ? "border-red" : ""} ${p ? "readOnly" : ""}`,
259
- onClick: () => !p && E((S) => !S),
260
- ref: w,
256
+ className: `select-control ${k ? "border-red" : ""} ${h ? "readOnly" : ""}`,
257
+ onClick: () => !h && D((A) => !A),
258
+ ref: $,
261
259
  style: b ? { flex: 1 } : void 0,
262
260
  children: [
263
- /* @__PURE__ */ e("span", { className: `select-display ${p ? "readOnly" : ""}`, children: M || f }),
261
+ /* @__PURE__ */ e("span", { className: `select-display ${h ? "readOnly" : ""}`, children: w || o }),
264
262
  /* @__PURE__ */ e("i", { className: "flaticon flaticon-chevron-down select-icon" })
265
263
  ]
266
264
  }
267
265
  ),
268
- b && /* @__PURE__ */ e(ee, { text: b, title: _, width: $ })
266
+ b && /* @__PURE__ */ e(M, { text: b, title: _, width: R })
269
267
  ] }),
270
- y && !p && /* @__PURE__ */ v("div", { className: "select-dropdown", children: [
268
+ g && !h && /* @__PURE__ */ y("div", { className: "select-dropdown", children: [
271
269
  m && /* @__PURE__ */ e("div", { className: "select-search", children: /* @__PURE__ */ e(
272
270
  "input",
273
271
  {
274
272
  type: "text",
275
273
  className: "select-search-input",
276
- value: H,
277
- onChange: (S) => J(S.target.value),
278
- placeholder: g ? "Carregando..." : o,
274
+ value: j,
275
+ onChange: (A) => X(A.target.value),
276
+ placeholder: p ? "Carregando..." : d,
279
277
  autoFocus: !0,
280
- onClick: (S) => S.stopPropagation()
278
+ onClick: (A) => A.stopPropagation()
281
279
  }
282
280
  ) }),
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" }) })
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" }) })
284
282
  ] })
285
283
  ] }),
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) })
284
+ !i && /* @__PURE__ */ e("input", { type: "hidden", name: t, value: V || "" }),
285
+ (k || r) && /* @__PURE__ */ e("p", { className: "text-danger", children: String((k == null ? void 0 : k.message) ?? r) })
288
286
  ] });
289
287
  }
290
- const re = q(Le);
288
+ const ne = q(Be);
291
289
  function at({
292
290
  name: t,
293
291
  options: n = [],
294
- label: u = "",
295
- valueKey: f = "value",
292
+ label: f = "",
293
+ valueKey: o = "value",
296
294
  labelKey: c = "label",
297
- forceReadOnly: d = !1,
295
+ forceReadOnly: a = !1,
298
296
  forceHidden: m = !1,
299
- valueManual: o,
300
- onChangeManual: g
297
+ valueManual: d,
298
+ onChangeManual: p
301
299
  }) {
302
- var L, I;
303
- let r = null;
300
+ var H, V;
301
+ let s = null;
304
302
  try {
305
- r = W();
303
+ s = W();
306
304
  } catch {
307
305
  }
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";
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";
316
314
  } else
317
- x[k] = !1;
318
- return x;
315
+ O[k] = !1;
316
+ return O;
319
317
  },
320
318
  {}
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, {
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, {
326
324
  shouldDirty: !1,
327
325
  shouldValidate: !1
328
326
  });
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);
327
+ }, [u, t, s, v]);
328
+ const h = (O, $) => {
329
+ if (r) return;
330
+ const k = { ...u, [O]: $ };
331
+ if (v) {
332
+ p && p(k);
335
333
  return;
336
334
  }
337
- r && (r.setValue(t, k, {
335
+ s && (s.setValue(t, k, {
338
336
  shouldDirty: !0,
339
337
  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 }),
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 }),
344
342
  /* @__PURE__ */ e(
345
343
  "div",
346
344
  {
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(
345
+ className: `checkbox-group-custom ${r ? "readOnly" : ""}`,
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(
353
351
  "label",
354
352
  {
355
- className: `custom-checkbox ${k ? "checked" : ""} ${s ? "readOnly" : ""}`,
353
+ className: `custom-checkbox ${k ? "checked" : ""} ${r ? "readOnly" : ""}`,
356
354
  children: [
357
355
  /* @__PURE__ */ e(
358
356
  "input",
359
357
  {
360
358
  type: "checkbox",
361
359
  checked: k,
362
- disabled: s,
363
- onChange: (D) => p(w, D.target.checked)
360
+ disabled: r,
361
+ onChange: (B) => h($, B.target.checked)
364
362
  }
365
363
  ),
366
364
  /* @__PURE__ */ e("span", { className: "checkmark" }),
367
- /* @__PURE__ */ e("span", { children: x[c] })
365
+ /* @__PURE__ */ e("span", { children: O[c] })
368
366
  ]
369
367
  }
370
368
  )
371
- ] }, w);
369
+ ] }, $);
372
370
  })
373
371
  }
374
372
  ),
375
- V && /* @__PURE__ */ e("p", { className: "text-danger", children: String(V.message) })
373
+ E && /* @__PURE__ */ e("p", { className: "text-danger", children: String(E.message) })
376
374
  ] });
377
375
  }
378
- function Be({
376
+ function He({
379
377
  name: t,
380
378
  label: n = "",
381
- options: u = [],
382
- valueKey: f = "value",
379
+ options: f = [],
380
+ valueKey: o = "value",
383
381
  labelKey: c = "label",
384
- iconKey: d = "icon",
382
+ iconKey: a = "icon",
385
383
  forceReadOnly: m = !1,
386
- forceHidden: o = !1,
387
- valueManual: g,
388
- onChangeManual: r,
389
- errorManual: h
384
+ forceHidden: d = !1,
385
+ valueManual: p,
386
+ onChangeManual: s,
387
+ errorManual: v
390
388
  }) {
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();
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();
393
391
  let N = null;
394
392
  try {
395
393
  N = W();
396
394
  } catch {
397
395
  }
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()));
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()));
401
399
  },
402
- [a, O, r, s]
400
+ [u, x, s, r]
403
401
  );
404
- return /* @__PURE__ */ v("div", { className: `form-group column ${_ ? "hidden" : ""}`, children: [
402
+ return /* @__PURE__ */ y("div", { className: `form-group column ${_ ? "hidden" : ""}`, children: [
405
403
  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;
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;
408
406
  return (
409
407
  // Trocado de <label> para <div> para evitar comportamentos nativos de clique do HTML
410
- /* @__PURE__ */ v(
408
+ /* @__PURE__ */ y(
411
409
  "div",
412
410
  {
413
- style: D,
411
+ style: B,
414
412
  className: `btn fs-ellipsis ${k ? "active" : ""}`,
415
- onClick: () => V(w),
413
+ onClick: () => E($),
416
414
  children: [
417
- x[d] && /* @__PURE__ */ e("i", { className: `${x[d]} icon-sm` }),
415
+ O[a] && /* @__PURE__ */ e("i", { className: `${O[a]} icon-sm` }),
418
416
  " ",
419
- x[c]
417
+ O[c]
420
418
  ]
421
419
  },
422
- w
420
+ $
423
421
  )
424
422
  );
425
423
  }) }),
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) })
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) })
428
426
  ] });
429
427
  }
430
- const ut = q(Be), Ce = ({
428
+ const ut = q(He), Le = ({
431
429
  name: t,
432
430
  label: n = "",
433
- placeholder: u = "",
434
- className: f = "",
431
+ placeholder: f = "",
432
+ className: o = "",
435
433
  rows: c = 4,
436
- maxLength: d,
434
+ maxLength: a,
437
435
  forceReadOnly: m = !1,
438
- forceHidden: o = !1,
439
- valueManual: g,
440
- onChangeManual: r,
441
- errorManual: h
436
+ forceHidden: d = !1,
437
+ valueManual: p,
438
+ onChangeManual: s,
439
+ errorManual: v
442
440
  }) => {
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);
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);
445
443
  let N = {
446
- value: g ?? "",
447
- onChange: (p) => r == null ? void 0 : r(p)
448
- }, s = null;
449
- if (!O)
444
+ value: p ?? "",
445
+ onChange: (h) => s == null ? void 0 : s(h)
446
+ }, r = null;
447
+ if (!x)
450
448
  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;
449
+ const { control: h } = W(), E = Z({ name: t, control: h });
450
+ N = E.field, r = (u = E.fieldState) == null ? void 0 : u.error;
453
451
  } catch {
454
452
  }
455
453
  const i = () => {
456
- R.current && (R.current.style.height = "auto", R.current.style.height = `${R.current.scrollHeight}px`);
454
+ S.current && (S.current.style.height = "auto", S.current.style.height = `${S.current.scrollHeight}px`);
457
455
  };
458
- if (T(() => {
456
+ if (P(() => {
459
457
  i();
460
- }, [N.value]), $)
461
- return /* @__PURE__ */ v("div", { className: `form-group ${_ ? "hidden" : ""}`, children: [
458
+ }, [N.value]), R)
459
+ return /* @__PURE__ */ y("div", { className: `form-group ${_ ? "hidden" : ""}`, children: [
462
460
  /* @__PURE__ */ e("label", { children: n }),
463
461
  /* @__PURE__ */ e("span", { className: "form-control", children: N.value || "-" })
464
462
  ] });
465
- const l = `form-control ${b ? "readOnly" : ""} ${s || h ? "border-red" : ""} ${f}`;
466
- return /* @__PURE__ */ v("div", { className: `form-group ${_ ? "hidden" : ""}`, children: [
463
+ const l = `form-control ${b ? "readOnly" : ""} ${r || v ? "border-red" : ""} ${o}`;
464
+ return /* @__PURE__ */ y("div", { className: `form-group ${_ ? "hidden" : ""}`, children: [
467
465
  n && /* @__PURE__ */ e("label", { children: n }),
468
466
  /* @__PURE__ */ e(
469
467
  "textarea",
470
468
  {
471
- ref: R,
469
+ ref: S,
472
470
  rows: c,
473
- maxLength: d,
471
+ maxLength: a,
474
472
  value: N.value || "",
475
- placeholder: u,
473
+ placeholder: f,
476
474
  readOnly: b,
477
475
  className: l,
478
476
  style: {
@@ -480,29 +478,29 @@ const ut = q(Be), Ce = ({
480
478
  maxHeight: "400px",
481
479
  overflowY: "auto"
482
480
  },
483
- onChange: (p) => {
484
- O ? r == null || r(p.target.value) : N.onChange(p);
481
+ onChange: (h) => {
482
+ x ? s == null || s(h.target.value) : N.onChange(h);
485
483
  },
486
484
  onInput: i
487
485
  }
488
486
  ),
489
- (s || h) && /* @__PURE__ */ e("p", { className: "text-danger", children: String((s == null ? void 0 : s.message) ?? h) })
487
+ (r || v) && /* @__PURE__ */ e("p", { className: "text-danger", children: String((r == null ? void 0 : r.message) ?? v) })
490
488
  ] });
491
- }, ft = q(Ce);
489
+ }, ft = q(Le);
492
490
  /**
493
491
  * @license lucide-react v0.575.0 - ISC
494
492
  *
495
493
  * This source code is licensed under the ISC license.
496
494
  * See the LICENSE file in the root directory of this source tree.
497
495
  */
498
- const me = (...t) => t.filter((n, u, f) => !!n && n.trim() !== "" && f.indexOf(n) === u).join(" ").trim();
496
+ const me = (...t) => t.filter((n, f, o) => !!n && n.trim() !== "" && o.indexOf(n) === f).join(" ").trim();
499
497
  /**
500
498
  * @license lucide-react v0.575.0 - ISC
501
499
  *
502
500
  * This source code is licensed under the ISC license.
503
501
  * See the LICENSE file in the root directory of this source tree.
504
502
  */
505
- const He = (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();
506
504
  /**
507
505
  * @license lucide-react v0.575.0 - ISC
508
506
  *
@@ -511,7 +509,7 @@ const He = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
511
509
  */
512
510
  const Fe = (t) => t.replace(
513
511
  /^([A-Z])|[\s-_]+(\w)/g,
514
- (n, u, f) => f ? f.toUpperCase() : u.toLowerCase()
512
+ (n, f, o) => o ? o.toUpperCase() : f.toLowerCase()
515
513
  );
516
514
  /**
517
515
  * @license lucide-react v0.575.0 - ISC
@@ -529,7 +527,7 @@ const ie = (t) => {
529
527
  * This source code is licensed under the ISC license.
530
528
  * See the LICENSE file in the root directory of this source tree.
531
529
  */
532
- var Te = {
530
+ var je = {
533
531
  xmlns: "http://www.w3.org/2000/svg",
534
532
  width: 24,
535
533
  height: 24,
@@ -546,7 +544,7 @@ var Te = {
546
544
  * This source code is licensed under the ISC license.
547
545
  * See the LICENSE file in the root directory of this source tree.
548
546
  */
549
- const je = (t) => {
547
+ const Te = (t) => {
550
548
  for (const n in t)
551
549
  if (n.startsWith("aria-") || n === "role" || n === "title")
552
550
  return !0;
@@ -558,32 +556,32 @@ const je = (t) => {
558
556
  * This source code is licensed under the ISC license.
559
557
  * See the LICENSE file in the root directory of this source tree.
560
558
  */
561
- const Pe = de(
559
+ const Pe = oe(
562
560
  ({
563
561
  color: t = "currentColor",
564
562
  size: n = 24,
565
- strokeWidth: u = 2,
566
- absoluteStrokeWidth: f,
563
+ strokeWidth: f = 2,
564
+ absoluteStrokeWidth: o,
567
565
  className: c = "",
568
- children: d,
566
+ children: a,
569
567
  iconNode: m,
570
- ...o
571
- }, g) => se(
568
+ ...d
569
+ }, p) => te(
572
570
  "svg",
573
571
  {
574
- ref: g,
575
- ...Te,
572
+ ref: p,
573
+ ...je,
576
574
  width: n,
577
575
  height: n,
578
576
  stroke: t,
579
- strokeWidth: f ? Number(u) * 24 / Number(n) : u,
577
+ strokeWidth: o ? Number(f) * 24 / Number(n) : f,
580
578
  className: me("lucide", c),
581
- ...!d && !je(o) && { "aria-hidden": "true" },
582
- ...o
579
+ ...!a && !Te(d) && { "aria-hidden": "true" },
580
+ ...d
583
581
  },
584
582
  [
585
- ...m.map(([r, h]) => se(r, h)),
586
- ...Array.isArray(d) ? d : [d]
583
+ ...m.map(([s, v]) => te(s, v)),
584
+ ...Array.isArray(a) ? a : [a]
587
585
  ]
588
586
  )
589
587
  );
@@ -593,20 +591,20 @@ const Pe = de(
593
591
  * This source code is licensed under the ISC license.
594
592
  * See the LICENSE file in the root directory of this source tree.
595
593
  */
596
- const ne = (t, n) => {
597
- const u = de(
598
- ({ className: f, ...c }, d) => se(Pe, {
599
- ref: d,
594
+ const se = (t, n) => {
595
+ const f = oe(
596
+ ({ className: o, ...c }, a) => te(Pe, {
597
+ ref: a,
600
598
  iconNode: n,
601
599
  className: me(
602
- `lucide-${He(ie(t))}`,
600
+ `lucide-${Ce(ie(t))}`,
603
601
  `lucide-${t}`,
604
- f
602
+ o
605
603
  ),
606
604
  ...c
607
605
  })
608
606
  );
609
- return u.displayName = ie(t), u;
607
+ return f.displayName = ie(t), f;
610
608
  };
611
609
  /**
612
610
  * @license lucide-react v0.575.0 - ISC
@@ -614,28 +612,28 @@ const ne = (t, n) => {
614
612
  * This source code is licensed under the ISC license.
615
613
  * See the LICENSE file in the root directory of this source tree.
616
614
  */
617
- const ze = [
615
+ const Ue = [
618
616
  ["path", { d: "M8 2v4", key: "1cmpym" }],
619
617
  ["path", { d: "M16 2v4", key: "4m81vk" }],
620
618
  ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
621
619
  ["path", { d: "M3 10h18", key: "8toen8" }]
622
- ], Ue = ne("calendar", ze);
620
+ ], Ye = se("calendar", Ue);
623
621
  /**
624
622
  * @license lucide-react v0.575.0 - ISC
625
623
  *
626
624
  * This source code is licensed under the ISC license.
627
625
  * See the LICENSE file in the root directory of this source tree.
628
626
  */
629
- const We = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]], Ye = ne("chevron-left", We);
627
+ const Je = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]], We = se("chevron-left", Je);
630
628
  /**
631
629
  * @license lucide-react v0.575.0 - ISC
632
630
  *
633
631
  * This source code is licensed under the ISC license.
634
632
  * See the LICENSE file in the root directory of this source tree.
635
633
  */
636
- const Je = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]], qe = ne("chevron-right", Je), he = "dd/MM/yyyy", le = (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) => {
637
635
  if (!t) return null;
638
- const n = Ae(t, he, /* @__PURE__ */ new Date());
636
+ const n = xe(t, he, /* @__PURE__ */ new Date());
639
637
  return ue(n) ? n : null;
640
638
  }, Ge = (t) => t ? fe(t, he) : "", Qe = [
641
639
  { value: 0, label: "Janeiro" },
@@ -651,98 +649,98 @@ const Je = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]], qe = ne("chevron-r
651
649
  { value: 10, label: "Novembro" },
652
650
  { value: 11, label: "Dezembro" }
653
651
  ], 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) };
652
+ const f = ce + n;
653
+ return { value: f, label: String(f) };
656
654
  });
657
655
  function Ke({
658
656
  name: t,
659
657
  label: n = "",
660
- placeholder: u = "dd/mm/aaaa",
661
- className: f = "",
658
+ placeholder: f = "dd/mm/aaaa",
659
+ className: o = "",
662
660
  forceReadOnly: c = !1,
663
- forceHidden: d = !1,
661
+ forceHidden: a = !1,
664
662
  valueManual: m,
665
- onChangeManual: o,
666
- errorManual: g
663
+ onChangeManual: d,
664
+ errorManual: p
667
665
  }) {
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 = () => {
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 = () => {
672
670
  };
673
- if (r)
671
+ if (s)
674
672
  _ = m;
675
673
  else
676
674
  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;
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;
679
677
  } catch {
680
678
  }
681
- const [i, l] = z(!1), [a, p] = z(/* @__PURE__ */ new Date()), V = te(null);
682
- T(() => {
679
+ const [i, l] = Y(!1), [u, h] = Y(/* @__PURE__ */ new Date()), E = ee(null);
680
+ P(() => {
683
681
  if (i) {
684
- const y = le(_);
685
- p(y && ue(y) ? y : /* @__PURE__ */ new Date());
682
+ const g = le(_);
683
+ h(g && ue(g) ? g : /* @__PURE__ */ new Date());
686
684
  }
687
- }, [i, _]), T(() => {
688
- const y = (E) => {
689
- V.current && !V.current.contains(E.target) && l(!1);
685
+ }, [i, _]), P(() => {
686
+ const g = (D) => {
687
+ E.current && !E.current.contains(D.target) && l(!1);
690
688
  };
691
- return document.addEventListener("mousedown", y), () => document.removeEventListener("mousedown", y);
689
+ return document.addEventListener("mousedown", g), () => document.removeEventListener("mousedown", g);
692
690
  }, []);
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: [
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: [
702
700
  /* @__PURE__ */ e("label", { className: "control-label", children: n }),
703
701
  b ? /* @__PURE__ */ e("span", { className: "form-control", children: _ || "-" }) : (
704
702
  /* Container isolador de contexto posicional */
705
- /* @__PURE__ */ v("div", { className: "dfe-datepicker-inner-container", children: [
706
- /* @__PURE__ */ v(
703
+ /* @__PURE__ */ y("div", { className: "dfe-datepicker-inner-container", children: [
704
+ /* @__PURE__ */ y(
707
705
  "div",
708
706
  {
709
- className: `dfe-datepicker-control ${N ? "border-red" : ""} ${A ? "readOnly" : ""}`,
710
- onClick: () => !A && l((y) => !y),
711
- ref: R,
707
+ className: `dfe-datepicker-control ${N ? "border-red" : ""} ${I ? "readOnly" : ""}`,
708
+ onClick: () => !I && l((g) => !g),
709
+ ref: S,
712
710
  children: [
713
- /* @__PURE__ */ e("span", { className: `dfe-datepicker-display ${A ? "readOnly" : ""}`, children: _ || u }),
714
- /* @__PURE__ */ e(Ue, { size: 16, className: "dfe-datepicker-icon" })
711
+ /* @__PURE__ */ e("span", { className: `dfe-datepicker-display ${I ? "readOnly" : ""}`, children: _ || f }),
712
+ /* @__PURE__ */ e(Ye, { size: 16, className: "dfe-datepicker-icon" })
715
713
  ]
716
714
  }
717
715
  ),
718
- i && !A && /* @__PURE__ */ v("div", { className: "dfe-datepicker-dropdown", onClick: (y) => y.stopPropagation(), children: [
719
- /* @__PURE__ */ v("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: [
720
718
  /* @__PURE__ */ e(
721
719
  "button",
722
720
  {
723
721
  type: "button",
724
- onClick: () => p(we(a, 1)),
722
+ onClick: () => h(we(u, 1)),
725
723
  className: "dfe-datepicker-nav-btn",
726
- children: /* @__PURE__ */ e(Ye, { size: 16 })
724
+ children: /* @__PURE__ */ e(We, { size: 16 })
727
725
  }
728
726
  ),
729
- /* @__PURE__ */ v("div", { className: "dfe-datepicker-selectors", children: [
727
+ /* @__PURE__ */ y("div", { className: "dfe-datepicker-selectors", children: [
730
728
  /* @__PURE__ */ e(
731
- re,
729
+ ne,
732
730
  {
733
731
  name: "datepicker_internal_month",
734
- valueManual: w,
735
- onChangeManual: (y) => p(xe(a, Number(y))),
732
+ valueManual: $,
733
+ onChangeManual: (g) => h($e(u, Number(g))),
736
734
  options: Qe,
737
735
  placeholder: "Mês"
738
736
  }
739
737
  ),
740
738
  /* @__PURE__ */ e(
741
- re,
739
+ ne,
742
740
  {
743
741
  name: "datepicker_internal_year",
744
742
  valueManual: k,
745
- onChangeManual: (y) => p(Se(a, Number(y))),
743
+ onChangeManual: (g) => h(Oe(u, Number(g))),
746
744
  options: Xe,
747
745
  enableSearch: !0,
748
746
  searchPlaceholder: "Buscar ano...",
@@ -754,55 +752,55 @@ function Ke({
754
752
  "button",
755
753
  {
756
754
  type: "button",
757
- onClick: () => p(_e(a, 1)),
755
+ onClick: () => h(_e(u, 1)),
758
756
  className: "dfe-datepicker-nav-btn",
759
757
  children: /* @__PURE__ */ e(qe, { size: 16 })
760
758
  }
761
759
  )
762
760
  ] }),
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);
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);
766
764
  return /* @__PURE__ */ e(
767
765
  "div",
768
766
  {
769
- onClick: () => !H && I(y),
767
+ onClick: () => !j && V(g),
770
768
  className: `dfe-datepicker-day
771
- ${J ? "selected" : "handleHover"}
772
- ${H ? "outside" : ""}
773
- ${$e(y) ? "today" : ""}`,
774
- children: fe(y, "d")
769
+ ${X ? "selected" : "handleHover"}
770
+ ${j ? "outside" : ""}
771
+ ${Ae(g) ? "today" : ""}`,
772
+ children: fe(g, "d")
775
773
  },
776
- E
774
+ D
777
775
  );
778
776
  }) })
779
777
  ] })
780
778
  ] })
781
779
  ),
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) })
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) })
784
782
  ] });
785
783
  }
786
784
  const mt = q(Ke);
787
785
  function Me({
788
786
  mapping: t = {},
789
787
  defaultLabel: n = "Não reconhecido",
790
- className: u = "",
791
- hidden: f = !1,
788
+ className: f = "",
789
+ hidden: o = !1,
792
790
  label: c
793
791
  }) {
794
- const { activityId: d } = Y(), m = U(() => !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]);
795
793
  if (!m)
796
- return /* @__PURE__ */ v("div", { className: `form-group ${f ? "hidden" : ""}`, children: [
794
+ return /* @__PURE__ */ y("div", { className: `form-group ${o ? "hidden" : ""}`, children: [
797
795
  c && /* @__PURE__ */ e("label", { children: c }),
798
- /* @__PURE__ */ e("div", { className: `status-badge default ${u}`, children: n })
796
+ /* @__PURE__ */ e("div", { className: `status-badge default ${f}`, children: n })
799
797
  ] });
800
- const o = {
798
+ const d = {
801
799
  "--customColor": m.color
802
800
  };
803
- return /* @__PURE__ */ v("div", { className: `form-group ${f ? "hidden" : ""}`, children: [
801
+ return /* @__PURE__ */ y("div", { className: `form-group ${o ? "hidden" : ""}`, children: [
804
802
  c && /* @__PURE__ */ e("label", { children: c }),
805
- /* @__PURE__ */ v("div", { className: `status-badge ${u}`, style: o, children: [
803
+ /* @__PURE__ */ y("div", { className: `status-badge ${f}`, style: d, children: [
806
804
  m.icon && /* @__PURE__ */ e("i", { className: m.icon }),
807
805
  /* @__PURE__ */ e("span", { children: m.label })
808
806
  ] })
@@ -812,116 +810,116 @@ const ht = q(Me);
812
810
  function et({
813
811
  name: t,
814
812
  control: n,
815
- defaultRowValue: u,
816
- isView: f,
813
+ defaultRowValue: f,
814
+ isView: o,
817
815
  isReadOnly: c,
818
- filters: d = []
816
+ filters: a = []
819
817
  }) {
820
- const { field: m } = Z({ name: t, control: n }), [o, g] = z([]), [r, h] = z([]), O = () => Date.now() + Math.random(), A = (i) => {
818
+ const { field: m } = Z({ name: t, control: n }), [d, p] = Y([]), [s, v] = Y([]), x = () => Date.now() + Math.random(), I = (i) => {
821
819
  try {
822
820
  const l = JSON.parse(i);
823
- return Array.isArray(l) ? l.map((a) => ({
824
- ...a,
825
- _uid: a._uid || O()
821
+ return Array.isArray(l) ? l.map((u) => ({
822
+ ...u,
823
+ _uid: u._uid || x()
826
824
  })) : [];
827
825
  } catch (l) {
828
826
  return console.error(`Erro ao ler dados da tabela "${t}":`, l), [];
829
827
  }
830
828
  };
831
- T(() => {
832
- if (!(o.length > 0 && !f) && m.value && typeof m.value == "string") {
833
- const i = JSON.stringify(o);
829
+ P(() => {
830
+ if (!(d.length > 0 && !o) && m.value && typeof m.value == "string") {
831
+ const i = JSON.stringify(d);
834
832
  if (m.value === i) return;
835
- const l = A(m.value);
836
- g(l);
833
+ const l = I(m.value);
834
+ p(l);
837
835
  }
838
- }, [m.value, f]), T(() => {
836
+ }, [m.value, o]), P(() => {
839
837
  if (c) return;
840
- const i = JSON.stringify(o);
838
+ const i = JSON.stringify(d);
841
839
  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(
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(
853
851
  (i) => {
854
- h(i ? o.map((l) => l._uid) : []);
852
+ v(i ? d.map((l) => l._uid) : []);
855
853
  },
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) => {
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) => {
859
857
  if ("custom" in l)
860
858
  return l.custom(i);
861
- const a = i[l.field];
859
+ const u = i[l.field];
862
860
  switch (l.operator) {
863
861
  case "===":
864
- return a === l.value;
862
+ return u === l.value;
865
863
  case "!==":
866
- return a !== l.value;
864
+ return u !== l.value;
867
865
  case ">":
868
- return a > l.value;
866
+ return u > l.value;
869
867
  case "<":
870
- return a < l.value;
868
+ return u < l.value;
871
869
  case ">=":
872
- return a >= l.value;
870
+ return u >= l.value;
873
871
  case "<=":
874
- return a <= l.value;
872
+ return u <= l.value;
875
873
  default:
876
874
  return !0;
877
875
  }
878
876
  })
879
- ), [o, d]);
877
+ ), [d, a]);
880
878
  return {
881
879
  field: m,
882
- tableRows: o,
883
- visibleRows: s,
884
- selectedRowIds: r,
880
+ tableRows: d,
881
+ visibleRows: r,
882
+ selectedRowIds: s,
885
883
  isAllSelected: N,
886
884
  handle: {
887
- addRow: B,
885
+ addRow: F,
888
886
  removeRows: b,
889
887
  updateCellValue: _,
890
- toggleSelection: $,
891
- toggleSelectAll: R
888
+ toggleSelection: R,
889
+ toggleSelectAll: S
892
890
  }
893
891
  };
894
892
  }
895
893
  const pt = ({
896
894
  name: t,
897
895
  title: n = "Tabela Dinâmica",
898
- columns: u,
899
- defaultRowValue: f = {},
896
+ columns: f,
897
+ defaultRowValue: o = {},
900
898
  forceReadOnly: c = !1,
901
- layout: d = "fluid",
899
+ layout: a = "fluid",
902
900
  actions: m = !0,
903
- filters: o = []
901
+ filters: d = []
904
902
  }) => {
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({
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({
906
904
  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: [
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: [
916
914
  /* @__PURE__ */ e("h3", { children: n }),
917
- !A && m && /* @__PURE__ */ v("div", { className: "handle-actions", children: [
918
- /* @__PURE__ */ v(
915
+ !I && m && /* @__PURE__ */ y("div", { className: "handle-actions", children: [
916
+ /* @__PURE__ */ y(
919
917
  "button",
920
918
  {
921
919
  type: "button",
922
920
  className: `btn ${_.length > 0 ? "btn-danger" : "btn-primary"}`,
923
921
  disabled: _.length === 0,
924
- onClick: R.removeRows,
922
+ onClick: S.removeRows,
925
923
  children: [
926
924
  "Remover (",
927
925
  _.length,
@@ -929,197 +927,197 @@ const pt = ({
929
927
  ]
930
928
  }
931
929
  ),
932
- /* @__PURE__ */ e("button", { type: "button", className: "btn-add", onClick: R.addRow, children: "Adicionar" })
930
+ /* @__PURE__ */ e("button", { type: "button", className: "btn-add", onClick: S.addRow, children: "Adicionar" })
933
931
  ] })
934
932
  ] }),
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(
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(
938
936
  "input",
939
937
  {
940
938
  type: "checkbox",
941
- checked: $,
942
- onChange: (s) => R.toggleSelectAll(s.target.checked)
939
+ checked: R,
940
+ onChange: (r) => S.toggleSelectAll(r.target.checked)
943
941
  }
944
942
  ) }),
945
- u.map((s) => /* @__PURE__ */ e(
943
+ f.map((r) => /* @__PURE__ */ e(
946
944
  "th",
947
945
  {
948
- style: s.width ? { minWidth: N ? s.width : "100%" } : { width: "max-content" },
949
- children: s.label
946
+ style: r.width ? { minWidth: N ? r.width : "100%" } : { width: "max-content" },
947
+ children: r.label
950
948
  },
951
- String(s.key)
949
+ String(r.key)
952
950
  ))
953
951
  ] }) }),
954
- /* @__PURE__ */ v("tbody", { children: [
955
- b.map((s, i) => /* @__PURE__ */ v("tr", { children: [
956
- !A && /* @__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(
957
955
  "input",
958
956
  {
959
957
  type: "checkbox",
960
- checked: _.includes(s._uid),
961
- onChange: () => R.toggleSelection(s._uid)
958
+ checked: _.includes(r._uid),
959
+ onChange: () => S.toggleSelection(r._uid)
962
960
  }
963
961
  ) }),
964
- u.map((l) => /* @__PURE__ */ e("td", { children: l.render ? l.render.length <= 1 ? l.render({
965
- row: s,
962
+ f.map((l) => /* @__PURE__ */ e("td", { children: l.render ? l.render.length <= 1 ? l.render({
963
+ row: r,
966
964
  index: i,
967
- updateRow: (a, p) => R.updateCellValue(s._uid, String(a), p),
968
- isLocked: !!A,
969
- isView: !!r
965
+ updateRow: (u, h) => S.updateCellValue(r._uid, String(u), h),
966
+ isLocked: !!I,
967
+ isView: !!s
970
968
  }) : l.render(
971
- s,
969
+ r,
972
970
  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." }) })
971
+ (u, h) => S.updateCellValue(r._uid, u, h),
972
+ !!I,
973
+ !!s
974
+ ) : r[l.key] }, `${r._uid}-${String(l.key)}`))
975
+ ] }, r._uid)),
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." }) })
979
977
  ] })
980
978
  ] }) })
981
979
  ] });
982
980
  }, tt = (t, n) => {
983
- const [u, f] = z(null);
981
+ const [f, o] = Y(null);
984
982
  let c = null;
985
983
  try {
986
984
  c = W().watch;
987
985
  } catch {
988
986
  }
989
- const d = n !== void 0 ? n : c ? c(t) : void 0, m = P(() => {
987
+ const a = n !== void 0 ? n : c ? c(t) : void 0, m = U(() => {
990
988
  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));
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));
995
993
  } else
996
- f(d ? { name: d, documentId: 0 } : null);
994
+ o(a ? { name: a, documentId: 0 } : null);
997
995
  } catch {
998
- f(d ? { name: d, documentId: 0 } : null);
996
+ o(a ? { name: a, documentId: 0 } : null);
999
997
  }
1000
- }, [t, d, n]);
1001
- return T(() => {
998
+ }, [t, a, n]);
999
+ return P(() => {
1002
1000
  m();
1003
- const o = setInterval(m, 2e3);
1004
- return () => clearInterval(o);
1005
- }, [m]), { attachment: u, sync: m };
1001
+ const d = setInterval(m, 2e3);
1002
+ return () => clearInterval(d);
1003
+ }, [m]), { attachment: f, sync: m };
1006
1004
  }, st = ({
1007
1005
  name: t,
1008
1006
  label: n,
1009
- help: u,
1010
- valueManual: f,
1007
+ help: f,
1008
+ valueManual: o,
1011
1009
  onChangeManual: c,
1012
- forceReadOnly: d = !1,
1010
+ forceReadOnly: a = !1,
1013
1011
  forceHidden: m = !1,
1014
- helpText: o,
1015
- helpTitle: g,
1016
- helpWidth: r
1012
+ helpText: d,
1013
+ helpTitle: p,
1014
+ helpWidth: s
1017
1015
  }) => {
1018
- const h = !!c, { isReadOnly: O, isHidden: A } = G(), { isView: B } = Y(), b = d || B || !!O(t), _ = m || !!A(t), [$, R] = z(!1);
1016
+ const v = !!c, { isReadOnly: x, isHidden: I } = G(), { isView: F } = z(), b = a || F || !!x(t), _ = m || !!I(t), [R, S] = Y(!1);
1019
1017
  let N = null;
1020
1018
  try {
1021
1019
  N = W().control;
1022
1020
  } catch {
1023
1021
  }
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;
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 $;
1029
1027
  try {
1030
1028
  const k = window.top;
1031
1029
  return {
1032
1030
  bridge: k.__REACT_ATTACHMENT_BRIDGE__,
1033
- toast: (w = k.FLUIGC) == null ? void 0 : w.toast
1031
+ toast: ($ = k.FLUIGC) == null ? void 0 : $.toast
1034
1032
  };
1035
1033
  } catch {
1036
1034
  return { bridge: null, toast: null };
1037
1035
  }
1038
- }, p = P(() => {
1036
+ }, h = U(() => {
1039
1037
  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(() => {
1047
- R(!1), l();
1048
- }, 1e3), E && E({
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();
1046
+ }, 1e3), D && D({
1049
1047
  title: "Sucesso",
1050
1048
  message: "Arquivo enviado",
1051
1049
  type: "success"
1052
1050
  });
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;
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;
1058
1056
  if (!k) return;
1059
- const { bridge: D, toast: y } = a();
1060
- D ? D.removeByFileName(k) ? (h ? c == null || c("") : s.onChange(""), l()) : y && y({
1057
+ const { bridge: B, toast: g } = u();
1058
+ B ? B.removeByFileName(k) ? (v ? c == null || c("") : r.onChange(""), l()) : g && g({
1061
1059
  title: "Erro",
1062
1060
  message: "Erro ao remover anexo",
1063
1061
  type: "danger"
1064
- }) : (h ? c == null || c("") : s.onChange(""), l());
1065
- }, L = !!i && !$, I = (i == null ? void 0 : i.name) || f || s.value, x = [
1062
+ }) : (v ? c == null || c("") : r.onChange(""), l());
1063
+ }, H = !!i && !R, V = (i == null ? void 0 : i.name) || o || r.value, O = [
1066
1064
  "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" : ""
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" : ""
1071
1069
  ].join(" ");
1072
- return _ ? null : /* @__PURE__ */ v("div", { className: "form-group fluig-attachment", children: [
1070
+ return _ ? null : /* @__PURE__ */ y("div", { className: "form-group fluig-attachment", children: [
1073
1071
  n && /* @__PURE__ */ e("label", { className: "fluig-attachment__label", children: n }),
1074
- /* @__PURE__ */ v("div", { className: o ? "dfe-flex-input-wrapper" : "", children: [
1075
- /* @__PURE__ */ v(
1072
+ /* @__PURE__ */ y("div", { className: d ? "dfe-flex-input-wrapper" : "", children: [
1073
+ /* @__PURE__ */ y(
1076
1074
  "div",
1077
1075
  {
1078
- className: x,
1079
- style: o ? { flex: 1 } : void 0,
1076
+ className: O,
1077
+ style: d ? { flex: 1 } : void 0,
1080
1078
  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);
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);
1084
1082
  } else
1085
- p();
1083
+ h();
1086
1084
  },
1087
1085
  children: [
1088
- /* @__PURE__ */ v("span", { className: "fluig-attachment__content", children: [
1086
+ /* @__PURE__ */ y("span", { className: "fluig-attachment__content", children: [
1089
1087
  /* @__PURE__ */ e(
1090
1088
  "i",
1091
1089
  {
1092
- className: `flaticon icon-sm ${$ ? "flaticon-loading" : L ? "flaticon-file" : "flaticon-paperclip"} fluig-attachment__icon`
1090
+ className: `flaticon icon-sm ${R ? "flaticon-loading" : H ? "flaticon-file" : "flaticon-paperclip"} fluig-attachment__icon`
1093
1091
  }
1094
1092
  ),
1095
- /* @__PURE__ */ e("span", { className: "fluig-attachment__filename", children: $ ? " Enviando..." : L ? I : b ? "Nenhum arquivo" : u || "Anexar" })
1093
+ /* @__PURE__ */ e("span", { className: "fluig-attachment__filename", children: R ? " Enviando..." : H ? V : b ? "Nenhum arquivo" : f || "Anexar" })
1096
1094
  ] }),
1097
- L && !b && /* @__PURE__ */ e(
1095
+ H && !b && /* @__PURE__ */ e(
1098
1096
  "button",
1099
1097
  {
1100
1098
  type: "button",
1101
1099
  className: "fluig-attachment__btn-remove btn btn-link text-danger",
1102
- onClick: V,
1100
+ onClick: E,
1103
1101
  children: /* @__PURE__ */ e("i", { className: "flaticon flaticon-trash icon-sm" })
1104
1102
  }
1105
1103
  )
1106
1104
  ]
1107
1105
  }
1108
1106
  ),
1109
- o && /* @__PURE__ */ e(ee, { text: o, title: g, width: r })
1107
+ d && /* @__PURE__ */ e(M, { text: d, title: p, width: s })
1110
1108
  ] }),
1111
- !h && N && /* @__PURE__ */ e("input", { type: "hidden", name: t, value: s.value || "" })
1109
+ !v && N && /* @__PURE__ */ e("input", { type: "hidden", name: t, value: r.value || "" })
1112
1110
  ] });
1113
1111
  }, vt = q(st);
1114
1112
  export {
1115
1113
  vt as Attachment,
1116
1114
  at as Checkbox,
1117
1115
  mt as DatePicker,
1118
- ee as Help,
1119
- dt as Input,
1116
+ M as Help,
1117
+ ot as Input,
1120
1118
  Ie as Modal,
1121
1119
  ut as RadioBtn,
1122
- re as Select,
1120
+ ne as Select,
1123
1121
  pt as SimpleTable,
1124
1122
  ht as StatusBadge,
1125
1123
  ft as TextArea