diefra_ecm_ui 1.2.3 → 1.2.5

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