diefra_ecm_ui 1.2.5 → 1.2.7

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