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