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