@tech-diefra/fluig-ui 1.1.0 → 1.1.2

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,10 +1,10 @@
1
- import { jsxs as v, jsx as n, Fragment as Z } from "react/jsx-runtime";
2
- import { memo as j, useMemo as W, useCallback as B, useState as G, useRef as J, useEffect as A, forwardRef as K } from "react";
3
- import { useFormContext as D, useController as z, useFormState as ee } from "react-hook-form";
1
+ import { jsxs as w, jsx as n, Fragment as Z } from "react/jsx-runtime";
2
+ import { memo as F, useMemo as A, useCallback as $, useState as B, useRef as U, useEffect as D, forwardRef as K } from "react";
3
+ import { useFormContext as j, useController as H, useFormState as ee } from "react-hook-form";
4
4
  import { IMaskInput as te } from "react-imask";
5
- import { useSection as H, useFluigRuntime as V } from "@fluig-kit/ecm";
6
- import ae, { registerLocale as ne } from "react-datepicker";
7
- import { parse as re, isValid as oe, format as ie } from "date-fns";
5
+ import { useSection as T, useFluigRuntime as W } from "@fluig-kit/ecm";
6
+ import ne, { registerLocale as ae } from "react-datepicker";
7
+ import { parse as re, isValid as ie, format as oe } from "date-fns";
8
8
  const se = {
9
9
  cpf: "000.000.000-00",
10
10
  cnpj: "00.000.000/0000-00",
@@ -15,330 +15,330 @@ function de({
15
15
  name: e,
16
16
  label: a = "",
17
17
  placeholder: t = "",
18
- type: i = "text",
18
+ type: d = "text",
19
19
  mask: r,
20
- className: d = "",
21
- forceReadOnly: s = !1,
22
- forceHidden: c = !1
20
+ className: s = "",
21
+ forceReadOnly: i = !1,
22
+ forceHidden: l = !1
23
23
  }) {
24
- const { isReadOnly: P, isHidden: f } = H(), g = s || !!P(e), b = c || !!f(e), { control: M } = D(), { isView: S } = V(), { field: m } = z({ name: e, control: M }), { errors: p } = ee({ name: e }), h = p == null ? void 0 : p[e], C = W(() => r ? se[r] ?? r : null, [r]), k = B((o) => {
24
+ const { isReadOnly: N, isHidden: h } = T(), f = i || !!N(e), k = l || !!h(e), { control: R } = j(), { isView: S } = W(), { field: b } = H({ name: e, control: R }), { errors: p } = ee({ name: e }), g = p == null ? void 0 : p[e], m = A(() => r ? se[r] ?? r : null, [r]), u = $((o) => {
25
25
  if (!o) return "";
26
- const w = o.replace(/\D/g, "");
27
- return (Number(w) / 100).toLocaleString("pt-BR", {
26
+ const C = o.replace(/\D/g, "");
27
+ return (Number(C) / 100).toLocaleString("pt-BR", {
28
28
  style: "currency",
29
29
  currency: "BRL"
30
30
  });
31
- }, []), x = B(
32
- (o) => i === "monetary" ? k(o) : o,
33
- [i, k]
31
+ }, []), c = $(
32
+ (o) => d === "monetary" ? u(o) : o,
33
+ [d, u]
34
34
  );
35
- return S ? /* @__PURE__ */ v("div", { className: "form-group", children: [
35
+ return S ? /* @__PURE__ */ w("div", { className: "form-group", children: [
36
36
  /* @__PURE__ */ n("label", { children: a }),
37
- /* @__PURE__ */ n("span", { className: "form-control", children: m.value || "-" })
38
- ] }) : /* @__PURE__ */ v("div", { className: `form-group ${b ? "hidden" : ""}`, children: [
37
+ /* @__PURE__ */ n("span", { className: "form-control", children: b.value || "-" })
38
+ ] }) : /* @__PURE__ */ w("div", { className: `form-group ${k ? "hidden" : ""}`, children: [
39
39
  /* @__PURE__ */ n("label", { children: a }),
40
- C ? /* @__PURE__ */ n(
40
+ m ? /* @__PURE__ */ n(
41
41
  te,
42
42
  {
43
43
  name: e,
44
- mask: C,
45
- value: String(m.value ?? ""),
44
+ mask: m,
45
+ value: String(b.value ?? ""),
46
46
  unmask: !1,
47
- onAccept: (o) => m.onChange(x(o)),
47
+ onAccept: (o) => b.onChange(c(o)),
48
48
  placeholder: t,
49
- readOnly: g,
50
- className: `form-control ${h ? "border-red" : ""} ${d}`,
51
- inputRef: m.ref,
52
- onBlur: m.onBlur
49
+ readOnly: f,
50
+ className: `form-control ${g ? "border-red" : ""} ${s}`,
51
+ inputRef: b.ref,
52
+ onBlur: b.onBlur
53
53
  }
54
54
  ) : /* @__PURE__ */ n(
55
55
  "input",
56
56
  {
57
- ...m,
57
+ ...b,
58
58
  type: "text",
59
- value: m.value ?? "",
60
- onChange: (o) => m.onChange(x(o.target.value)),
59
+ value: b.value ?? "",
60
+ onChange: (o) => b.onChange(c(o.target.value)),
61
61
  placeholder: t,
62
- readOnly: g,
63
- className: `form-control ${h ? "border-red" : ""} ${d}`
62
+ readOnly: f,
63
+ className: `form-control ${g ? "border-red" : ""} ${s}`
64
64
  }
65
65
  ),
66
- h && /* @__PURE__ */ n("p", { className: "text-danger", children: String(h.message) })
66
+ g && /* @__PURE__ */ n("p", { className: "text-danger", children: String(g.message) })
67
67
  ] });
68
68
  }
69
- const nt = j(de);
70
- function ce({
69
+ const rt = F(de);
70
+ function le({
71
71
  name: e,
72
72
  label: a = "",
73
73
  options: t = [],
74
- placeholder: i = "",
74
+ placeholder: d = "",
75
75
  labelKey: r = "label",
76
- valueKey: d = "value",
77
- enableSearch: s = !1,
78
- searchPlaceholder: c = "Buscar...",
79
- loading: P = !1,
80
- onSearchChange: f,
81
- debounceTime: g = 300,
82
- onSelect: b,
83
- forceReadOnly: M = !1,
76
+ valueKey: s = "value",
77
+ enableSearch: i = !1,
78
+ searchPlaceholder: l = "Buscar...",
79
+ loading: N = !1,
80
+ onSearchChange: h,
81
+ debounceTime: f = 300,
82
+ onSelect: k,
83
+ forceReadOnly: R = !1,
84
84
  forceHidden: S = !1
85
85
  }) {
86
- const { isReadOnly: m, isHidden: p } = H(), h = M || !!m(e), C = S || !!p(e), { control: k, clearErrors: x } = D(), { isView: o } = V(), {
87
- field: { onChange: w, value: y, ref: $ },
88
- fieldState: { error: l }
89
- } = z({
86
+ const { isReadOnly: b, isHidden: p } = T(), g = R || !!b(e), m = S || !!p(e), { control: u, clearErrors: c } = j(), { isView: o } = W(), {
87
+ field: { onChange: C, value: x, ref: V },
88
+ fieldState: { error: y }
89
+ } = H({
90
90
  name: e,
91
- control: k
92
- }), [N, O] = G(!1), [R, X] = G(""), L = J(null), I = J(f);
93
- A(() => {
94
- I.current = f;
95
- }, [f]), A(() => {
96
- const u = (F) => {
97
- L.current && !L.current.contains(F.target) && O(!1);
91
+ control: u
92
+ }), [P, O] = B(!1), [M, Y] = B(""), z = U(null), I = U(h);
93
+ D(() => {
94
+ I.current = h;
95
+ }, [h]), D(() => {
96
+ const v = (_) => {
97
+ z.current && !z.current.contains(_.target) && O(!1);
98
98
  };
99
- return document.addEventListener("mousedown", u), () => document.removeEventListener("mousedown", u);
100
- }, []), A(() => {
101
- N || X("");
102
- }, [N]), A(() => {
103
- if (!s) return;
104
- const u = setTimeout(() => {
105
- I.current && I.current(R);
106
- }, g);
107
- return () => clearTimeout(u);
108
- }, [R, s, g]);
109
- const Y = W(() => s && !f && R.trim() ? t.filter(
110
- (u) => String((u == null ? void 0 : u[r]) ?? "").toLowerCase().includes(R.toLowerCase())
111
- ) : t ?? [], [t, s, f, R, r]), Q = W(() => {
112
- if (y == null) return "";
113
- if (typeof y == "object")
114
- return String(y[d] ?? "");
115
- const u = (t || []).find(
116
- (F) => String(F == null ? void 0 : F[d]) === String(y)
99
+ return document.addEventListener("mousedown", v), () => document.removeEventListener("mousedown", v);
100
+ }, []), D(() => {
101
+ P || Y("");
102
+ }, [P]), D(() => {
103
+ if (!i) return;
104
+ const v = setTimeout(() => {
105
+ I.current && I.current(M);
106
+ }, f);
107
+ return () => clearTimeout(v);
108
+ }, [M, i, f]);
109
+ const Q = A(() => i && !h && M.trim() ? t.filter(
110
+ (v) => String((v == null ? void 0 : v[r]) ?? "").toLowerCase().includes(M.toLowerCase())
111
+ ) : t ?? [], [t, i, h, M, r]), J = A(() => {
112
+ if (x == null) return "";
113
+ if (typeof x == "object")
114
+ return String(x[s] ?? "");
115
+ const v = (t || []).find(
116
+ (_) => String(_ == null ? void 0 : _[s]) === String(x)
117
117
  );
118
- return String(u ? (u == null ? void 0 : u[r]) ?? "" : y);
119
- }, [y, t, d, r]), U = (u) => {
120
- h || (w(u[d]), b && b(u), x(e), O(!1));
118
+ return String(v ? (v == null ? void 0 : v[r]) ?? "" : x);
119
+ }, [x, t, s, r]), G = (v) => {
120
+ g || (C(v[s]), k && k(v), c(e), O(!1));
121
121
  };
122
- return /* @__PURE__ */ v(
122
+ return /* @__PURE__ */ w(
123
123
  "div",
124
124
  {
125
- className: `select-wrapper form-group ${C ? "hidden" : ""}`,
126
- ref: L,
125
+ className: `select-wrapper form-group ${m ? "hidden" : ""}`,
126
+ ref: z,
127
127
  children: [
128
128
  /* @__PURE__ */ n("label", { className: "control-label", children: a }),
129
- o ? /* @__PURE__ */ n("span", { className: "form-control", children: Q || "-" }) : /* @__PURE__ */ v(Z, { children: [
130
- /* @__PURE__ */ v(
129
+ o ? /* @__PURE__ */ n("span", { className: "form-control", children: J || "-" }) : /* @__PURE__ */ w(Z, { children: [
130
+ /* @__PURE__ */ w(
131
131
  "div",
132
132
  {
133
- className: `select-control ${l ? "border-red" : ""} ${h ? "readOnly" : ""}`,
134
- onClick: () => !h && O((u) => !u),
135
- ref: $,
133
+ className: `select-control ${y ? "border-red" : ""} ${g ? "readOnly" : ""}`,
134
+ onClick: () => !g && O((v) => !v),
135
+ ref: V,
136
136
  children: [
137
- /* @__PURE__ */ n("span", { className: `select-display ${h ? "readOnly" : ""}`, children: Q || i }),
137
+ /* @__PURE__ */ n("span", { className: `select-display ${g ? "readOnly" : ""}`, children: J || d }),
138
138
  /* @__PURE__ */ n("i", { className: "flaticon flaticon-chevron-down select-icon" })
139
139
  ]
140
140
  }
141
141
  ),
142
- N && !h && /* @__PURE__ */ v("div", { className: "select-dropdown", children: [
143
- s && /* @__PURE__ */ n("div", { className: "select-search", children: /* @__PURE__ */ n(
142
+ P && !g && /* @__PURE__ */ w("div", { className: "select-dropdown", children: [
143
+ i && /* @__PURE__ */ n("div", { className: "select-search", children: /* @__PURE__ */ n(
144
144
  "input",
145
145
  {
146
146
  type: "text",
147
147
  className: "select-search-input",
148
- value: R,
149
- onChange: (u) => X(u.target.value),
150
- placeholder: P ? "Carregando..." : c,
148
+ value: M,
149
+ onChange: (v) => Y(v.target.value),
150
+ placeholder: N ? "Carregando..." : l,
151
151
  autoFocus: !0,
152
- onClick: (u) => u.stopPropagation()
152
+ onClick: (v) => v.stopPropagation()
153
153
  }
154
154
  ) }),
155
- /* @__PURE__ */ n("ul", { className: "select-options", children: P ? /* @__PURE__ */ n("li", { className: "select-option readOnly", children: "Carregando..." }) : Y.length > 0 ? Y.map((u) => /* @__PURE__ */ n(
155
+ /* @__PURE__ */ n("ul", { className: "select-options", children: N ? /* @__PURE__ */ n("li", { className: "select-option readOnly", children: "Carregando..." }) : Q.length > 0 ? Q.map((v) => /* @__PURE__ */ n(
156
156
  "li",
157
157
  {
158
- onClick: () => U(u),
158
+ onClick: () => G(v),
159
159
  className: "select-option handleHover",
160
- children: u[r]
160
+ children: v[r]
161
161
  },
162
- u[d]
162
+ v[s]
163
163
  )) : /* @__PURE__ */ n("li", { className: "select-option readOnly", children: "Sem resultados" }) })
164
164
  ] })
165
165
  ] }),
166
- /* @__PURE__ */ n("input", { type: "hidden", name: e, value: y || "" }),
167
- l && /* @__PURE__ */ n("p", { className: "text-danger", children: String(l.message) })
166
+ /* @__PURE__ */ n("input", { type: "hidden", name: e, value: x || "" }),
167
+ y && /* @__PURE__ */ n("p", { className: "text-danger", children: String(y.message) })
168
168
  ]
169
169
  }
170
170
  );
171
171
  }
172
- const rt = j(ce);
172
+ const it = F(le);
173
173
  function ot({
174
174
  name: e,
175
175
  options: a = [],
176
176
  label: t = "",
177
- valueKey: i = "value",
177
+ valueKey: d = "value",
178
178
  labelKey: r = "label",
179
- forceReadOnly: d = !1,
180
- forceHidden: s = !1
179
+ forceReadOnly: s = !1,
180
+ forceHidden: i = !1
181
181
  }) {
182
- var y, $;
183
- const c = D(), { isView: P, isReadOnly: f } = V(), { isReadOnly: g, isHidden: b } = H(), M = g ? g(e) : !1, S = b ? b(e) : !1, m = d || M, p = s || S, h = m || f || P;
184
- if (!c || !e)
182
+ var x, V;
183
+ const l = j(), { isView: N, isReadOnly: h } = W(), { isReadOnly: f, isHidden: k } = T(), R = f ? f(e) : !1, S = k ? k(e) : !1, b = s || R, p = i || S, g = b || h || N;
184
+ if (!l || !e)
185
185
  return console.error("Checkbox requer contexto de formulário e nome."), null;
186
- const C = () => !a || !c ? {} : a.reduce((l, N) => {
187
- const O = N[i], R = c.getValues(O);
188
- return l[O] = R === "on", l;
189
- }, {}), k = c.watch(e), x = W(() => k && typeof k == "object" ? k : C(), [k, a, i]);
190
- A(() => {
191
- const l = c.getValues(e);
192
- (!l || typeof l != "object") && c.setValue(e, x, {
186
+ const m = () => !a || !l ? {} : a.reduce((y, P) => {
187
+ const O = P[d], M = l.getValues(O);
188
+ return y[O] = M === "on", y;
189
+ }, {}), u = l.watch(e), c = A(() => u && typeof u == "object" ? u : m(), [u, a, d]);
190
+ D(() => {
191
+ const y = l.getValues(e);
192
+ (!y || typeof y != "object") && l.setValue(e, c, {
193
193
  shouldDirty: !1,
194
194
  shouldValidate: !1
195
195
  });
196
- }, [x, e, c]);
197
- const o = (l, N) => {
198
- if (h) return;
199
- const O = { ...x, [l]: N };
200
- c.setValue(e, O, {
196
+ }, [c, e, l]);
197
+ const o = (y, P) => {
198
+ if (g) return;
199
+ const O = { ...c, [y]: P };
200
+ l.setValue(e, O, {
201
201
  shouldDirty: !0,
202
202
  shouldValidate: !0
203
- }), c.setValue(l, N ? "on" : "", { shouldValidate: !1 });
204
- }, w = ($ = (y = c.formState) == null ? void 0 : y.errors) == null ? void 0 : $[e];
205
- return /* @__PURE__ */ v("div", { className: `form-group ${p ? "hidden" : ""}`, children: [
203
+ }), l.setValue(y, P ? "on" : "", { shouldValidate: !1 });
204
+ }, C = (V = (x = l.formState) == null ? void 0 : x.errors) == null ? void 0 : V[e];
205
+ return /* @__PURE__ */ w("div", { className: `form-group ${p ? "hidden" : ""}`, children: [
206
206
  t && /* @__PURE__ */ n("label", { children: t }),
207
207
  /* @__PURE__ */ n(
208
208
  "div",
209
209
  {
210
- className: `checkbox-group-custom ${h ? "readOnly" : ""}`,
211
- children: a.map((l) => {
212
- const N = String(l[i]), O = x[N] === !0;
213
- return /* @__PURE__ */ v("div", { children: [
214
- /* @__PURE__ */ n("input", { type: "hidden", ...c.register(N) }),
215
- /* @__PURE__ */ v(
210
+ className: `checkbox-group-custom ${g ? "readOnly" : ""}`,
211
+ children: a.map((y) => {
212
+ const P = String(y[d]), O = c[P] === !0;
213
+ return /* @__PURE__ */ w("div", { children: [
214
+ /* @__PURE__ */ n("input", { type: "hidden", ...l.register(P) }),
215
+ /* @__PURE__ */ w(
216
216
  "label",
217
217
  {
218
- className: `custom-checkbox ${O ? "checked" : ""} ${h ? "readOnly" : ""}`,
218
+ className: `custom-checkbox ${O ? "checked" : ""} ${g ? "readOnly" : ""}`,
219
219
  children: [
220
220
  /* @__PURE__ */ n(
221
221
  "input",
222
222
  {
223
223
  type: "checkbox",
224
224
  checked: O,
225
- disabled: h,
226
- onChange: (R) => o(N, R.target.checked)
225
+ disabled: g,
226
+ onChange: (M) => o(P, M.target.checked)
227
227
  }
228
228
  ),
229
229
  /* @__PURE__ */ n("span", { className: "checkmark" }),
230
- /* @__PURE__ */ n("span", { children: l[r] })
230
+ /* @__PURE__ */ n("span", { children: y[r] })
231
231
  ]
232
232
  }
233
233
  )
234
- ] }, N);
234
+ ] }, P);
235
235
  })
236
236
  }
237
237
  ),
238
- w && /* @__PURE__ */ n("p", { className: "text-danger", children: String(w.message) })
238
+ C && /* @__PURE__ */ n("p", { className: "text-danger", children: String(C.message) })
239
239
  ] });
240
240
  }
241
- function le({
241
+ function ce({
242
242
  name: e,
243
243
  label: a = "",
244
244
  options: t = [],
245
- valueKey: i = "value",
245
+ valueKey: d = "value",
246
246
  labelKey: r = "label",
247
- iconKey: d = "icon",
248
- forceReadOnly: s = !1,
249
- forceHidden: c = !1
247
+ iconKey: s = "icon",
248
+ forceReadOnly: i = !1,
249
+ forceHidden: l = !1
250
250
  }) {
251
- const { isReadOnly: P, isHidden: f } = H(), g = s || !!P(e), b = c || !!f(e), { control: M } = D(), { isView: S, isReadOnly: m } = V(), {
251
+ const { isReadOnly: N, isHidden: h } = T(), f = i || !!N(e), k = l || !!h(e), { control: R } = j(), { isView: S, isReadOnly: b } = W(), {
252
252
  field: p,
253
- fieldState: { error: h }
254
- } = z({
253
+ fieldState: { error: g }
254
+ } = H({
255
255
  name: e,
256
- control: M
257
- }), C = g || m || S, k = p.value ?? "", x = B(
256
+ control: R
257
+ }), m = f || b || S, u = p.value ?? "", c = $(
258
258
  (o) => {
259
- C || p.onChange(o);
259
+ m || p.onChange(o);
260
260
  },
261
- [C, p]
261
+ [m, p]
262
262
  );
263
- return /* @__PURE__ */ v("div", { className: `form-group column ${b ? "hidden" : ""}`, children: [
263
+ return /* @__PURE__ */ w("div", { className: `form-group column ${k ? "hidden" : ""}`, children: [
264
264
  a && /* @__PURE__ */ n("label", { className: "control-label", children: a }),
265
265
  /* @__PURE__ */ n(
266
266
  "div",
267
267
  {
268
- className: `btn-group ${C ? "view-mode" : ""}`,
268
+ className: `btn-group ${m ? "view-mode" : ""}`,
269
269
  "data-field-name": e,
270
270
  children: t.map((o) => {
271
- const w = o[i], y = k === w, $ = o.color ? { "--customColor": o.color } : void 0;
272
- return /* @__PURE__ */ v(
271
+ const C = o[d], x = u === C, V = o.color ? { "--customColor": o.color } : void 0;
272
+ return /* @__PURE__ */ w(
273
273
  "label",
274
274
  {
275
- htmlFor: `${e}_${w}`,
276
- style: $,
277
- className: `btn fs-ellipsis ${y ? "active" : ""}`,
275
+ htmlFor: `${e}_${C}`,
276
+ style: V,
277
+ className: `btn fs-ellipsis ${x ? "active" : ""}`,
278
278
  children: [
279
279
  /* @__PURE__ */ n(
280
280
  "input",
281
281
  {
282
282
  type: "radio",
283
- id: `${e}_${w}`,
283
+ id: `${e}_${C}`,
284
284
  name: e,
285
- value: w,
286
- checked: y,
285
+ value: C,
286
+ checked: x,
287
287
  className: "hidden",
288
- onChange: () => x(w),
289
- disabled: C
288
+ onChange: () => c(C),
289
+ disabled: m
290
290
  }
291
291
  ),
292
- o[d] && /* @__PURE__ */ n("i", { className: `${o[d]} icon-sm` }),
292
+ o[s] && /* @__PURE__ */ n("i", { className: `${o[s]} icon-sm` }),
293
293
  " ",
294
294
  o[r]
295
295
  ]
296
296
  },
297
- w
297
+ C
298
298
  );
299
299
  })
300
300
  }
301
301
  ),
302
- h && /* @__PURE__ */ n("p", { className: "text-danger", children: String(h.message) })
302
+ g && /* @__PURE__ */ n("p", { className: "text-danger", children: String(g.message) })
303
303
  ] });
304
304
  }
305
- const it = j(le), ue = ({
305
+ const st = F(ce), ue = ({
306
306
  name: e,
307
307
  label: a = "",
308
308
  placeholder: t = "",
309
- className: i = "",
309
+ className: d = "",
310
310
  rows: r = 4,
311
- maxLength: d,
312
- forceReadOnly: s = !1,
313
- forceHidden: c = !1
311
+ maxLength: s,
312
+ forceReadOnly: i = !1,
313
+ forceHidden: l = !1
314
314
  }) => {
315
- const { isReadOnly: P, isHidden: f } = H(), g = s || !!P(e), b = c || !!f(e), { control: M } = D(), { isView: S } = V(), {
316
- field: m,
315
+ const { isReadOnly: N, isHidden: h } = T(), f = i || !!N(e), k = l || !!h(e), { control: R } = j(), { isView: S } = W(), {
316
+ field: b,
317
317
  fieldState: { error: p }
318
- } = z({
318
+ } = H({
319
319
  name: e,
320
- control: M
320
+ control: R
321
321
  });
322
- return S ? /* @__PURE__ */ v("div", { className: `form-group ${b ? "hidden" : ""}`, children: [
322
+ return S ? /* @__PURE__ */ w("div", { className: `form-group ${k ? "hidden" : ""}`, children: [
323
323
  /* @__PURE__ */ n("label", { children: a }),
324
- /* @__PURE__ */ n("span", { className: "form-control", children: m.value || "-" })
325
- ] }) : /* @__PURE__ */ v("div", { className: `form-group ${b ? "hidden" : ""}`, children: [
324
+ /* @__PURE__ */ n("span", { className: "form-control", children: b.value || "-" })
325
+ ] }) : /* @__PURE__ */ w("div", { className: `form-group ${k ? "hidden" : ""}`, children: [
326
326
  /* @__PURE__ */ n("label", { children: a }),
327
327
  /* @__PURE__ */ n(
328
328
  "textarea",
329
329
  {
330
- ...m,
330
+ ...b,
331
331
  rows: r,
332
- maxLength: d,
333
- value: m.value || "",
332
+ maxLength: s,
333
+ value: b.value || "",
334
334
  placeholder: t,
335
- readOnly: g,
336
- className: `form-control ${p ? "border-red" : ""} ${i}`
335
+ readOnly: f,
336
+ className: `form-control ${p ? "border-red" : ""} ${d}`
337
337
  }
338
338
  ),
339
339
  p && /* @__PURE__ */ n("p", { className: "text-danger", children: String(p.message) })
340
340
  ] });
341
- }, st = j(ue);
341
+ }, dt = F(ue);
342
342
  function E(e) {
343
343
  return (a = {}) => {
344
344
  const t = a.width ? String(a.width) : e.defaultWidth;
@@ -347,35 +347,35 @@ function E(e) {
347
347
  }
348
348
  function q(e) {
349
349
  return (a, t) => {
350
- const i = t != null && t.context ? String(t.context) : "standalone";
350
+ const d = t != null && t.context ? String(t.context) : "standalone";
351
351
  let r;
352
- if (i === "formatting" && e.formattingValues) {
353
- const s = e.defaultFormattingWidth || e.defaultWidth, c = t != null && t.width ? String(t.width) : s;
354
- r = e.formattingValues[c] || e.formattingValues[s];
352
+ if (d === "formatting" && e.formattingValues) {
353
+ const i = e.defaultFormattingWidth || e.defaultWidth, l = t != null && t.width ? String(t.width) : i;
354
+ r = e.formattingValues[l] || e.formattingValues[i];
355
355
  } else {
356
- const s = e.defaultWidth, c = t != null && t.width ? String(t.width) : e.defaultWidth;
357
- r = e.values[c] || e.values[s];
356
+ const i = e.defaultWidth, l = t != null && t.width ? String(t.width) : e.defaultWidth;
357
+ r = e.values[l] || e.values[i];
358
358
  }
359
- const d = e.argumentCallback ? e.argumentCallback(a) : a;
360
- return r[d];
359
+ const s = e.argumentCallback ? e.argumentCallback(a) : a;
360
+ return r[s];
361
361
  };
362
362
  }
363
- function T(e) {
363
+ function L(e) {
364
364
  return (a, t = {}) => {
365
- const i = t.width, r = i && e.matchPatterns[i] || e.matchPatterns[e.defaultMatchWidth], d = a.match(r);
366
- if (!d)
365
+ const d = t.width, r = d && e.matchPatterns[d] || e.matchPatterns[e.defaultMatchWidth], s = a.match(r);
366
+ if (!s)
367
367
  return null;
368
- const s = d[0], c = i && e.parsePatterns[i] || e.parsePatterns[e.defaultParseWidth], P = Array.isArray(c) ? he(c, (b) => b.test(s)) : (
368
+ const i = s[0], l = d && e.parsePatterns[d] || e.parsePatterns[e.defaultParseWidth], N = Array.isArray(l) ? he(l, (k) => k.test(i)) : (
369
369
  // [TODO] -- I challenge you to fix the type
370
- me(c, (b) => b.test(s))
370
+ me(l, (k) => k.test(i))
371
371
  );
372
- let f;
373
- f = e.valueCallback ? e.valueCallback(P) : P, f = t.valueCallback ? (
372
+ let h;
373
+ h = e.valueCallback ? e.valueCallback(N) : N, h = t.valueCallback ? (
374
374
  // [TODO] -- I challenge you to fix the type
375
- t.valueCallback(f)
376
- ) : f;
377
- const g = a.slice(s.length);
378
- return { value: f, rest: g };
375
+ t.valueCallback(h)
376
+ ) : h;
377
+ const f = a.slice(i.length);
378
+ return { value: h, rest: f };
379
379
  };
380
380
  }
381
381
  function me(e, a) {
@@ -390,14 +390,14 @@ function he(e, a) {
390
390
  }
391
391
  function fe(e) {
392
392
  return (a, t = {}) => {
393
- const i = a.match(e.matchPattern);
394
- if (!i) return null;
395
- const r = i[0], d = a.match(e.parsePattern);
393
+ const d = a.match(e.matchPattern);
396
394
  if (!d) return null;
397
- let s = e.valueCallback ? e.valueCallback(d[0]) : d[0];
398
- s = t.valueCallback ? t.valueCallback(s) : s;
399
- const c = a.slice(r.length);
400
- return { value: s, rest: c };
395
+ const r = d[0], s = a.match(e.parsePattern);
396
+ if (!s) return null;
397
+ let i = e.valueCallback ? e.valueCallback(s[0]) : s[0];
398
+ i = t.valueCallback ? t.valueCallback(i) : i;
399
+ const l = a.slice(r.length);
400
+ return { value: i, rest: l };
401
401
  };
402
402
  }
403
403
  const ge = {
@@ -463,9 +463,9 @@ const ge = {
463
463
  other: "quase {{count}} anos"
464
464
  }
465
465
  }, be = (e, a, t) => {
466
- let i;
466
+ let d;
467
467
  const r = ge[e];
468
- return typeof r == "string" ? i = r : a === 1 ? i = r.one : i = r.other.replace("{{count}}", String(a)), t != null && t.addSuffix ? t.comparison && t.comparison > 0 ? "em " + i : "há " + i : i;
468
+ return typeof r == "string" ? d = r : a === 1 ? d = r.one : d = r.other.replace("{{count}}", String(a)), t != null && t.addSuffix ? t.comparison && t.comparison > 0 ? "em " + d : "há " + d : d;
469
469
  }, pe = {
470
470
  full: "EEEE, d 'de' MMMM 'de' y",
471
471
  long: "d 'de' MMMM 'de' y",
@@ -504,18 +504,18 @@ const ge = {
504
504
  tomorrow: "'amanhã às' p",
505
505
  nextWeek: "eeee 'às' p",
506
506
  other: "P"
507
- }, Pe = (e, a, t, i) => {
507
+ }, ke = (e, a, t, d) => {
508
508
  const r = Ne[e];
509
509
  return typeof r == "function" ? r(a) : r;
510
- }, Ce = {
510
+ }, xe = {
511
511
  narrow: ["AC", "DC"],
512
512
  abbreviated: ["AC", "DC"],
513
513
  wide: ["antes de cristo", "depois de cristo"]
514
- }, ke = {
514
+ }, Ce = {
515
515
  narrow: ["1", "2", "3", "4"],
516
516
  abbreviated: ["T1", "T2", "T3", "T4"],
517
517
  wide: ["1º trimestre", "2º trimestre", "3º trimestre", "4º trimestre"]
518
- }, xe = {
518
+ }, Se = {
519
519
  narrow: ["j", "f", "m", "a", "m", "j", "j", "a", "s", "o", "n", "d"],
520
520
  abbreviated: [
521
521
  "jan",
@@ -545,7 +545,7 @@ const ge = {
545
545
  "novembro",
546
546
  "dezembro"
547
547
  ]
548
- }, Me = {
548
+ }, Re = {
549
549
  narrow: ["D", "S", "T", "Q", "Q", "S", "S"],
550
550
  short: ["dom", "seg", "ter", "qua", "qui", "sex", "sab"],
551
551
  abbreviated: [
@@ -566,7 +566,7 @@ const ge = {
566
566
  "sexta-feira",
567
567
  "sábado"
568
568
  ]
569
- }, Se = {
569
+ }, Pe = {
570
570
  narrow: {
571
571
  am: "a",
572
572
  pm: "p",
@@ -628,52 +628,52 @@ const ge = {
628
628
  evening: "da tarde",
629
629
  night: "da noite"
630
630
  }
631
- }, Re = (e, a) => {
631
+ }, Me = (e, a) => {
632
632
  const t = Number(e);
633
633
  return (a == null ? void 0 : a.unit) === "week" ? t + "ª" : t + "º";
634
634
  }, $e = {
635
- ordinalNumber: Re,
635
+ ordinalNumber: Me,
636
636
  era: q({
637
- values: Ce,
637
+ values: xe,
638
638
  defaultWidth: "wide"
639
639
  }),
640
640
  quarter: q({
641
- values: ke,
641
+ values: Ce,
642
642
  defaultWidth: "wide",
643
643
  argumentCallback: (e) => e - 1
644
644
  }),
645
645
  month: q({
646
- values: xe,
646
+ values: Se,
647
647
  defaultWidth: "wide"
648
648
  }),
649
649
  day: q({
650
- values: Me,
650
+ values: Re,
651
651
  defaultWidth: "wide"
652
652
  }),
653
653
  dayPeriod: q({
654
- values: Se,
654
+ values: Pe,
655
655
  defaultWidth: "wide",
656
656
  formattingValues: Oe,
657
657
  defaultFormattingWidth: "wide"
658
658
  })
659
- }, Ve = /^(\d+)[ºªo]?/i, We = /\d+/i, je = {
659
+ }, Ve = /^(\d+)[ºªo]?/i, We = /\d+/i, De = {
660
660
  narrow: /^(ac|dc|a|d)/i,
661
661
  abbreviated: /^(a\.?\s?c\.?|d\.?\s?c\.?)/i,
662
662
  wide: /^(antes de cristo|depois de cristo)/i
663
- }, De = {
663
+ }, je = {
664
664
  any: [/^ac/i, /^dc/i],
665
665
  wide: [/^antes de cristo/i, /^depois de cristo/i]
666
- }, He = {
666
+ }, Te = {
667
667
  narrow: /^[1234]/i,
668
668
  abbreviated: /^T[1234]/i,
669
669
  wide: /^[1234](º)? trimestre/i
670
- }, Fe = {
670
+ }, Ae = {
671
671
  any: [/1/i, /2/i, /3/i, /4/i]
672
- }, qe = {
672
+ }, Fe = {
673
673
  narrow: /^[jfmajsond]/i,
674
674
  abbreviated: /^(jan|fev|mar|abr|mai|jun|jul|ago|set|out|nov|dez)/i,
675
675
  wide: /^(janeiro|fevereiro|março|abril|maio|junho|julho|agosto|setembro|outubro|novembro|dezembro)/i
676
- }, Te = {
676
+ }, He = {
677
677
  narrow: [
678
678
  /^j/i,
679
679
  /^f/i,
@@ -702,19 +702,19 @@ const ge = {
702
702
  /^nov/i,
703
703
  /^dez/i
704
704
  ]
705
- }, Ae = {
705
+ }, _e = {
706
706
  narrow: /^(dom|[23456]ª?|s[aá]b)/i,
707
707
  short: /^(dom|[23456]ª?|s[aá]b)/i,
708
708
  abbreviated: /^(dom|seg|ter|qua|qui|sex|s[aá]b)/i,
709
709
  wide: /^(domingo|(segunda|ter[cç]a|quarta|quinta|sexta)([- ]feira)?|s[aá]bado)/i
710
- }, Be = {
710
+ }, qe = {
711
711
  short: [/^d/i, /^2/i, /^3/i, /^4/i, /^5/i, /^6/i, /^s[aá]/i],
712
712
  narrow: [/^d/i, /^2/i, /^3/i, /^4/i, /^5/i, /^6/i, /^s[aá]/i],
713
713
  any: [/^d/i, /^seg/i, /^t/i, /^qua/i, /^qui/i, /^sex/i, /^s[aá]b/i]
714
- }, ze = {
714
+ }, Le = {
715
715
  narrow: /^(a|p|mn|md|(da) (manhã|tarde|noite))/i,
716
716
  any: /^([ap]\.?\s?m\.?|meia[-\s]noite|meio[-\s]dia|(da) (manhã|tarde|noite))/i
717
- }, Le = {
717
+ }, Be = {
718
718
  any: {
719
719
  am: /^a/i,
720
720
  pm: /^p/i,
@@ -725,69 +725,69 @@ const ge = {
725
725
  evening: /tarde/i,
726
726
  night: /noite/i
727
727
  }
728
- }, Ie = {
728
+ }, ze = {
729
729
  ordinalNumber: fe({
730
730
  matchPattern: Ve,
731
731
  parsePattern: We,
732
732
  valueCallback: (e) => parseInt(e, 10)
733
733
  }),
734
- era: T({
735
- matchPatterns: je,
734
+ era: L({
735
+ matchPatterns: De,
736
736
  defaultMatchWidth: "wide",
737
- parsePatterns: De,
737
+ parsePatterns: je,
738
738
  defaultParseWidth: "any"
739
739
  }),
740
- quarter: T({
741
- matchPatterns: He,
740
+ quarter: L({
741
+ matchPatterns: Te,
742
742
  defaultMatchWidth: "wide",
743
- parsePatterns: Fe,
743
+ parsePatterns: Ae,
744
744
  defaultParseWidth: "any",
745
745
  valueCallback: (e) => e + 1
746
746
  }),
747
- month: T({
748
- matchPatterns: qe,
747
+ month: L({
748
+ matchPatterns: Fe,
749
749
  defaultMatchWidth: "wide",
750
- parsePatterns: Te,
750
+ parsePatterns: He,
751
751
  defaultParseWidth: "any"
752
752
  }),
753
- day: T({
754
- matchPatterns: Ae,
753
+ day: L({
754
+ matchPatterns: _e,
755
755
  defaultMatchWidth: "wide",
756
- parsePatterns: Be,
756
+ parsePatterns: qe,
757
757
  defaultParseWidth: "any"
758
758
  }),
759
- dayPeriod: T({
760
- matchPatterns: ze,
759
+ dayPeriod: L({
760
+ matchPatterns: Le,
761
761
  defaultMatchWidth: "any",
762
- parsePatterns: Le,
762
+ parsePatterns: Be,
763
763
  defaultParseWidth: "any"
764
764
  })
765
- }, Ee = {
765
+ }, Ie = {
766
766
  code: "pt-BR",
767
767
  formatDistance: be,
768
768
  formatLong: we,
769
- formatRelative: Pe,
769
+ formatRelative: ke,
770
770
  localize: $e,
771
- match: Ie,
771
+ match: ze,
772
772
  options: {
773
773
  weekStartsOn: 0,
774
774
  firstWeekContainsDate: 1
775
775
  }
776
776
  };
777
- ne("pt-BR", Ee);
778
- const _ = "dd/MM/yyyy", _e = (e) => {
777
+ ae("pt-BR", Ie);
778
+ const X = "dd/MM/yyyy", Ee = (e) => {
779
779
  if (!e) return null;
780
- const a = re(e, _, /* @__PURE__ */ new Date());
781
- return oe(a) ? a : null;
782
- }, Xe = (e) => e ? ie(e, _) : "", Ye = K(
783
- ({ shimRef: e, className: a, name: t, ...i }, r) => /* @__PURE__ */ n(
780
+ const a = re(e, X, /* @__PURE__ */ new Date());
781
+ return ie(a) ? a : null;
782
+ }, Xe = (e) => e ? oe(e, X) : "", Ye = K(
783
+ ({ shimRef: e, className: a, name: t, ...d }, r) => /* @__PURE__ */ n(
784
784
  "input",
785
785
  {
786
786
  name: t,
787
- ...i,
787
+ ...d,
788
788
  className: a,
789
- ref: (d) => {
790
- typeof r == "function" ? r(d) : r && (r.current = d), e && e(d);
789
+ ref: (s) => {
790
+ typeof r == "function" ? r(s) : r && (r.current = s), e && e(s);
791
791
  }
792
792
  }
793
793
  )
@@ -795,110 +795,276 @@ const _ = "dd/MM/yyyy", _e = (e) => {
795
795
  name: e,
796
796
  label: a = "",
797
797
  placeholder: t = "dd/mm/aaaa",
798
- className: i = "",
798
+ className: d = "",
799
799
  forceReadOnly: r = !1,
800
- forceHidden: d = !1
800
+ forceHidden: s = !1
801
801
  }) => {
802
- const { control: s } = D(), { isView: c } = V(), { isReadOnly: P, isHidden: f } = H(), g = r || !!P(e), b = d || !!f(e), {
803
- field: { onChange: M, onBlur: S, value: m, ref: p },
804
- fieldState: { error: h }
805
- } = z({
802
+ const { control: i } = j(), { isView: l } = W(), { isReadOnly: N, isHidden: h } = T(), f = r || !!N(e), k = s || !!h(e), {
803
+ field: { onChange: R, onBlur: S, value: b, ref: p },
804
+ fieldState: { error: g }
805
+ } = H({
806
806
  name: e,
807
- control: s
808
- }), C = W(() => _e(m), [m]), k = B(
807
+ control: i
808
+ }), m = A(() => Ee(b), [b]), u = $(
809
809
  (o) => {
810
- M(o ? Xe(o) : "");
810
+ R(o ? Xe(o) : "");
811
811
  },
812
- [M]
813
- ), x = B(
812
+ [R]
813
+ ), c = $(
814
814
  (o) => {
815
- var w, y;
816
- if (p(o), o && ((y = (w = s._fields) == null ? void 0 : w[e]) != null && y._f)) {
817
- const $ = s._fields[e];
818
- $._f.ref = {
815
+ var C, x;
816
+ if (p(o), o && ((x = (C = i._fields) == null ? void 0 : C[e]) != null && x._f)) {
817
+ const V = i._fields[e];
818
+ V._f.ref = {
819
819
  focus: () => {
820
- var l;
821
- return (l = o.focus) == null ? void 0 : l.call(o);
820
+ var y;
821
+ return (y = o.focus) == null ? void 0 : y.call(o);
822
822
  },
823
823
  select: () => {
824
- var l;
825
- return (l = o.select) == null ? void 0 : l.call(o);
824
+ var y;
825
+ return (y = o.select) == null ? void 0 : y.call(o);
826
826
  },
827
- setCustomValidity: (l) => {
828
- var N;
829
- return (N = o.setCustomValidity) == null ? void 0 : N.call(o, l);
827
+ setCustomValidity: (y) => {
828
+ var P;
829
+ return (P = o.setCustomValidity) == null ? void 0 : P.call(o, y);
830
830
  },
831
831
  reportValidity: () => {
832
- var l;
833
- return (l = o.reportValidity) == null ? void 0 : l.call(o);
832
+ var y;
833
+ return (y = o.reportValidity) == null ? void 0 : y.call(o);
834
834
  }
835
835
  };
836
836
  }
837
837
  },
838
- [p, s, e]
838
+ [p, i, e]
839
839
  );
840
- return b ? null : c ? /* @__PURE__ */ v("div", { className: "form-group", children: [
840
+ return k ? null : l ? /* @__PURE__ */ w("div", { className: "form-group", children: [
841
841
  /* @__PURE__ */ n("label", { children: a }),
842
- /* @__PURE__ */ n("span", { className: "form-control", children: m || "-" })
843
- ] }) : /* @__PURE__ */ v("div", { className: `form-group fluig-style-guide ${i}`, children: [
842
+ /* @__PURE__ */ n("span", { className: "form-control", children: b || "-" })
843
+ ] }) : /* @__PURE__ */ w("div", { className: `form-group fluig-style-guide ${d}`, children: [
844
844
  a && /* @__PURE__ */ n("label", { className: "control-label", htmlFor: e, children: a }),
845
- /* @__PURE__ */ n("div", { className: `${h ? "border-red" : ""}`, children: /* @__PURE__ */ n(
846
- ae,
845
+ /* @__PURE__ */ n("div", { className: `${g ? "border-red" : ""}`, children: /* @__PURE__ */ n(
846
+ ne,
847
847
  {
848
848
  id: e,
849
849
  name: e,
850
- selected: C,
851
- onChange: k,
850
+ selected: m,
851
+ onChange: u,
852
852
  onBlur: S,
853
- dateFormat: _,
853
+ dateFormat: X,
854
854
  placeholderText: t,
855
- disabled: g,
856
- readOnly: g,
855
+ disabled: f,
856
+ readOnly: f,
857
857
  locale: "pt-BR",
858
- className: `form-control ${h ? "border-red" : ""}`,
858
+ className: `form-control ${g ? "border-red" : ""}`,
859
859
  wrapperClassName: "w-100",
860
860
  showMonthDropdown: !0,
861
861
  showYearDropdown: !0,
862
862
  dropdownMode: "select",
863
- isClearable: !g && !!m,
863
+ isClearable: !f && !!b,
864
864
  autoComplete: "off",
865
- customInput: /* @__PURE__ */ n(Ye, { name: e, shimRef: x })
865
+ customInput: /* @__PURE__ */ n(Ye, { name: e, shimRef: c })
866
866
  }
867
867
  ) }),
868
- h && /* @__PURE__ */ n("span", { className: "help-block text-danger", children: String(h.message) })
868
+ g && /* @__PURE__ */ n("span", { className: "help-block text-danger", children: String(g.message) })
869
869
  ] });
870
- }, dt = j(Qe);
871
- function Ge({
870
+ }, lt = F(Qe);
871
+ function Je({
872
872
  mapping: e = {},
873
873
  defaultLabel: a = "Não reconhecido",
874
874
  className: t = "",
875
- hidden: i = !1,
875
+ hidden: d = !1,
876
876
  label: r
877
877
  }) {
878
- const { activityId: d } = V(), s = W(() => !e || d === null || d === void 0 ? null : e[d], [d, e]);
879
- if (!s)
880
- return /* @__PURE__ */ v("div", { className: `form-group ${i ? "hidden" : ""}`, children: [
878
+ const { activityId: s } = W(), i = A(() => !e || s === null || s === void 0 ? null : e[s], [s, e]);
879
+ if (!i)
880
+ return /* @__PURE__ */ w("div", { className: `form-group ${d ? "hidden" : ""}`, children: [
881
881
  r && /* @__PURE__ */ n("label", { children: r }),
882
882
  /* @__PURE__ */ n("div", { className: `status-badge default ${t}`, children: a })
883
883
  ] });
884
- const c = {
885
- "--customColor": s.color
884
+ const l = {
885
+ "--customColor": i.color
886
886
  };
887
- return /* @__PURE__ */ v("div", { className: `form-group ${i ? "hidden" : ""}`, children: [
887
+ return /* @__PURE__ */ w("div", { className: `form-group ${d ? "hidden" : ""}`, children: [
888
888
  r && /* @__PURE__ */ n("label", { children: r }),
889
- /* @__PURE__ */ v("div", { className: `status-badge ${t}`, style: c, children: [
890
- s.icon && /* @__PURE__ */ n("i", { className: s.icon }),
891
- /* @__PURE__ */ n("span", { children: s.label })
889
+ /* @__PURE__ */ w("div", { className: `status-badge ${t}`, style: l, children: [
890
+ i.icon && /* @__PURE__ */ n("i", { className: i.icon }),
891
+ /* @__PURE__ */ n("span", { children: i.label })
892
892
  ] })
893
893
  ] });
894
894
  }
895
- const ct = j(Ge);
895
+ const ct = F(Je);
896
+ function Ue({
897
+ name: e,
898
+ control: a,
899
+ defaultRowValue: t,
900
+ isView: d,
901
+ isReadOnly: r
902
+ }) {
903
+ const { field: s } = H({ name: e, control: a }), [i, l] = B([]), [N, h] = B([]), f = () => Date.now() + Math.random(), k = (u) => {
904
+ try {
905
+ const c = JSON.parse(u);
906
+ return Array.isArray(c) ? c.map((o) => ({
907
+ ...o,
908
+ _uid: o._uid || f()
909
+ })) : [];
910
+ } catch (c) {
911
+ return console.error(`Erro ao ler dados da tabela "${e}":`, c), [];
912
+ }
913
+ };
914
+ D(() => {
915
+ if (!(i.length > 0 && !d) && s.value && typeof s.value == "string") {
916
+ const u = JSON.stringify(i);
917
+ if (s.value === u) return;
918
+ const c = k(s.value);
919
+ l(c);
920
+ }
921
+ }, [s.value, d]), D(() => {
922
+ if (r) return;
923
+ const u = JSON.stringify(i);
924
+ s.value !== u && s.onChange(u);
925
+ }, [i, s, r]);
926
+ const R = $(() => {
927
+ const u = { _uid: f(), ...t };
928
+ l((c) => [...c, u]);
929
+ }, [t]), S = $(() => {
930
+ l(
931
+ (u) => u.filter((c) => !N.includes(c._uid))
932
+ ), h([]);
933
+ }, [N]), b = $(
934
+ (u, c, o) => {
935
+ l(
936
+ (C) => C.map(
937
+ (x) => x._uid === u ? { ...x, [c]: o } : x
938
+ )
939
+ );
940
+ },
941
+ []
942
+ ), p = $((u) => {
943
+ h(
944
+ (c) => c.includes(u) ? c.filter((o) => o !== u) : [...c, u]
945
+ );
946
+ }, []), g = $(
947
+ (u) => {
948
+ h(u ? i.map((c) => c._uid) : []);
949
+ },
950
+ [i]
951
+ ), m = i.length > 0 && N.length === i.length;
952
+ return {
953
+ field: s,
954
+ // Props do input hidden
955
+ tableRows: i,
956
+ // Dados da tabela
957
+ selectedRowIds: N,
958
+ // IDs selecionados
959
+ isAllSelected: m,
960
+ // Booleano se tudo está selecionado
961
+ actions: {
962
+ addRow: R,
963
+ removeRows: S,
964
+ updateCellValue: b,
965
+ toggleSelection: p,
966
+ toggleSelectAll: g
967
+ }
968
+ };
969
+ }
970
+ const ut = ({
971
+ name: e,
972
+ title: a = "Tabela Dinâmica",
973
+ columns: t,
974
+ defaultRowValue: d = {},
975
+ forceReadOnly: r = !1,
976
+ layout: s = "fluid"
977
+ // 👈 NOVO
978
+ }) => {
979
+ const { control: i } = j(), { isView: l, isReadOnly: N } = W(), { isReadOnly: h } = T(), f = r || l || N || h && h(e), { field: k, tableRows: R, selectedRowIds: S, isAllSelected: b, actions: p } = Ue({
980
+ name: e,
981
+ control: i,
982
+ defaultRowValue: d,
983
+ isView: l,
984
+ isReadOnly: !!f
985
+ }), g = s === "fixed";
986
+ return /* @__PURE__ */ w("div", { className: `table-wrapper ${g ? "table-fixed" : "table-fluid"}`, children: [
987
+ /* @__PURE__ */ n("input", { type: "hidden", ...k }),
988
+ /* @__PURE__ */ w("div", { className: "header-actions", children: [
989
+ /* @__PURE__ */ n("h3", { children: a }),
990
+ !f && /* @__PURE__ */ w("div", { children: [
991
+ /* @__PURE__ */ w(
992
+ "button",
993
+ {
994
+ type: "button",
995
+ className: `btn ${S.length > 0 ? "btn-danger" : ""}`,
996
+ disabled: S.length === 0,
997
+ onClick: p.removeRows,
998
+ children: [
999
+ "Remover (",
1000
+ S.length,
1001
+ ")"
1002
+ ]
1003
+ }
1004
+ ),
1005
+ /* @__PURE__ */ n("button", { type: "button", className: "btn-add", onClick: p.addRow, children: "Adicionar" })
1006
+ ] })
1007
+ ] }),
1008
+ /* @__PURE__ */ n("div", { className: "table-scroll", children: /* @__PURE__ */ w(
1009
+ "table",
1010
+ {
1011
+ className: "table-custom",
1012
+ style: {
1013
+ tableLayout: "fixed",
1014
+ width: g ? "max-content" : "100%"
1015
+ },
1016
+ children: [
1017
+ /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ w("tr", { children: [
1018
+ !f && /* @__PURE__ */ n("th", { style: { width: "50px" }, children: /* @__PURE__ */ n(
1019
+ "input",
1020
+ {
1021
+ type: "checkbox",
1022
+ checked: b,
1023
+ onChange: (m) => p.toggleSelectAll(m.target.checked)
1024
+ }
1025
+ ) }),
1026
+ t.map((m) => /* @__PURE__ */ n(
1027
+ "th",
1028
+ {
1029
+ style: m.width ? { width: m.width } : { width: "100%" },
1030
+ children: m.label
1031
+ },
1032
+ m.key
1033
+ ))
1034
+ ] }) }),
1035
+ /* @__PURE__ */ n("div", {}),
1036
+ /* @__PURE__ */ w("tbody", { children: [
1037
+ R.map((m, u) => /* @__PURE__ */ w("tr", { children: [
1038
+ !f && /* @__PURE__ */ n("td", { children: /* @__PURE__ */ n(
1039
+ "input",
1040
+ {
1041
+ type: "checkbox",
1042
+ checked: S.includes(m._uid),
1043
+ onChange: () => p.toggleSelection(m._uid)
1044
+ }
1045
+ ) }),
1046
+ t.map((c) => /* @__PURE__ */ n("td", { children: c.render ? c.render(
1047
+ m,
1048
+ u,
1049
+ (o, C) => p.updateCellValue(m._uid, o, C),
1050
+ !!f,
1051
+ !!l
1052
+ ) : m[c.key] }, `${m._uid}-${c.key}`))
1053
+ ] }, m._uid)),
1054
+ R.length === 0 && /* @__PURE__ */ n("tr", { children: /* @__PURE__ */ n("td", { colSpan: 100, className: "text-center", children: f ? "Nenhum registro encontrado." : "Nenhum registro." }) })
1055
+ ] })
1056
+ ]
1057
+ }
1058
+ ) })
1059
+ ] });
1060
+ };
896
1061
  export {
897
1062
  ot as Checkbox,
898
- dt as DatePicker,
899
- nt as Input,
900
- it as RadioBtn,
901
- rt as Select,
1063
+ lt as DatePicker,
1064
+ rt as Input,
1065
+ st as RadioBtn,
1066
+ it as Select,
1067
+ ut as SimpleTable,
902
1068
  ct as StatusBadge,
903
- st as TextArea
1069
+ dt as TextArea
904
1070
  };