diefra_ecm_ui 1.0.2 → 1.0.4

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,8 +1,8 @@
1
- import { jsxs as N, jsx as r, Fragment as ce } from "react/jsx-runtime";
2
- import { memo as z, useMemo as B, useCallback as C, useState as L, useRef as G, useEffect as E, forwardRef as se, createElement as Z } from "react";
3
- import { useFormContext as H, useController as X, useFormState as de } from "react-hook-form";
1
+ import { jsxs as x, jsx as r, Fragment as de } from "react/jsx-runtime";
2
+ import { memo as z, useMemo as B, useCallback as C, useState as F, useRef as G, useEffect as E, forwardRef as se, createElement as Z } from "react";
3
+ import { useFormContext as H, useController as X, useFormState as ce } from "react-hook-form";
4
4
  import { IMaskInput as le } from "react-imask";
5
- import { useSection as F, useFluigRuntime as I } from "@fluig-kit/ecm";
5
+ import { useSection as I, useFluigRuntime as L } from "@fluig-kit/ecm";
6
6
  import { parse as ue, isValid as me, eachDayOfInterval as he, endOfWeek as fe, endOfMonth as pe, startOfWeek as ye, startOfMonth as ve, subMonths as ge, format as K, addMonths as be, isSameMonth as we, isSameDay as Ne, isToday as ke } from "date-fns";
7
7
  const xe = {
8
8
  cpf: "000.000.000-00",
@@ -10,66 +10,66 @@ const xe = {
10
10
  telefone: "(00) 00000-0000",
11
11
  cep: "00000-000"
12
12
  };
13
- function Re({
13
+ function Se({
14
14
  name: e,
15
15
  label: t = "",
16
16
  placeholder: n = "",
17
17
  type: i = "text",
18
18
  mask: s,
19
- className: d = "",
19
+ className: c = "",
20
20
  forceReadOnly: l = !1,
21
21
  forceHidden: o = !1,
22
22
  valueManual: v,
23
23
  onChangeManual: a,
24
- errorManual: p
24
+ errorManual: w
25
25
  }) {
26
- var S, O;
27
- const g = v !== void 0 && !!a, { isReadOnly: $, isHidden: V } = F(), A = l || !!$(e), _ = o || !!V(e), { isView: W } = I();
28
- let w = null;
26
+ var $, A;
27
+ const p = v !== void 0 && !!a, { isReadOnly: V, isHidden: D } = I(), _ = l || !!V(e), P = o || !!D(e), { isView: W } = L();
28
+ let h = null;
29
29
  try {
30
- w = H();
30
+ h = H();
31
31
  } catch {
32
32
  }
33
- const f = !g && w ? X({ name: e, control: w.control }) : null, u = !g && w ? de({ name: e }) : null, m = g ? v : f == null ? void 0 : f.field.value, c = g ? p : (O = (S = u == null ? void 0 : u.errors) == null ? void 0 : S[e]) == null ? void 0 : O.message, h = B(
33
+ const y = !p && h ? X({ name: e, control: h.control }) : null, u = !p && h ? ce({ name: e }) : null, m = p ? v : y == null ? void 0 : y.field.value, d = p ? w : (A = ($ = u == null ? void 0 : u.errors) == null ? void 0 : $[e]) == null ? void 0 : A.message, f = B(
34
34
  () => s ? xe[s] ?? s : null,
35
35
  [s]
36
- ), y = C((b) => {
36
+ ), g = C((b) => {
37
37
  if (!b) return "";
38
- const T = b.replace(/\D/g, "");
39
- return (Number(T) / 100).toLocaleString("pt-BR", {
38
+ const j = b.replace(/\D/g, "");
39
+ return (Number(j) / 100).toLocaleString("pt-BR", {
40
40
  style: "currency",
41
41
  currency: "BRL"
42
42
  });
43
- }, []), x = C(
44
- (b) => i === "monetary" ? y(b) : b,
45
- [i, y]
46
- ), D = (b) => {
47
- const T = x(b);
48
- g ? a == null || a(T) : f == null || f.field.onChange(T);
49
- }, R = () => {
50
- g || f == null || f.field.onBlur();
43
+ }, []), S = C(
44
+ (b) => i === "monetary" ? g(b) : b,
45
+ [i, g]
46
+ ), N = (b) => {
47
+ const j = S(b);
48
+ p ? a == null || a(j) : y == null || y.field.onChange(j);
49
+ }, O = () => {
50
+ p || y == null || y.field.onBlur();
51
51
  };
52
52
  if (W)
53
- return /* @__PURE__ */ N("div", { className: "form-group", children: [
53
+ return /* @__PURE__ */ x("div", { className: "form-group", children: [
54
54
  /* @__PURE__ */ r("label", { children: t }),
55
55
  /* @__PURE__ */ r("span", { className: "form-control", children: m || "-" })
56
56
  ] });
57
- const k = `form-control ${A ? "readOnly" : ""} ${c ? "border-red" : ""} ${d}`;
58
- return /* @__PURE__ */ N("div", { className: `form-group ${_ ? "hidden" : ""}`, children: [
57
+ const k = `form-control ${_ ? "readOnly" : ""} ${d ? "border-red" : ""} ${c}`;
58
+ return /* @__PURE__ */ x("div", { className: `form-group ${P ? "hidden" : ""}`, children: [
59
59
  t && /* @__PURE__ */ r("label", { children: t }),
60
- h ? /* @__PURE__ */ r(
60
+ f ? /* @__PURE__ */ r(
61
61
  le,
62
62
  {
63
63
  name: e,
64
- mask: h,
64
+ mask: f,
65
65
  value: String(m ?? ""),
66
66
  unmask: !1,
67
- onAccept: (b) => D(b),
67
+ onAccept: (b) => N(b),
68
68
  placeholder: n,
69
- readOnly: A,
69
+ readOnly: _,
70
70
  className: k,
71
- inputRef: g || f == null ? void 0 : f.field.ref,
72
- onBlur: R
71
+ inputRef: p || y == null ? void 0 : y.field.ref,
72
+ onBlur: O
73
73
  }
74
74
  ) : /* @__PURE__ */ r(
75
75
  "input",
@@ -77,204 +77,204 @@ function Re({
77
77
  type: "text",
78
78
  name: e,
79
79
  value: m ?? "",
80
- onChange: (b) => D(b.target.value),
81
- onBlur: R,
80
+ onChange: (b) => N(b.target.value),
81
+ onBlur: O,
82
82
  placeholder: n,
83
- readOnly: A,
83
+ readOnly: _,
84
84
  className: k
85
85
  }
86
86
  ),
87
- c && /* @__PURE__ */ r("p", { className: "text-danger", children: String(c) })
87
+ d && /* @__PURE__ */ r("p", { className: "text-danger", children: String(d) })
88
88
  ] });
89
89
  }
90
- const Dt = z(Re);
91
- function Se({
90
+ const Vt = z(Se);
91
+ function Re({
92
92
  name: e,
93
93
  label: t = "",
94
94
  options: n = [],
95
95
  placeholder: i = "",
96
96
  labelKey: s = "label",
97
- valueKey: d = "value",
97
+ valueKey: c = "value",
98
98
  enableSearch: l = !1,
99
99
  searchPlaceholder: o = "Buscar...",
100
100
  loading: v = !1,
101
101
  onSearchChange: a,
102
- debounceTime: p = 300,
103
- onSelect: g,
104
- forceReadOnly: $ = !1,
105
- forceHidden: V = !1,
106
- valueManual: A,
107
- onChangeManual: _,
102
+ debounceTime: w = 300,
103
+ onSelect: p,
104
+ forceReadOnly: V = !1,
105
+ forceHidden: D = !1,
106
+ valueManual: _,
107
+ onChangeManual: P,
108
108
  errorManual: W
109
109
  }) {
110
110
  var ne;
111
- const w = A !== void 0 && !!_, { isReadOnly: f, isHidden: u } = F(), m = $ || !!f(e), c = V || !!u(e), { isView: h } = I();
112
- let y = "", x = () => {
113
- }, D, R = null, k = () => {
111
+ const h = _ !== void 0 && !!P, { isReadOnly: y, isHidden: u } = I(), m = V || !!y(e), d = D || !!u(e), { isView: f } = L();
112
+ let g = "", S = () => {
113
+ }, N, O = null, k = () => {
114
114
  };
115
- if (w)
116
- y = A;
115
+ if (h)
116
+ g = _;
117
117
  else
118
118
  try {
119
- const P = H(), j = X({ name: e, control: P.control });
120
- y = j.field.value, x = j.field.onChange, D = j.field.ref, R = (ne = j.fieldState) == null ? void 0 : ne.error, k = P.clearErrors;
119
+ const R = H(), T = X({ name: e, control: R.control });
120
+ g = T.field.value, S = T.field.onChange, N = T.field.ref, O = (ne = T.fieldState) == null ? void 0 : ne.error, k = R.clearErrors;
121
121
  } catch {
122
122
  }
123
- const [S, O] = L(!1), [b, T] = L(""), q = G(null), U = G(a);
123
+ const [$, A] = F(!1), [b, j] = F(""), q = G(null), U = G(a);
124
124
  E(() => {
125
125
  U.current = a;
126
126
  }, [a]), E(() => {
127
- const P = (j) => {
128
- q.current && !q.current.contains(j.target) && O(!1);
127
+ const R = (T) => {
128
+ q.current && !q.current.contains(T.target) && A(!1);
129
129
  };
130
- return document.addEventListener("mousedown", P), () => document.removeEventListener("mousedown", P);
130
+ return document.addEventListener("mousedown", R), () => document.removeEventListener("mousedown", R);
131
131
  }, []), E(() => {
132
- S || T("");
133
- }, [S]), E(() => {
132
+ $ || j("");
133
+ }, [$]), E(() => {
134
134
  if (!l) return;
135
- const P = setTimeout(() => {
136
- var j;
137
- (j = U.current) == null || j.call(U, b);
138
- }, p);
139
- return () => clearTimeout(P);
140
- }, [b, l, p]);
135
+ const R = setTimeout(() => {
136
+ var T;
137
+ (T = U.current) == null || T.call(U, b);
138
+ }, w);
139
+ return () => clearTimeout(R);
140
+ }, [b, l, w]);
141
141
  const ee = B(() => l && !a && b.trim() ? n.filter(
142
- (P) => String((P == null ? void 0 : P[s]) ?? "").toLowerCase().includes(b.toLowerCase())
142
+ (R) => String((R == null ? void 0 : R[s]) ?? "").toLowerCase().includes(b.toLowerCase())
143
143
  ) : n ?? [], [n, l, a, b, s]), te = B(() => {
144
- if (y == null) return "";
145
- if (typeof y == "object")
146
- return String(y[d] ?? "");
147
- const P = (n || []).find(
148
- (j) => String(j == null ? void 0 : j[d]) === String(y)
144
+ if (g == null) return "";
145
+ if (typeof g == "object")
146
+ return String(g[c] ?? "");
147
+ const R = (n || []).find(
148
+ (T) => String(T == null ? void 0 : T[c]) === String(g)
149
149
  );
150
- return String(P ? (P == null ? void 0 : P[s]) ?? "" : y);
151
- }, [y, n, d, s]), oe = (P) => {
152
- m || (w ? _ == null || _(P[d]) : (x(P[d]), k == null || k(e)), g == null || g(P), O(!1));
150
+ return String(R ? (R == null ? void 0 : R[s]) ?? "" : g);
151
+ }, [g, n, c, s]), oe = (R) => {
152
+ m || (h ? P == null || P(R[c]) : (S(R[c]), k == null || k(e)), p == null || p(R), A(!1));
153
153
  };
154
- return /* @__PURE__ */ N(
154
+ return /* @__PURE__ */ x(
155
155
  "div",
156
156
  {
157
- className: `select-wrapper form-group ${c ? "hidden" : ""}`,
157
+ className: `select-wrapper form-group ${d ? "hidden" : ""}`,
158
158
  ref: q,
159
159
  children: [
160
160
  /* @__PURE__ */ r("label", { className: "control-label", children: t }),
161
- h ? /* @__PURE__ */ r("span", { className: "form-control", children: te || "-" }) : /* @__PURE__ */ N(ce, { children: [
162
- /* @__PURE__ */ N(
161
+ f ? /* @__PURE__ */ r("span", { className: "form-control", children: te || "-" }) : /* @__PURE__ */ x(de, { children: [
162
+ /* @__PURE__ */ x(
163
163
  "div",
164
164
  {
165
- className: `select-control ${R ? "border-red" : ""} ${m ? "readOnly" : ""}`,
166
- onClick: () => !m && O((P) => !P),
167
- ref: D,
165
+ className: `select-control ${O ? "border-red" : ""} ${m ? "readOnly" : ""}`,
166
+ onClick: () => !m && A((R) => !R),
167
+ ref: N,
168
168
  children: [
169
169
  /* @__PURE__ */ r("span", { className: `select-display ${m ? "readOnly" : ""}`, children: te || i }),
170
170
  /* @__PURE__ */ r("i", { className: "flaticon flaticon-chevron-down select-icon" })
171
171
  ]
172
172
  }
173
173
  ),
174
- S && !m && /* @__PURE__ */ N("div", { className: "select-dropdown", children: [
174
+ $ && !m && /* @__PURE__ */ x("div", { className: "select-dropdown", children: [
175
175
  l && /* @__PURE__ */ r("div", { className: "select-search", children: /* @__PURE__ */ r(
176
176
  "input",
177
177
  {
178
178
  type: "text",
179
179
  className: "select-search-input",
180
180
  value: b,
181
- onChange: (P) => T(P.target.value),
181
+ onChange: (R) => j(R.target.value),
182
182
  placeholder: v ? "Carregando..." : o,
183
183
  autoFocus: !0,
184
- onClick: (P) => P.stopPropagation()
184
+ onClick: (R) => R.stopPropagation()
185
185
  }
186
186
  ) }),
187
- /* @__PURE__ */ r("ul", { className: "select-options", children: v ? /* @__PURE__ */ r("li", { className: "select-option readOnly", children: "Carregando..." }) : ee.length > 0 ? ee.map((P) => /* @__PURE__ */ r(
187
+ /* @__PURE__ */ r("ul", { className: "select-options", children: v ? /* @__PURE__ */ r("li", { className: "select-option readOnly", children: "Carregando..." }) : ee.length > 0 ? ee.map((R) => /* @__PURE__ */ r(
188
188
  "li",
189
189
  {
190
- onClick: () => oe(P),
190
+ onClick: () => oe(R),
191
191
  className: "select-option handleHover",
192
- children: P[s]
192
+ children: R[s]
193
193
  },
194
- P[d]
194
+ R[c]
195
195
  )) : /* @__PURE__ */ r("li", { className: "select-option readOnly", children: "Sem resultados" }) })
196
196
  ] })
197
197
  ] }),
198
- !w && /* @__PURE__ */ r("input", { type: "hidden", name: e, value: y || "" }),
199
- (R || W) && /* @__PURE__ */ r("p", { className: "text-danger", children: String((R == null ? void 0 : R.message) ?? W) })
198
+ !h && /* @__PURE__ */ r("input", { type: "hidden", name: e, value: g || "" }),
199
+ (O || W) && /* @__PURE__ */ r("p", { className: "text-danger", children: String((O == null ? void 0 : O.message) ?? W) })
200
200
  ]
201
201
  }
202
202
  );
203
203
  }
204
- const Vt = z(Se);
204
+ const Dt = z(Re);
205
205
  function Tt({
206
206
  name: e,
207
207
  options: t = [],
208
208
  label: n = "",
209
209
  valueKey: i = "value",
210
210
  labelKey: s = "label",
211
- forceReadOnly: d = !1,
211
+ forceReadOnly: c = !1,
212
212
  forceHidden: l = !1,
213
213
  valueManual: o,
214
214
  onChangeManual: v
215
215
  }) {
216
- var D, R;
216
+ var N, O;
217
217
  let a = null;
218
218
  try {
219
219
  a = H();
220
220
  } catch {
221
221
  }
222
- const p = o !== void 0 && !!v, { isView: g, isReadOnly: $ } = I(), { isReadOnly: V, isHidden: A } = F(), _ = V ? V(e) : !1, W = A ? A(e) : !1, w = d || _, f = l || W, u = w || $ || g, m = () => t ? t.reduce(
223
- (k, S) => {
224
- const O = String(S[i]);
225
- if (p)
226
- k[O] = !!(o != null && o[O]);
222
+ const w = o !== void 0 && !!v, { isView: p, isReadOnly: V } = L(), { isReadOnly: D, isHidden: _ } = I(), P = D ? D(e) : !1, W = _ ? _(e) : !1, h = c || P, y = l || W, u = h || V || p, m = () => t ? t.reduce(
223
+ (k, $) => {
224
+ const A = String($[i]);
225
+ if (w)
226
+ k[A] = !!(o != null && o[A]);
227
227
  else if (a) {
228
- const b = a.getValues(O);
229
- k[O] = b === "on";
228
+ const b = a.getValues(A);
229
+ k[A] = b === "on";
230
230
  } else
231
- k[O] = !1;
231
+ k[A] = !1;
232
232
  return k;
233
233
  },
234
234
  {}
235
- ) : {}, c = !p && a ? a.watch(e) : void 0, h = B(() => p && o ? o : c && typeof c == "object" ? c : m(), [c, o, t]);
235
+ ) : {}, d = !w && a ? a.watch(e) : void 0, f = B(() => w && o ? o : d && typeof d == "object" ? d : m(), [d, o, t]);
236
236
  E(() => {
237
- if (p || !a) return;
237
+ if (w || !a) return;
238
238
  const k = a.getValues(e);
239
- (!k || typeof k != "object") && a.setValue(e, h, {
239
+ (!k || typeof k != "object") && a.setValue(e, f, {
240
240
  shouldDirty: !1,
241
241
  shouldValidate: !1
242
242
  });
243
- }, [h, e, a, p]);
244
- const y = (k, S) => {
243
+ }, [f, e, a, w]);
244
+ const g = (k, $) => {
245
245
  if (u) return;
246
- const O = { ...h, [k]: S };
247
- if (p) {
248
- v && v(O);
246
+ const A = { ...f, [k]: $ };
247
+ if (w) {
248
+ v && v(A);
249
249
  return;
250
250
  }
251
- a && (a.setValue(e, O, {
251
+ a && (a.setValue(e, A, {
252
252
  shouldDirty: !0,
253
253
  shouldValidate: !0
254
- }), a.setValue(k, S ? "on" : "", { shouldValidate: !1 }));
255
- }, x = p ? null : (R = (D = a == null ? void 0 : a.formState) == null ? void 0 : D.errors) == null ? void 0 : R[e];
256
- return /* @__PURE__ */ N("div", { className: `form-group ${f ? "hidden" : ""}`, children: [
254
+ }), a.setValue(k, $ ? "on" : "", { shouldValidate: !1 }));
255
+ }, S = w ? null : (O = (N = a == null ? void 0 : a.formState) == null ? void 0 : N.errors) == null ? void 0 : O[e];
256
+ return /* @__PURE__ */ x("div", { className: `form-group ${y ? "hidden" : ""}`, children: [
257
257
  n && /* @__PURE__ */ r("label", { children: n }),
258
258
  /* @__PURE__ */ r(
259
259
  "div",
260
260
  {
261
261
  className: `checkbox-group-custom ${u ? "readOnly" : ""}`,
262
262
  children: t.map((k) => {
263
- const S = String(k[i]), O = h[S] === !0;
264
- return /* @__PURE__ */ N("div", { children: [
265
- !p && a && /* @__PURE__ */ r("input", { type: "hidden", ...a.register(S) }),
266
- /* @__PURE__ */ N(
263
+ const $ = String(k[i]), A = f[$] === !0;
264
+ return /* @__PURE__ */ x("div", { children: [
265
+ !w && a && /* @__PURE__ */ r("input", { type: "hidden", ...a.register($) }),
266
+ /* @__PURE__ */ x(
267
267
  "label",
268
268
  {
269
- className: `custom-checkbox ${O ? "checked" : ""} ${u ? "readOnly" : ""}`,
269
+ className: `custom-checkbox ${A ? "checked" : ""} ${u ? "readOnly" : ""}`,
270
270
  children: [
271
271
  /* @__PURE__ */ r(
272
272
  "input",
273
273
  {
274
274
  type: "checkbox",
275
- checked: O,
275
+ checked: A,
276
276
  disabled: u,
277
- onChange: (b) => y(S, b.target.checked)
277
+ onChange: (b) => g($, b.target.checked)
278
278
  }
279
279
  ),
280
280
  /* @__PURE__ */ r("span", { className: "checkmark" }),
@@ -282,11 +282,11 @@ function Tt({
282
282
  ]
283
283
  }
284
284
  )
285
- ] }, S);
285
+ ] }, $);
286
286
  })
287
287
  }
288
288
  ),
289
- x && /* @__PURE__ */ r("p", { className: "text-danger", children: String(x.message) })
289
+ S && /* @__PURE__ */ r("p", { className: "text-danger", children: String(S.message) })
290
290
  ] });
291
291
  }
292
292
  function Pe({
@@ -295,68 +295,68 @@ function Pe({
295
295
  options: n = [],
296
296
  valueKey: i = "value",
297
297
  labelKey: s = "label",
298
- iconKey: d = "icon",
298
+ iconKey: c = "icon",
299
299
  forceReadOnly: l = !1,
300
300
  forceHidden: o = !1,
301
301
  valueManual: v,
302
302
  onChangeManual: a,
303
- errorManual: p
303
+ errorManual: w
304
304
  }) {
305
- var y;
306
- const g = v !== void 0 && !!a, { isReadOnly: $, isHidden: V } = F(), A = l || !!$(e), _ = o || !!V(e), { isView: W, isReadOnly: w } = I();
307
- let f = null, u = null;
308
- if (!g)
305
+ var g;
306
+ const p = v !== void 0 && !!a, { isReadOnly: V, isHidden: D } = I(), _ = l || !!V(e), P = o || !!D(e), { isView: W, isReadOnly: h } = L();
307
+ let y = null, u = null;
308
+ if (!p)
309
309
  try {
310
- const { control: x } = H(), D = X({ name: e, control: x });
311
- f = D.field, u = (y = D.fieldState) == null ? void 0 : y.error;
310
+ const { control: S } = H(), N = X({ name: e, control: S });
311
+ y = N.field, u = (g = N.fieldState) == null ? void 0 : g.error;
312
312
  } catch {
313
313
  }
314
- const m = A || w || W, c = g ? v : (f == null ? void 0 : f.value) ?? "", h = C(
315
- (x) => {
316
- m || (g ? a == null || a(x) : f == null || f.onChange(x));
314
+ const m = _ || h || W, d = p ? v : (y == null ? void 0 : y.value) ?? "", f = C(
315
+ (S) => {
316
+ m || (p ? a == null || a(S) : y == null || y.onChange(S));
317
317
  },
318
- [m, g, a, f]
318
+ [m, p, a, y]
319
319
  );
320
- return /* @__PURE__ */ N("div", { className: `form-group column ${_ ? "hidden" : ""}`, children: [
320
+ return /* @__PURE__ */ x("div", { className: `form-group column ${P ? "hidden" : ""}`, children: [
321
321
  t && /* @__PURE__ */ r("label", { className: "control-label", children: t }),
322
322
  /* @__PURE__ */ r(
323
323
  "div",
324
324
  {
325
325
  className: `btn-group ${m ? "view-mode" : ""}`,
326
326
  "data-field-name": e,
327
- children: n.map((x) => {
328
- const D = x[i], R = c === D, k = x.color ? { "--customColor": x.color } : void 0;
329
- return /* @__PURE__ */ N(
327
+ children: n.map((S) => {
328
+ const N = S[i], O = d === N, k = S.color ? { "--customColor": S.color } : void 0;
329
+ return /* @__PURE__ */ x(
330
330
  "label",
331
331
  {
332
- htmlFor: `${e}_${D}`,
332
+ htmlFor: `${e}_${N}`,
333
333
  style: k,
334
- className: `btn fs-ellipsis ${R ? "active" : ""}`,
334
+ className: `btn fs-ellipsis ${O ? "active" : ""}`,
335
335
  children: [
336
336
  /* @__PURE__ */ r(
337
337
  "input",
338
338
  {
339
339
  type: "radio",
340
- id: `${e}_${D}`,
340
+ id: `${e}_${N}`,
341
341
  name: e,
342
- value: D,
343
- checked: R,
342
+ value: N,
343
+ checked: O,
344
344
  className: "hidden",
345
- onChange: () => h(D),
345
+ onChange: () => f(N),
346
346
  disabled: m
347
347
  }
348
348
  ),
349
- x[d] && /* @__PURE__ */ r("i", { className: `${x[d]} icon-sm` }),
349
+ S[c] && /* @__PURE__ */ r("i", { className: `${S[c]} icon-sm` }),
350
350
  " ",
351
- x[s]
351
+ S[s]
352
352
  ]
353
353
  },
354
- D
354
+ N
355
355
  );
356
356
  })
357
357
  }
358
358
  ),
359
- (u || p) && /* @__PURE__ */ r("p", { className: "text-danger", children: String((u == null ? void 0 : u.message) ?? p) })
359
+ (u || w) && /* @__PURE__ */ r("p", { className: "text-danger", children: String((u == null ? void 0 : u.message) ?? w) })
360
360
  ] });
361
361
  }
362
362
  const jt = z(Pe), $e = ({
@@ -365,60 +365,60 @@ const jt = z(Pe), $e = ({
365
365
  placeholder: n = "",
366
366
  className: i = "",
367
367
  rows: s = 4,
368
- maxLength: d,
368
+ maxLength: c,
369
369
  forceReadOnly: l = !1,
370
370
  forceHidden: o = !1,
371
371
  valueManual: v,
372
372
  onChangeManual: a,
373
- errorManual: p
373
+ errorManual: w
374
374
  }) => {
375
- var h;
376
- const g = v !== void 0 && !!a, { isReadOnly: $, isHidden: V } = F(), A = l || !!$(e), _ = o || !!V(e), { isView: W } = I(), w = G(null);
377
- let f = {
375
+ var f;
376
+ const p = v !== void 0 && !!a, { isReadOnly: V, isHidden: D } = I(), _ = l || !!V(e), P = o || !!D(e), { isView: W } = L(), h = G(null);
377
+ let y = {
378
378
  value: v ?? "",
379
- onChange: (y) => a == null ? void 0 : a(y)
379
+ onChange: (g) => a == null ? void 0 : a(g)
380
380
  }, u = null;
381
- if (!g)
381
+ if (!p)
382
382
  try {
383
- const { control: y } = H(), x = X({ name: e, control: y });
384
- f = x.field, u = (h = x.fieldState) == null ? void 0 : h.error;
383
+ const { control: g } = H(), S = X({ name: e, control: g });
384
+ y = S.field, u = (f = S.fieldState) == null ? void 0 : f.error;
385
385
  } catch {
386
386
  }
387
387
  const m = () => {
388
- w.current && (w.current.style.height = "auto", w.current.style.height = `${w.current.scrollHeight}px`);
388
+ h.current && (h.current.style.height = "auto", h.current.style.height = `${h.current.scrollHeight}px`);
389
389
  };
390
390
  if (E(() => {
391
391
  m();
392
- }, [f.value]), W)
393
- return /* @__PURE__ */ N("div", { className: `form-group ${_ ? "hidden" : ""}`, children: [
392
+ }, [y.value]), W)
393
+ return /* @__PURE__ */ x("div", { className: `form-group ${P ? "hidden" : ""}`, children: [
394
394
  /* @__PURE__ */ r("label", { children: t }),
395
- /* @__PURE__ */ r("span", { className: "form-control", children: f.value || "-" })
395
+ /* @__PURE__ */ r("span", { className: "form-control", children: y.value || "-" })
396
396
  ] });
397
- const c = `form-control ${A ? "readOnly" : ""} ${u || p ? "border-red" : ""} ${i}`;
398
- return /* @__PURE__ */ N("div", { className: `form-group ${_ ? "hidden" : ""}`, children: [
397
+ const d = `form-control ${_ ? "readOnly" : ""} ${u || w ? "border-red" : ""} ${i}`;
398
+ return /* @__PURE__ */ x("div", { className: `form-group ${P ? "hidden" : ""}`, children: [
399
399
  t && /* @__PURE__ */ r("label", { children: t }),
400
400
  /* @__PURE__ */ r(
401
401
  "textarea",
402
402
  {
403
- ref: w,
403
+ ref: h,
404
404
  rows: s,
405
- maxLength: d,
406
- value: f.value || "",
405
+ maxLength: c,
406
+ value: y.value || "",
407
407
  placeholder: n,
408
- readOnly: A,
409
- className: c,
408
+ readOnly: _,
409
+ className: d,
410
410
  style: {
411
411
  resize: "none",
412
412
  maxHeight: "400px",
413
413
  overflowY: "auto"
414
414
  },
415
- onChange: (y) => {
416
- g ? a == null || a(y.target.value) : f.onChange(y);
415
+ onChange: (g) => {
416
+ p ? a == null || a(g.target.value) : y.onChange(g);
417
417
  },
418
418
  onInput: m
419
419
  }
420
420
  ),
421
- (u || p) && /* @__PURE__ */ r("p", { className: "text-danger", children: String((u == null ? void 0 : u.message) ?? p) })
421
+ (u || w) && /* @__PURE__ */ r("p", { className: "text-danger", children: String((u == null ? void 0 : u.message) ?? w) })
422
422
  ] });
423
423
  }, Ct = z($e);
424
424
  function J(e) {
@@ -438,26 +438,26 @@ function Q(e) {
438
438
  const l = e.defaultWidth, o = n != null && n.width ? String(n.width) : e.defaultWidth;
439
439
  s = e.values[o] || e.values[l];
440
440
  }
441
- const d = e.argumentCallback ? e.argumentCallback(t) : t;
442
- return s[d];
441
+ const c = e.argumentCallback ? e.argumentCallback(t) : t;
442
+ return s[c];
443
443
  };
444
444
  }
445
445
  function Y(e) {
446
446
  return (t, n = {}) => {
447
- const i = n.width, s = i && e.matchPatterns[i] || e.matchPatterns[e.defaultMatchWidth], d = t.match(s);
448
- if (!d)
447
+ const i = n.width, s = i && e.matchPatterns[i] || e.matchPatterns[e.defaultMatchWidth], c = t.match(s);
448
+ if (!c)
449
449
  return null;
450
- const l = d[0], o = i && e.parsePatterns[i] || e.parsePatterns[e.defaultParseWidth], v = Array.isArray(o) ? Oe(o, (g) => g.test(l)) : (
450
+ const l = c[0], o = i && e.parsePatterns[i] || e.parsePatterns[e.defaultParseWidth], v = Array.isArray(o) ? Oe(o, (p) => p.test(l)) : (
451
451
  // [TODO] -- I challenge you to fix the type
452
- _e(o, (g) => g.test(l))
452
+ _e(o, (p) => p.test(l))
453
453
  );
454
454
  let a;
455
455
  a = e.valueCallback ? e.valueCallback(v) : v, a = n.valueCallback ? (
456
456
  // [TODO] -- I challenge you to fix the type
457
457
  n.valueCallback(a)
458
458
  ) : a;
459
- const p = t.slice(l.length);
460
- return { value: a, rest: p };
459
+ const w = t.slice(l.length);
460
+ return { value: a, rest: w };
461
461
  };
462
462
  }
463
463
  function _e(e, t) {
@@ -474,9 +474,9 @@ function Ae(e) {
474
474
  return (t, n = {}) => {
475
475
  const i = t.match(e.matchPattern);
476
476
  if (!i) return null;
477
- const s = i[0], d = t.match(e.parsePattern);
478
- if (!d) return null;
479
- let l = e.valueCallback ? e.valueCallback(d[0]) : d[0];
477
+ const s = i[0], c = t.match(e.parsePattern);
478
+ if (!c) return null;
479
+ let l = e.valueCallback ? e.valueCallback(c[0]) : c[0];
480
480
  l = n.valueCallback ? n.valueCallback(l) : l;
481
481
  const o = t.slice(s.length);
482
482
  return { value: l, rest: o };
@@ -544,11 +544,11 @@ const We = {
544
544
  one: "quase 1 ano",
545
545
  other: "quase {{count}} anos"
546
546
  }
547
- }, De = (e, t, n) => {
547
+ }, Ve = (e, t, n) => {
548
548
  let i;
549
549
  const s = We[e];
550
550
  return typeof s == "string" ? i = s : t === 1 ? i = s.one : i = s.other.replace("{{count}}", String(t)), n != null && n.addSuffix ? n.comparison && n.comparison > 0 ? "em " + i : "há " + i : i;
551
- }, Ve = {
551
+ }, De = {
552
552
  full: "EEEE, d 'de' MMMM 'de' y",
553
553
  long: "d 'de' MMMM 'de' y",
554
554
  medium: "d MMM y",
@@ -565,7 +565,7 @@ const We = {
565
565
  short: "{{date}}, {{time}}"
566
566
  }, Ce = {
567
567
  date: J({
568
- formats: Ve,
568
+ formats: De,
569
569
  defaultWidth: "full"
570
570
  }),
571
571
  time: J({
@@ -589,15 +589,15 @@ const We = {
589
589
  }, He = (e, t, n, i) => {
590
590
  const s = Ee[e];
591
591
  return typeof s == "function" ? s(t) : s;
592
- }, Ie = {
592
+ }, Le = {
593
593
  narrow: ["AC", "DC"],
594
594
  abbreviated: ["AC", "DC"],
595
595
  wide: ["antes de cristo", "depois de cristo"]
596
- }, Le = {
596
+ }, Fe = {
597
597
  narrow: ["1", "2", "3", "4"],
598
598
  abbreviated: ["T1", "T2", "T3", "T4"],
599
599
  wide: ["1º trimestre", "2º trimestre", "3º trimestre", "4º trimestre"]
600
- }, Fe = {
600
+ }, Ie = {
601
601
  narrow: ["j", "f", "m", "a", "m", "j", "j", "a", "s", "o", "n", "d"],
602
602
  abbreviated: [
603
603
  "jan",
@@ -716,16 +716,16 @@ const We = {
716
716
  }, Ue = {
717
717
  ordinalNumber: Xe,
718
718
  era: Q({
719
- values: Ie,
719
+ values: Le,
720
720
  defaultWidth: "wide"
721
721
  }),
722
722
  quarter: Q({
723
- values: Le,
723
+ values: Fe,
724
724
  defaultWidth: "wide",
725
725
  argumentCallback: (e) => e - 1
726
726
  }),
727
727
  month: Q({
728
- values: Fe,
728
+ values: Ie,
729
729
  defaultWidth: "wide"
730
730
  }),
731
731
  day: Q({
@@ -846,7 +846,7 @@ const We = {
846
846
  })
847
847
  }, at = {
848
848
  code: "pt-BR",
849
- formatDistance: De,
849
+ formatDistance: Ve,
850
850
  formatLong: Ce,
851
851
  formatRelative: He,
852
852
  localize: Ue,
@@ -876,7 +876,7 @@ const ot = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
876
876
  * This source code is licensed under the ISC license.
877
877
  * See the LICENSE file in the root directory of this source tree.
878
878
  */
879
- const ct = (e) => e.replace(
879
+ const dt = (e) => e.replace(
880
880
  /^([A-Z])|[\s-_]+(\w)/g,
881
881
  (t, n, i) => i ? i.toUpperCase() : n.toLowerCase()
882
882
  );
@@ -887,7 +887,7 @@ const ct = (e) => e.replace(
887
887
  * See the LICENSE file in the root directory of this source tree.
888
888
  */
889
889
  const re = (e) => {
890
- const t = ct(e);
890
+ const t = dt(e);
891
891
  return t.charAt(0).toUpperCase() + t.slice(1);
892
892
  };
893
893
  /**
@@ -896,7 +896,7 @@ const re = (e) => {
896
896
  * This source code is licensed under the ISC license.
897
897
  * See the LICENSE file in the root directory of this source tree.
898
898
  */
899
- var dt = {
899
+ var ct = {
900
900
  xmlns: "http://www.w3.org/2000/svg",
901
901
  width: 24,
902
902
  height: 24,
@@ -932,25 +932,25 @@ const ut = se(
932
932
  strokeWidth: n = 2,
933
933
  absoluteStrokeWidth: i,
934
934
  className: s = "",
935
- children: d,
935
+ children: c,
936
936
  iconNode: l,
937
937
  ...o
938
938
  }, v) => Z(
939
939
  "svg",
940
940
  {
941
941
  ref: v,
942
- ...dt,
942
+ ...ct,
943
943
  width: t,
944
944
  height: t,
945
945
  stroke: e,
946
946
  strokeWidth: i ? Number(n) * 24 / Number(t) : n,
947
947
  className: ie("lucide", s),
948
- ...!d && !lt(o) && { "aria-hidden": "true" },
948
+ ...!c && !lt(o) && { "aria-hidden": "true" },
949
949
  ...o
950
950
  },
951
951
  [
952
- ...l.map(([a, p]) => Z(a, p)),
953
- ...Array.isArray(d) ? d : [d]
952
+ ...l.map(([a, w]) => Z(a, w)),
953
+ ...Array.isArray(c) ? c : [c]
954
954
  ]
955
955
  )
956
956
  );
@@ -962,8 +962,8 @@ const ut = se(
962
962
  */
963
963
  const M = (e, t) => {
964
964
  const n = se(
965
- ({ className: i, ...s }, d) => Z(ut, {
966
- ref: d,
965
+ ({ className: i, ...s }, c) => Z(ut, {
966
+ ref: c,
967
967
  iconNode: t,
968
968
  className: ie(
969
969
  `lucide-${ot(re(e))}`,
@@ -1022,114 +1022,100 @@ const ae = "dd/MM/yyyy", bt = (e) => {
1022
1022
  placeholder: n = "dd/mm/aaaa",
1023
1023
  className: i = "",
1024
1024
  forceReadOnly: s = !1,
1025
- forceHidden: d = !1,
1025
+ forceHidden: c = !1,
1026
1026
  valueManual: l,
1027
1027
  onChangeManual: o,
1028
1028
  errorManual: v
1029
1029
  }) => {
1030
1030
  var k;
1031
- const [a, p] = L(!1), [g, $] = L(/* @__PURE__ */ new Date()), V = gt(() => p(!1)), A = l !== void 0 && !!o;
1032
- let _ = null;
1031
+ const [a, w] = F(!1), [p, V] = F(/* @__PURE__ */ new Date()), D = gt(() => w(!1)), _ = l !== void 0 && !!o;
1032
+ let P = null;
1033
1033
  try {
1034
- _ = H();
1034
+ P = H();
1035
1035
  } catch {
1036
1036
  }
1037
- const { isView: W } = I(), { isReadOnly: w, isHidden: f } = F(), u = s || !!w(e), m = d || !!f(e), c = !A && _ ? X({ name: e, control: _.control }) : null, h = A ? l : c == null ? void 0 : c.field.value, y = A ? v : (k = c == null ? void 0 : c.fieldState.error) == null ? void 0 : k.message, x = B(() => bt(h), [h]), D = (S) => {
1037
+ const { isView: W } = L(), { isReadOnly: h, isHidden: y } = I(), u = s || !!h(e), m = c || !!y(e), d = !_ && P ? X({ name: e, control: P.control }) : null, f = _ ? l : d == null ? void 0 : d.field.value, g = _ ? v : (k = d == null ? void 0 : d.fieldState.error) == null ? void 0 : k.message, S = B(() => bt(f), [f]), N = ($) => {
1038
1038
  if (u) return;
1039
- const O = wt(S);
1040
- A ? o == null || o(O) : c == null || c.field.onChange(O), p(!1);
1041
- }, R = (S) => {
1042
- const O = he({
1043
- start: ye(ve(S)),
1044
- end: fe(pe(S))
1039
+ const A = wt($);
1040
+ _ ? o == null || o(A) : d == null || d.field.onChange(A), w(!1);
1041
+ }, O = ($) => {
1042
+ const A = he({
1043
+ start: ye(ve($)),
1044
+ end: fe(pe($))
1045
1045
  });
1046
- return /* @__PURE__ */ N("div", { className: "dfe-calendar-pane", children: [
1047
- /* @__PURE__ */ N("div", { className: "dfe-calendar-header", children: [
1046
+ return /* @__PURE__ */ x("div", { className: "dfe-calendar-pane", children: [
1047
+ /* @__PURE__ */ x("div", { className: "dfe-calendar-header", children: [
1048
1048
  /* @__PURE__ */ r(
1049
1049
  "button",
1050
1050
  {
1051
1051
  type: "button",
1052
1052
  onClick: (b) => {
1053
- b.stopPropagation(), $(ge(g, 1));
1053
+ b.stopPropagation(), V(ge(p, 1));
1054
1054
  },
1055
1055
  className: "dfe-nav-btn",
1056
1056
  children: /* @__PURE__ */ r(pt, { size: 16 })
1057
1057
  }
1058
1058
  ),
1059
- /* @__PURE__ */ r("span", { className: "dfe-month-label", children: K(S, "MMMM yyyy", { locale: at }) }),
1059
+ /* @__PURE__ */ r("span", { className: "dfe-month-label", children: K($, "MMMM yyyy", { locale: at }) }),
1060
1060
  /* @__PURE__ */ r(
1061
1061
  "button",
1062
1062
  {
1063
1063
  type: "button",
1064
1064
  onClick: (b) => {
1065
- b.stopPropagation(), $(be(g, 1));
1065
+ b.stopPropagation(), V(be(p, 1));
1066
1066
  },
1067
1067
  className: "dfe-nav-btn",
1068
1068
  children: /* @__PURE__ */ r(vt, { size: 16 })
1069
1069
  }
1070
1070
  )
1071
1071
  ] }),
1072
- /* @__PURE__ */ r("div", { className: "dfe-calendar-grid-header", children: ["D", "S", "T", "Q", "Q", "S", "S"].map((b, T) => /* @__PURE__ */ r("span", { children: b }, T)) }),
1073
- /* @__PURE__ */ r("div", { className: "dfe-calendar-grid", children: O.map((b, T) => {
1074
- const q = !we(b, S), U = x && Ne(b, x);
1072
+ /* @__PURE__ */ r("div", { className: "dfe-calendar-grid-header", children: ["D", "S", "T", "Q", "Q", "S", "S"].map((b, j) => /* @__PURE__ */ r("span", { children: b }, j)) }),
1073
+ /* @__PURE__ */ r("div", { className: "dfe-calendar-grid", children: A.map((b, j) => {
1074
+ const q = !we(b, $), U = S && Ne(b, S);
1075
1075
  return /* @__PURE__ */ r(
1076
1076
  "div",
1077
1077
  {
1078
- onClick: () => !q && D(b),
1078
+ onClick: () => !q && N(b),
1079
1079
  className: `dfe-calendar-day
1080
1080
  ${U ? "selected" : ""}
1081
1081
  ${q ? "outside" : ""}
1082
1082
  ${ke(b) ? "today" : ""}`,
1083
1083
  children: K(b, "d")
1084
1084
  },
1085
- T
1085
+ j
1086
1086
  );
1087
1087
  }) })
1088
1088
  ] });
1089
1089
  };
1090
- return m ? null : W ? /* @__PURE__ */ N("div", { className: `form-group ${i}`, children: [
1090
+ return m ? null : W ? /* @__PURE__ */ x("div", { className: `form-group ${i}`, children: [
1091
1091
  t && /* @__PURE__ */ r("label", { children: t }),
1092
- /* @__PURE__ */ r(
1093
- "span",
1094
- {
1095
- className: "form-control readOnly",
1096
- style: { display: "block", height: "auto" },
1097
- children: h || "-"
1098
- }
1099
- )
1100
- ] }) : /* @__PURE__ */ N(
1092
+ /* @__PURE__ */ r("span", { className: "form-control readOnly", style: { display: "block", height: "auto" }, children: f || "-" })
1093
+ ] }) : /* @__PURE__ */ x(
1101
1094
  "div",
1102
1095
  {
1103
- ref: V,
1096
+ ref: D,
1104
1097
  className: `form-group dfe-datepicker-container ${i}`,
1105
1098
  style: { position: "relative" },
1106
1099
  children: [
1107
1100
  t && /* @__PURE__ */ r("label", { children: t }),
1108
- /* @__PURE__ */ N(
1101
+ /* @__PURE__ */ x(
1109
1102
  "div",
1110
1103
  {
1111
- className: `form-control dfe-datepicker-trigger ${y ? "border-red" : ""} ${u ? "disabled" : ""}`,
1112
- onClick: () => !u && p(!a),
1104
+ className: `form-control dfe-datepicker-trigger ${g ? "border-red" : ""} ${u ? "disabled" : ""}`,
1105
+ onClick: () => !u && w(!a),
1113
1106
  style: {
1114
1107
  display: "flex",
1115
1108
  alignItems: "center",
1116
1109
  cursor: u ? "default" : "pointer"
1117
1110
  },
1118
1111
  children: [
1119
- /* @__PURE__ */ r(
1120
- ht,
1121
- {
1122
- size: 16,
1123
- className: "dfe-calendar-icon",
1124
- style: { marginRight: "8px", opacity: 0.5 }
1125
- }
1126
- ),
1127
- /* @__PURE__ */ r("span", { children: h || n })
1112
+ /* @__PURE__ */ r(ht, { size: 16, className: "dfe-calendar-icon", style: { marginRight: "8px", opacity: 0.5 } }),
1113
+ /* @__PURE__ */ r("span", { children: f || n })
1128
1114
  ]
1129
1115
  }
1130
1116
  ),
1131
- a && !u && /* @__PURE__ */ r("div", { className: "dfe-popover-content", children: /* @__PURE__ */ r("div", { className: "dfe-calendars-wrapper", children: R(g) }) }),
1132
- y && /* @__PURE__ */ r("p", { className: "text-danger", children: String(y) })
1117
+ a && !u && /* @__PURE__ */ r("div", { className: "dfe-popover-content", children: /* @__PURE__ */ r("div", { className: "dfe-calendars-wrapper", children: O(p) }) }),
1118
+ g && /* @__PURE__ */ r("p", { className: "text-danger", children: String(g) })
1133
1119
  ]
1134
1120
  }
1135
1121
  );
@@ -1141,18 +1127,18 @@ function kt({
1141
1127
  hidden: i = !1,
1142
1128
  label: s
1143
1129
  }) {
1144
- const { activityId: d } = I(), l = B(() => !e || d === null || d === void 0 ? null : e[d], [d, e]);
1130
+ const { activityId: c } = L(), l = B(() => !e || c === null || c === void 0 ? null : e[c], [c, e]);
1145
1131
  if (!l)
1146
- return /* @__PURE__ */ N("div", { className: `form-group ${i ? "hidden" : ""}`, children: [
1132
+ return /* @__PURE__ */ x("div", { className: `form-group ${i ? "hidden" : ""}`, children: [
1147
1133
  s && /* @__PURE__ */ r("label", { children: s }),
1148
1134
  /* @__PURE__ */ r("div", { className: `status-badge default ${n}`, children: t })
1149
1135
  ] });
1150
1136
  const o = {
1151
1137
  "--customColor": l.color
1152
1138
  };
1153
- return /* @__PURE__ */ N("div", { className: `form-group ${i ? "hidden" : ""}`, children: [
1139
+ return /* @__PURE__ */ x("div", { className: `form-group ${i ? "hidden" : ""}`, children: [
1154
1140
  s && /* @__PURE__ */ r("label", { children: s }),
1155
- /* @__PURE__ */ N("div", { className: `status-badge ${n}`, style: o, children: [
1141
+ /* @__PURE__ */ x("div", { className: `status-badge ${n}`, style: o, children: [
1156
1142
  l.icon && /* @__PURE__ */ r("i", { className: l.icon }),
1157
1143
  /* @__PURE__ */ r("span", { children: l.label })
1158
1144
  ] })
@@ -1165,316 +1151,302 @@ function xt({
1165
1151
  defaultRowValue: n,
1166
1152
  isView: i,
1167
1153
  isReadOnly: s,
1168
- filters: d = []
1154
+ filters: c = []
1169
1155
  }) {
1170
- const { field: l } = X({ name: e, control: t }), [o, v] = L([]), [a, p] = L([]), g = () => Date.now() + Math.random(), $ = (m) => {
1156
+ const { field: l } = X({ name: e, control: t }), [o, v] = F([]), [a, w] = F([]), p = () => Date.now() + Math.random(), V = (m) => {
1171
1157
  try {
1172
- const c = JSON.parse(m);
1173
- return Array.isArray(c) ? c.map((h) => ({
1174
- ...h,
1175
- _uid: h._uid || g()
1158
+ const d = JSON.parse(m);
1159
+ return Array.isArray(d) ? d.map((f) => ({
1160
+ ...f,
1161
+ _uid: f._uid || p()
1176
1162
  })) : [];
1177
- } catch (c) {
1178
- return console.error(`Erro ao ler dados da tabela "${e}":`, c), [];
1163
+ } catch (d) {
1164
+ return console.error(`Erro ao ler dados da tabela "${e}":`, d), [];
1179
1165
  }
1180
1166
  };
1181
1167
  E(() => {
1182
1168
  if (!(o.length > 0 && !i) && l.value && typeof l.value == "string") {
1183
1169
  const m = JSON.stringify(o);
1184
1170
  if (l.value === m) return;
1185
- const c = $(l.value);
1186
- v(c);
1171
+ const d = V(l.value);
1172
+ v(d);
1187
1173
  }
1188
1174
  }, [l.value, i]), E(() => {
1189
1175
  if (s) return;
1190
1176
  const m = JSON.stringify(o);
1191
1177
  l.value !== m && l.onChange(m);
1192
1178
  }, [o, l, s]);
1193
- const V = C(() => {
1194
- const m = { _uid: g(), ...n };
1195
- v((c) => [...c, m]);
1196
- }, [n]), A = C(() => {
1197
- v(
1198
- (m) => m.filter((c) => !a.includes(c._uid))
1199
- ), p([]);
1200
- }, [a]), _ = C(
1201
- (m, c, h) => {
1202
- v(
1203
- (y) => y.map(
1204
- (x) => x._uid === m ? { ...x, [c]: h } : x
1205
- )
1206
- );
1207
- },
1208
- []
1209
- ), W = C((m) => {
1210
- p(
1211
- (c) => c.includes(m) ? c.filter((h) => h !== m) : [...c, m]
1212
- );
1213
- }, []), w = C(
1179
+ const D = C(() => {
1180
+ const m = { _uid: p(), ...n };
1181
+ v((d) => [...d, m]);
1182
+ }, [n]), _ = C(() => {
1183
+ v((m) => m.filter((d) => !a.includes(d._uid))), w([]);
1184
+ }, [a]), P = C((m, d, f) => {
1185
+ v((g) => g.map((S) => S._uid === m ? { ...S, [d]: f } : S));
1186
+ }, []), W = C((m) => {
1187
+ w((d) => d.includes(m) ? d.filter((f) => f !== m) : [...d, m]);
1188
+ }, []), h = C(
1214
1189
  (m) => {
1215
- p(m ? o.map((c) => c._uid) : []);
1190
+ w(m ? o.map((d) => d._uid) : []);
1216
1191
  },
1217
1192
  [o]
1218
- ), f = o.length > 0 && a.length === o.length, u = B(() => !d || d.length === 0 ? o : o.filter(
1219
- (m) => d.every((c) => {
1220
- if ("custom" in c)
1221
- return c.custom(m);
1222
- const h = m[c.field];
1223
- switch (c.operator) {
1193
+ ), y = o.length > 0 && a.length === o.length, u = B(() => !c || c.length === 0 ? o : o.filter(
1194
+ (m) => c.every((d) => {
1195
+ if ("custom" in d)
1196
+ return d.custom(m);
1197
+ const f = m[d.field];
1198
+ switch (d.operator) {
1224
1199
  case "===":
1225
- return h === c.value;
1200
+ return f === d.value;
1226
1201
  case "!==":
1227
- return h !== c.value;
1202
+ return f !== d.value;
1228
1203
  case ">":
1229
- return h > c.value;
1204
+ return f > d.value;
1230
1205
  case "<":
1231
- return h < c.value;
1206
+ return f < d.value;
1232
1207
  case ">=":
1233
- return h >= c.value;
1208
+ return f >= d.value;
1234
1209
  case "<=":
1235
- return h <= c.value;
1210
+ return f <= d.value;
1236
1211
  default:
1237
1212
  return !0;
1238
1213
  }
1239
1214
  })
1240
- ), [o, d]);
1215
+ ), [o, c]);
1241
1216
  return {
1242
1217
  field: l,
1243
1218
  tableRows: o,
1244
1219
  visibleRows: u,
1245
1220
  selectedRowIds: a,
1246
- isAllSelected: f,
1221
+ isAllSelected: y,
1247
1222
  handle: {
1248
- addRow: V,
1249
- removeRows: A,
1250
- updateCellValue: _,
1223
+ addRow: D,
1224
+ removeRows: _,
1225
+ updateCellValue: P,
1251
1226
  toggleSelection: W,
1252
- toggleSelectAll: w
1227
+ toggleSelectAll: h
1253
1228
  }
1254
1229
  };
1255
1230
  }
1256
- const It = ({
1231
+ const Lt = ({
1257
1232
  name: e,
1258
1233
  title: t = "Tabela Dinâmica",
1259
1234
  columns: n,
1260
1235
  defaultRowValue: i = {},
1261
1236
  forceReadOnly: s = !1,
1262
- layout: d = "fluid",
1237
+ layout: c = "fluid",
1263
1238
  actions: l = !0,
1264
1239
  filters: o = []
1265
1240
  }) => {
1266
- const { control: v } = H(), { isView: a, isReadOnly: p } = I(), { isReadOnly: g } = F(), $ = s || a || p || g && g(e), { field: V, visibleRows: A, selectedRowIds: _, isAllSelected: W, handle: w } = xt({
1241
+ const { control: v } = H(), { isView: a, isReadOnly: w } = L(), { isReadOnly: p } = I(), V = s || a || w || p && p(e), { field: D, visibleRows: _, selectedRowIds: P, isAllSelected: W, handle: h } = xt({
1267
1242
  name: e,
1268
1243
  control: v,
1269
1244
  defaultRowValue: i,
1270
1245
  isView: a,
1271
- isReadOnly: !!$,
1246
+ isReadOnly: !!V,
1272
1247
  filters: o
1273
- }), f = d === "fixed";
1274
- return /* @__PURE__ */ N("div", { className: `table-wrapper ${f ? "table-fixed" : "table-fluid"}`, children: [
1275
- /* @__PURE__ */ r("input", { type: "hidden", ...V }),
1276
- /* @__PURE__ */ N("div", { className: "header-handle", children: [
1248
+ }), y = c === "fixed";
1249
+ return /* @__PURE__ */ x("div", { className: `table-wrapper ${y ? "table-fixed" : "table-fluid"}`, children: [
1250
+ /* @__PURE__ */ r("input", { type: "hidden", ...D }),
1251
+ /* @__PURE__ */ x("div", { className: "header-handle", children: [
1277
1252
  /* @__PURE__ */ r("h3", { children: t }),
1278
- !$ && l && /* @__PURE__ */ N("div", { className: "handle-actions", children: [
1279
- /* @__PURE__ */ N(
1253
+ !V && l && /* @__PURE__ */ x("div", { className: "handle-actions", children: [
1254
+ /* @__PURE__ */ x(
1280
1255
  "button",
1281
1256
  {
1282
1257
  type: "button",
1283
- className: `btn ${_.length > 0 ? "btn-danger" : "btn-primary"}`,
1284
- disabled: _.length === 0,
1285
- onClick: w.removeRows,
1258
+ className: `btn ${P.length > 0 ? "btn-danger" : "btn-primary"}`,
1259
+ disabled: P.length === 0,
1260
+ onClick: h.removeRows,
1286
1261
  children: [
1287
1262
  "Remover (",
1288
- _.length,
1263
+ P.length,
1289
1264
  ")"
1290
1265
  ]
1291
1266
  }
1292
1267
  ),
1293
- /* @__PURE__ */ r("button", { type: "button", className: "btn-add", onClick: w.addRow, children: "Adicionar" })
1268
+ /* @__PURE__ */ r("button", { type: "button", className: "btn-add", onClick: h.addRow, children: "Adicionar" })
1294
1269
  ] })
1295
1270
  ] }),
1296
- /* @__PURE__ */ r("div", { className: "table-scroll", children: /* @__PURE__ */ N("table", { className: "table-custom", children: [
1297
- /* @__PURE__ */ r("thead", { children: /* @__PURE__ */ N("tr", { children: [
1298
- !$ && /* @__PURE__ */ r("th", { style: { width: "50px" }, children: /* @__PURE__ */ r(
1271
+ /* @__PURE__ */ r("div", { className: "table-scroll", children: /* @__PURE__ */ x("table", { className: "table-custom", children: [
1272
+ /* @__PURE__ */ r("thead", { children: /* @__PURE__ */ x("tr", { children: [
1273
+ !V && /* @__PURE__ */ r("th", { style: { width: "50px" }, children: /* @__PURE__ */ r(
1299
1274
  "input",
1300
1275
  {
1301
1276
  type: "checkbox",
1302
1277
  checked: W,
1303
- onChange: (u) => w.toggleSelectAll(u.target.checked)
1278
+ onChange: (u) => h.toggleSelectAll(u.target.checked)
1304
1279
  }
1305
1280
  ) }),
1306
1281
  n.map((u) => /* @__PURE__ */ r(
1307
1282
  "th",
1308
1283
  {
1309
- style: u.width ? { minWidth: f ? u.width : "100%" } : { width: "max-content" },
1284
+ style: u.width ? { minWidth: y ? u.width : "100%" } : { width: "max-content" },
1310
1285
  children: u.label
1311
1286
  },
1312
- u.key
1287
+ String(u.key)
1313
1288
  ))
1314
1289
  ] }) }),
1315
- /* @__PURE__ */ N("tbody", { children: [
1316
- A.map((u, m) => /* @__PURE__ */ N("tr", { children: [
1317
- !$ && /* @__PURE__ */ r("td", { children: /* @__PURE__ */ r(
1290
+ /* @__PURE__ */ x("tbody", { children: [
1291
+ _.map((u, m) => /* @__PURE__ */ x("tr", { children: [
1292
+ !V && /* @__PURE__ */ r("td", { children: /* @__PURE__ */ r(
1318
1293
  "input",
1319
1294
  {
1320
1295
  type: "checkbox",
1321
- checked: _.includes(u._uid),
1322
- onChange: () => w.toggleSelection(u._uid)
1296
+ checked: P.includes(u._uid),
1297
+ onChange: () => h.toggleSelection(u._uid)
1323
1298
  }
1324
1299
  ) }),
1325
- n.map((c) => /* @__PURE__ */ r("td", { children: c.render ? c.render.length <= 1 ? c.render({
1300
+ n.map((d) => /* @__PURE__ */ r("td", { children: d.render ? d.render.length <= 1 ? d.render({
1326
1301
  row: u,
1327
1302
  index: m,
1328
- updateRow: (h, y) => w.updateCellValue(u._uid, h, y),
1329
- isLocked: !!$,
1303
+ updateRow: (f, g) => h.updateCellValue(u._uid, String(f), g),
1304
+ isLocked: !!V,
1330
1305
  isView: !!a
1331
- }) : c.render(
1306
+ }) : d.render(
1332
1307
  u,
1333
1308
  m,
1334
- (h, y) => w.updateCellValue(u._uid, h, y),
1335
- !!$,
1309
+ (f, g) => h.updateCellValue(u._uid, f, g),
1310
+ !!V,
1336
1311
  !!a
1337
- ) : u[c.key] }, `${u._uid}-${c.key}`))
1312
+ ) : u[d.key] }, `${u._uid}-${String(d.key)}`))
1338
1313
  ] }, u._uid)),
1339
- A.length === 0 && /* @__PURE__ */ r("tr", { className: "empty-row", children: /* @__PURE__ */ r("td", { colSpan: 100, className: "text-center", children: $ ? "Nenhum registro encontrado." : "Nenhum registro." }) })
1314
+ _.length === 0 && /* @__PURE__ */ r("tr", { className: "empty-row", children: /* @__PURE__ */ r("td", { colSpan: 100, className: "text-center", children: V ? "Nenhum registro encontrado." : "Nenhum registro." }) })
1340
1315
  ] })
1341
1316
  ] }) })
1342
1317
  ] });
1343
- }, Rt = (e, t) => {
1344
- const [n, i] = L(null);
1318
+ }, St = (e, t) => {
1319
+ const [n, i] = F(null);
1345
1320
  let s = null;
1346
1321
  try {
1347
1322
  s = H().watch;
1348
1323
  } catch {
1349
1324
  }
1350
- const d = t !== void 0 ? t : s ? s(e) : void 0, l = C(() => {
1325
+ const c = t !== void 0 ? t : s ? s(e) : void 0, l = C(() => {
1351
1326
  try {
1352
1327
  const v = window.top.__REACT_ATTACHMENT_BRIDGE__;
1353
1328
  if (v) {
1354
- const a = v.getAttachment(e, d);
1355
- i(a || (d ? { name: d, documentId: 0 } : null));
1329
+ const a = v.getAttachment(e, c);
1330
+ i(a || (c ? { name: c, documentId: 0 } : null));
1356
1331
  } else
1357
- i(d ? { name: d, documentId: 0 } : null);
1332
+ i(c ? { name: c, documentId: 0 } : null);
1358
1333
  } catch {
1359
- i(d ? { name: d, documentId: 0 } : null);
1334
+ i(c ? { name: c, documentId: 0 } : null);
1360
1335
  }
1361
- }, [e, d, t]);
1336
+ }, [e, c, t]);
1362
1337
  return E(() => {
1363
1338
  l();
1364
1339
  const o = setInterval(l, 2e3);
1365
1340
  return () => clearInterval(o);
1366
1341
  }, [l]), { attachment: n, sync: l };
1367
- }, St = ({
1342
+ }, Rt = ({
1368
1343
  name: e,
1369
1344
  label: t,
1370
1345
  help: n,
1371
1346
  valueManual: i,
1372
1347
  onChangeManual: s,
1373
- forceReadOnly: d = !1,
1348
+ forceReadOnly: c = !1,
1374
1349
  forceHidden: l = !1
1375
1350
  }) => {
1376
- const o = i !== void 0 && !!s, { isReadOnly: v, isHidden: a } = F(), p = d || !!v(e), g = l || !!a(e), { isView: $ } = I(), [V, A] = L(!1);
1377
- let _ = null;
1351
+ const o = i !== void 0 && !!s, { isReadOnly: v, isHidden: a } = I(), { isView: w } = L(), p = c || w || !!v(e), V = l || !!a(e), [D, _] = F(!1);
1352
+ let P = null;
1378
1353
  try {
1379
- _ = H().control;
1354
+ P = H().control;
1380
1355
  } catch {
1381
1356
  }
1382
- const W = _ && !o ? X({ name: e, control: _ }).field : {
1357
+ const W = P && !o ? X({ name: e, control: P }).field : {
1383
1358
  value: i,
1384
- onChange: (R) => s == null ? void 0 : s(R)
1385
- }, { attachment: w, sync: f } = Rt(e, i), u = () => {
1386
- var R;
1359
+ onChange: (N) => s == null ? void 0 : s(N)
1360
+ }, { attachment: h, sync: y } = St(e, i), u = () => {
1361
+ var N;
1387
1362
  try {
1388
- const k = window.top;
1363
+ const O = window.top;
1389
1364
  return {
1390
- bridge: k.__REACT_ATTACHMENT_BRIDGE__,
1391
- toast: (R = k.FLUIGC) == null ? void 0 : R.toast
1365
+ bridge: O.__REACT_ATTACHMENT_BRIDGE__,
1366
+ toast: (N = O.FLUIGC) == null ? void 0 : N.toast
1392
1367
  };
1393
1368
  } catch {
1394
1369
  return { bridge: null, toast: null };
1395
1370
  }
1396
1371
  }, m = C(() => {
1397
- if (p || $) return;
1398
- const R = document.createElement("input");
1399
- R.type = "file", R.onchange = (k) => {
1400
- const S = k.target.files[0];
1401
- if (!S) return;
1402
- const { bridge: O, toast: b } = u();
1403
- A(!0), O ? O.upload(S, e, (T) => {
1404
- o ? s == null || s(T.name) : W.onChange(T.name), setTimeout(() => {
1405
- A(!1), f();
1406
- }, 1e3), b && b({
1372
+ if (p) return;
1373
+ const N = document.createElement("input");
1374
+ N.type = "file", N.onchange = (O) => {
1375
+ const k = O.target.files[0];
1376
+ if (!k) return;
1377
+ const { bridge: $, toast: A } = u();
1378
+ _(!0), $ ? $.upload(k, e, (b) => {
1379
+ o ? s == null || s(b.name) : W.onChange(b.name), setTimeout(() => {
1380
+ _(!1), y();
1381
+ }, 1e3), A && A({
1407
1382
  title: "Sucesso",
1408
1383
  message: "Arquivo enviado",
1409
1384
  type: "success"
1410
1385
  });
1411
- }) : (o ? s == null || s(S.name) : W.onChange(S.name), A(!1));
1412
- }, R.click();
1413
- }, [e, W, f, s, p, o, $]), c = (R) => {
1414
- if (R.stopPropagation(), p || $) return;
1415
- const k = (w == null ? void 0 : w.name) || i || W.value;
1416
- if (!k) return;
1417
- const { bridge: S, toast: O } = u();
1418
- S ? S.removeByFileName(k) ? (o ? s == null || s("") : W.onChange(""), f()) : O && O({
1386
+ }) : (o ? s == null || s(k.name) : W.onChange(k.name), _(!1));
1387
+ }, N.click();
1388
+ }, [e, W, y, s, p, o]), d = (N) => {
1389
+ if (N.stopPropagation(), p) return;
1390
+ const O = (h == null ? void 0 : h.name) || i || W.value;
1391
+ if (!O) return;
1392
+ const { bridge: k, toast: $ } = u();
1393
+ k ? k.removeByFileName(O) ? (o ? s == null || s("") : W.onChange(""), y()) : $ && $({
1419
1394
  title: "Erro",
1420
1395
  message: "Erro ao remover anexo",
1421
1396
  type: "danger"
1422
- }) : (o ? s == null || s("") : W.onChange(""), f());
1423
- }, h = !!w && !V, y = (w == null ? void 0 : w.name) || i || W.value, x = [
1397
+ }) : (o ? s == null || s("") : W.onChange(""), y());
1398
+ }, f = !!h && !D, g = (h == null ? void 0 : h.name) || i || W.value, S = [
1424
1399
  "fluig-attachment__box",
1425
- h ? "fluig-attachment__box--has-file" : "",
1426
- V ? "fluig-attachment__box--uploading" : "",
1427
- p ? "readOnly" : ""
1428
- ].join(" "), D = (p || $) && !h;
1429
- return $ ? /* @__PURE__ */ N("div", { className: `form-group fluig-attachment ${g ? "hidden" : ""}`, children: [
1430
- t && /* @__PURE__ */ r("label", { className: "fluig-attachment__label", children: t }),
1431
- /* @__PURE__ */ r("span", { className: "fluig-attachment__box readOnly", children: y || "-" })
1432
- ] }) : /* @__PURE__ */ N("div", { className: `form-group fluig-attachment ${g ? "hidden" : ""}`, children: [
1400
+ f ? "fluig-attachment__box--has-file" : "",
1401
+ D ? "fluig-attachment__box--uploading" : "",
1402
+ p && !f ? "readOnly" : "",
1403
+ p && f ? "fluig-attachment__box--readonly-view" : ""
1404
+ ].join(" ");
1405
+ return V ? null : /* @__PURE__ */ x("div", { className: "form-group fluig-attachment", children: [
1433
1406
  t && /* @__PURE__ */ r("label", { className: "fluig-attachment__label", children: t }),
1434
- /* @__PURE__ */ N(
1407
+ /* @__PURE__ */ x(
1435
1408
  "div",
1436
1409
  {
1437
- className: x,
1438
- style: D ? { pointerEvents: "none", opacity: 0.6, cursor: "not-allowed" } : {},
1410
+ className: S,
1439
1411
  onClick: () => {
1440
- if (h) {
1441
- const R = u();
1442
- R.bridge && y && R.bridge.view(y);
1412
+ if (f) {
1413
+ const N = u(), O = (h == null ? void 0 : h.physicalFileName) || (h == null ? void 0 : h.description) || (h == null ? void 0 : h.name) || g;
1414
+ N.bridge && O && N.bridge.view(O);
1443
1415
  } else
1444
1416
  m();
1445
1417
  },
1446
1418
  children: [
1447
- /* @__PURE__ */ N("span", { className: "fluig-attachment__content", children: [
1419
+ /* @__PURE__ */ x("span", { className: "fluig-attachment__content", children: [
1448
1420
  /* @__PURE__ */ r(
1449
1421
  "i",
1450
1422
  {
1451
- className: `fluigicon icon-sm ${V ? "fluigicon-loop-test" : h ? "fluigicon-file-pdf" : "fluigicon-paperclip"} fluig-attachment__icon`
1423
+ className: `flaticon icon-sm ${D ? "flaticon-loading" : f ? "flaticon-file" : "flaticon-paperclip"} fluig-attachment__icon`
1452
1424
  }
1453
1425
  ),
1454
- /* @__PURE__ */ r("span", { className: "fluig-attachment__filename", children: V ? " Enviando..." : h ? y : p ? "Nenhum arquivo" : n || "Anexar" })
1426
+ /* @__PURE__ */ r("span", { className: "fluig-attachment__filename", children: D ? " Enviando..." : f ? g : p ? "Nenhum arquivo" : n || "Anexar" })
1455
1427
  ] }),
1456
- h && !p && !$ && /* @__PURE__ */ r(
1428
+ f && !p && /* @__PURE__ */ r(
1457
1429
  "button",
1458
1430
  {
1459
1431
  type: "button",
1460
1432
  className: "fluig-attachment__btn-remove btn btn-link text-danger",
1461
- onClick: c,
1433
+ onClick: d,
1462
1434
  children: /* @__PURE__ */ r("i", { className: "flaticon flaticon-trash icon-sm" })
1463
1435
  }
1464
1436
  )
1465
1437
  ]
1466
1438
  }
1467
1439
  ),
1468
- !o && _ && /* @__PURE__ */ r("input", { type: "hidden", name: e, value: W.value || "" })
1440
+ !o && P && /* @__PURE__ */ r("input", { type: "hidden", name: e, value: W.value || "" })
1469
1441
  ] });
1470
- }, Lt = z(St);
1471
- function Ft({
1442
+ }, Ft = z(Rt);
1443
+ function It({
1472
1444
  title: e,
1473
1445
  isOpen: t,
1474
1446
  onOpen: n,
1475
1447
  onClose: i,
1476
1448
  content: s,
1477
- footer: d,
1449
+ footer: c,
1478
1450
  width: l
1479
1451
  }) {
1480
1452
  const o = C(
@@ -1492,14 +1464,14 @@ function Ft({
1492
1464
  onClick: i,
1493
1465
  "aria-modal": "true",
1494
1466
  role: "dialog",
1495
- children: /* @__PURE__ */ N(
1467
+ children: /* @__PURE__ */ x(
1496
1468
  "div",
1497
1469
  {
1498
1470
  style: { maxWidth: l },
1499
1471
  className: "modal-container",
1500
1472
  onClick: (v) => v.stopPropagation(),
1501
1473
  children: [
1502
- /* @__PURE__ */ N("div", { className: "modal-header", children: [
1474
+ /* @__PURE__ */ x("div", { className: "modal-header", children: [
1503
1475
  /* @__PURE__ */ r("h3", { children: e }),
1504
1476
  /* @__PURE__ */ r(
1505
1477
  "div",
@@ -1519,7 +1491,7 @@ function Ft({
1519
1491
  )
1520
1492
  ] }),
1521
1493
  /* @__PURE__ */ r("div", { className: "modal-content", children: s }),
1522
- d && /* @__PURE__ */ r("div", { className: "modal-footer", children: d })
1494
+ c && /* @__PURE__ */ r("div", { className: "modal-footer", children: c })
1523
1495
  ]
1524
1496
  }
1525
1497
  )
@@ -1527,14 +1499,14 @@ function Ft({
1527
1499
  ) : null;
1528
1500
  }
1529
1501
  export {
1530
- Lt as Attachment,
1502
+ Ft as Attachment,
1531
1503
  Tt as Checkbox,
1532
1504
  Et as DatePicker,
1533
- Dt as Input,
1534
- Ft as Modal,
1505
+ Vt as Input,
1506
+ It as Modal,
1535
1507
  jt as RadioBtn,
1536
- Vt as Select,
1537
- It as SimpleTable,
1508
+ Dt as Select,
1509
+ Lt as SimpleTable,
1538
1510
  Ht as StatusBadge,
1539
1511
  Ct as TextArea
1540
1512
  };