diefra_ecm_ui 1.2.5 → 1.2.6

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