@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/components/SimpleTable/index.d.ts +10 -9
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +478 -312
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { memo as
|
|
3
|
-
import { useFormContext as
|
|
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
|
|
6
|
-
import
|
|
7
|
-
import { parse as re, isValid as
|
|
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:
|
|
18
|
+
type: d = "text",
|
|
19
19
|
mask: r,
|
|
20
|
-
className:
|
|
21
|
-
forceReadOnly:
|
|
22
|
-
forceHidden:
|
|
20
|
+
className: s = "",
|
|
21
|
+
forceReadOnly: i = !1,
|
|
22
|
+
forceHidden: l = !1
|
|
23
23
|
}) {
|
|
24
|
-
const { isReadOnly:
|
|
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
|
|
27
|
-
return (Number(
|
|
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
|
-
}, []),
|
|
32
|
-
(o) =>
|
|
33
|
-
[
|
|
31
|
+
}, []), c = $(
|
|
32
|
+
(o) => d === "monetary" ? u(o) : o,
|
|
33
|
+
[d, u]
|
|
34
34
|
);
|
|
35
|
-
return S ? /* @__PURE__ */
|
|
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:
|
|
38
|
-
] }) : /* @__PURE__ */
|
|
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
|
-
|
|
40
|
+
m ? /* @__PURE__ */ n(
|
|
41
41
|
te,
|
|
42
42
|
{
|
|
43
43
|
name: e,
|
|
44
|
-
mask:
|
|
45
|
-
value: String(
|
|
44
|
+
mask: m,
|
|
45
|
+
value: String(b.value ?? ""),
|
|
46
46
|
unmask: !1,
|
|
47
|
-
onAccept: (o) =>
|
|
47
|
+
onAccept: (o) => b.onChange(c(o)),
|
|
48
48
|
placeholder: t,
|
|
49
|
-
readOnly:
|
|
50
|
-
className: `form-control ${
|
|
51
|
-
inputRef:
|
|
52
|
-
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
|
-
...
|
|
57
|
+
...b,
|
|
58
58
|
type: "text",
|
|
59
|
-
value:
|
|
60
|
-
onChange: (o) =>
|
|
59
|
+
value: b.value ?? "",
|
|
60
|
+
onChange: (o) => b.onChange(c(o.target.value)),
|
|
61
61
|
placeholder: t,
|
|
62
|
-
readOnly:
|
|
63
|
-
className: `form-control ${
|
|
62
|
+
readOnly: f,
|
|
63
|
+
className: `form-control ${g ? "border-red" : ""} ${s}`
|
|
64
64
|
}
|
|
65
65
|
),
|
|
66
|
-
|
|
66
|
+
g && /* @__PURE__ */ n("p", { className: "text-danger", children: String(g.message) })
|
|
67
67
|
] });
|
|
68
68
|
}
|
|
69
|
-
const
|
|
70
|
-
function
|
|
69
|
+
const rt = F(de);
|
|
70
|
+
function le({
|
|
71
71
|
name: e,
|
|
72
72
|
label: a = "",
|
|
73
73
|
options: t = [],
|
|
74
|
-
placeholder:
|
|
74
|
+
placeholder: d = "",
|
|
75
75
|
labelKey: r = "label",
|
|
76
|
-
valueKey:
|
|
77
|
-
enableSearch:
|
|
78
|
-
searchPlaceholder:
|
|
79
|
-
loading:
|
|
80
|
-
onSearchChange:
|
|
81
|
-
debounceTime:
|
|
82
|
-
onSelect:
|
|
83
|
-
forceReadOnly:
|
|
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:
|
|
87
|
-
field: { onChange:
|
|
88
|
-
fieldState: { error:
|
|
89
|
-
} =
|
|
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:
|
|
92
|
-
}), [
|
|
93
|
-
|
|
94
|
-
I.current =
|
|
95
|
-
}, [
|
|
96
|
-
const
|
|
97
|
-
|
|
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",
|
|
100
|
-
}, []),
|
|
101
|
-
|
|
102
|
-
}, [
|
|
103
|
-
if (!
|
|
104
|
-
const
|
|
105
|
-
I.current && I.current(
|
|
106
|
-
},
|
|
107
|
-
return () => clearTimeout(
|
|
108
|
-
}, [
|
|
109
|
-
const
|
|
110
|
-
(
|
|
111
|
-
) : t ?? [], [t,
|
|
112
|
-
if (
|
|
113
|
-
if (typeof
|
|
114
|
-
return String(
|
|
115
|
-
const
|
|
116
|
-
(
|
|
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(
|
|
119
|
-
}, [
|
|
120
|
-
|
|
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__ */
|
|
122
|
+
return /* @__PURE__ */ w(
|
|
123
123
|
"div",
|
|
124
124
|
{
|
|
125
|
-
className: `select-wrapper form-group ${
|
|
126
|
-
ref:
|
|
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:
|
|
130
|
-
/* @__PURE__ */
|
|
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 ${
|
|
134
|
-
onClick: () => !
|
|
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 ${
|
|
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
|
-
|
|
143
|
-
|
|
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:
|
|
149
|
-
onChange: (
|
|
150
|
-
placeholder:
|
|
148
|
+
value: M,
|
|
149
|
+
onChange: (v) => Y(v.target.value),
|
|
150
|
+
placeholder: N ? "Carregando..." : l,
|
|
151
151
|
autoFocus: !0,
|
|
152
|
-
onClick: (
|
|
152
|
+
onClick: (v) => v.stopPropagation()
|
|
153
153
|
}
|
|
154
154
|
) }),
|
|
155
|
-
/* @__PURE__ */ n("ul", { className: "select-options", children:
|
|
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: () =>
|
|
158
|
+
onClick: () => G(v),
|
|
159
159
|
className: "select-option handleHover",
|
|
160
|
-
children:
|
|
160
|
+
children: v[r]
|
|
161
161
|
},
|
|
162
|
-
|
|
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:
|
|
167
|
-
|
|
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
|
|
172
|
+
const it = F(le);
|
|
173
173
|
function ot({
|
|
174
174
|
name: e,
|
|
175
175
|
options: a = [],
|
|
176
176
|
label: t = "",
|
|
177
|
-
valueKey:
|
|
177
|
+
valueKey: d = "value",
|
|
178
178
|
labelKey: r = "label",
|
|
179
|
-
forceReadOnly:
|
|
180
|
-
forceHidden:
|
|
179
|
+
forceReadOnly: s = !1,
|
|
180
|
+
forceHidden: i = !1
|
|
181
181
|
}) {
|
|
182
|
-
var
|
|
183
|
-
const
|
|
184
|
-
if (!
|
|
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
|
|
187
|
-
const O =
|
|
188
|
-
return
|
|
189
|
-
}, {}),
|
|
190
|
-
|
|
191
|
-
const
|
|
192
|
-
(!
|
|
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
|
-
}, [
|
|
197
|
-
const o = (
|
|
198
|
-
if (
|
|
199
|
-
const O = { ...
|
|
200
|
-
|
|
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
|
-
}),
|
|
204
|
-
},
|
|
205
|
-
return /* @__PURE__ */
|
|
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 ${
|
|
211
|
-
children: a.map((
|
|
212
|
-
const
|
|
213
|
-
return /* @__PURE__ */
|
|
214
|
-
/* @__PURE__ */ n("input", { type: "hidden", ...
|
|
215
|
-
/* @__PURE__ */
|
|
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" : ""} ${
|
|
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:
|
|
226
|
-
onChange: (
|
|
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:
|
|
230
|
+
/* @__PURE__ */ n("span", { children: y[r] })
|
|
231
231
|
]
|
|
232
232
|
}
|
|
233
233
|
)
|
|
234
|
-
] },
|
|
234
|
+
] }, P);
|
|
235
235
|
})
|
|
236
236
|
}
|
|
237
237
|
),
|
|
238
|
-
|
|
238
|
+
C && /* @__PURE__ */ n("p", { className: "text-danger", children: String(C.message) })
|
|
239
239
|
] });
|
|
240
240
|
}
|
|
241
|
-
function
|
|
241
|
+
function ce({
|
|
242
242
|
name: e,
|
|
243
243
|
label: a = "",
|
|
244
244
|
options: t = [],
|
|
245
|
-
valueKey:
|
|
245
|
+
valueKey: d = "value",
|
|
246
246
|
labelKey: r = "label",
|
|
247
|
-
iconKey:
|
|
248
|
-
forceReadOnly:
|
|
249
|
-
forceHidden:
|
|
247
|
+
iconKey: s = "icon",
|
|
248
|
+
forceReadOnly: i = !1,
|
|
249
|
+
forceHidden: l = !1
|
|
250
250
|
}) {
|
|
251
|
-
const { isReadOnly:
|
|
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:
|
|
254
|
-
} =
|
|
253
|
+
fieldState: { error: g }
|
|
254
|
+
} = H({
|
|
255
255
|
name: e,
|
|
256
|
-
control:
|
|
257
|
-
}),
|
|
256
|
+
control: R
|
|
257
|
+
}), m = f || b || S, u = p.value ?? "", c = $(
|
|
258
258
|
(o) => {
|
|
259
|
-
|
|
259
|
+
m || p.onChange(o);
|
|
260
260
|
},
|
|
261
|
-
[
|
|
261
|
+
[m, p]
|
|
262
262
|
);
|
|
263
|
-
return /* @__PURE__ */
|
|
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 ${
|
|
268
|
+
className: `btn-group ${m ? "view-mode" : ""}`,
|
|
269
269
|
"data-field-name": e,
|
|
270
270
|
children: t.map((o) => {
|
|
271
|
-
const
|
|
272
|
-
return /* @__PURE__ */
|
|
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}_${
|
|
276
|
-
style:
|
|
277
|
-
className: `btn fs-ellipsis ${
|
|
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}_${
|
|
283
|
+
id: `${e}_${C}`,
|
|
284
284
|
name: e,
|
|
285
|
-
value:
|
|
286
|
-
checked:
|
|
285
|
+
value: C,
|
|
286
|
+
checked: x,
|
|
287
287
|
className: "hidden",
|
|
288
|
-
onChange: () =>
|
|
289
|
-
disabled:
|
|
288
|
+
onChange: () => c(C),
|
|
289
|
+
disabled: m
|
|
290
290
|
}
|
|
291
291
|
),
|
|
292
|
-
o[
|
|
292
|
+
o[s] && /* @__PURE__ */ n("i", { className: `${o[s]} icon-sm` }),
|
|
293
293
|
" ",
|
|
294
294
|
o[r]
|
|
295
295
|
]
|
|
296
296
|
},
|
|
297
|
-
|
|
297
|
+
C
|
|
298
298
|
);
|
|
299
299
|
})
|
|
300
300
|
}
|
|
301
301
|
),
|
|
302
|
-
|
|
302
|
+
g && /* @__PURE__ */ n("p", { className: "text-danger", children: String(g.message) })
|
|
303
303
|
] });
|
|
304
304
|
}
|
|
305
|
-
const
|
|
305
|
+
const st = F(ce), ue = ({
|
|
306
306
|
name: e,
|
|
307
307
|
label: a = "",
|
|
308
308
|
placeholder: t = "",
|
|
309
|
-
className:
|
|
309
|
+
className: d = "",
|
|
310
310
|
rows: r = 4,
|
|
311
|
-
maxLength:
|
|
312
|
-
forceReadOnly:
|
|
313
|
-
forceHidden:
|
|
311
|
+
maxLength: s,
|
|
312
|
+
forceReadOnly: i = !1,
|
|
313
|
+
forceHidden: l = !1
|
|
314
314
|
}) => {
|
|
315
|
-
const { isReadOnly:
|
|
316
|
-
field:
|
|
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
|
-
} =
|
|
318
|
+
} = H({
|
|
319
319
|
name: e,
|
|
320
|
-
control:
|
|
320
|
+
control: R
|
|
321
321
|
});
|
|
322
|
-
return S ? /* @__PURE__ */
|
|
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:
|
|
325
|
-
] }) : /* @__PURE__ */
|
|
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
|
-
...
|
|
330
|
+
...b,
|
|
331
331
|
rows: r,
|
|
332
|
-
maxLength:
|
|
333
|
-
value:
|
|
332
|
+
maxLength: s,
|
|
333
|
+
value: b.value || "",
|
|
334
334
|
placeholder: t,
|
|
335
|
-
readOnly:
|
|
336
|
-
className: `form-control ${p ? "border-red" : ""} ${
|
|
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
|
-
},
|
|
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
|
|
350
|
+
const d = t != null && t.context ? String(t.context) : "standalone";
|
|
351
351
|
let r;
|
|
352
|
-
if (
|
|
353
|
-
const
|
|
354
|
-
r = e.formattingValues[
|
|
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
|
|
357
|
-
r = e.values[
|
|
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
|
|
360
|
-
return r[
|
|
359
|
+
const s = e.argumentCallback ? e.argumentCallback(a) : a;
|
|
360
|
+
return r[s];
|
|
361
361
|
};
|
|
362
362
|
}
|
|
363
|
-
function
|
|
363
|
+
function L(e) {
|
|
364
364
|
return (a, t = {}) => {
|
|
365
|
-
const
|
|
366
|
-
if (!
|
|
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
|
|
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(
|
|
370
|
+
me(l, (k) => k.test(i))
|
|
371
371
|
);
|
|
372
|
-
let
|
|
373
|
-
|
|
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(
|
|
376
|
-
) :
|
|
377
|
-
const
|
|
378
|
-
return { value:
|
|
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
|
|
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
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
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
|
|
466
|
+
let d;
|
|
467
467
|
const r = ge[e];
|
|
468
|
-
return typeof r == "string" ?
|
|
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
|
-
},
|
|
507
|
+
}, ke = (e, a, t, d) => {
|
|
508
508
|
const r = Ne[e];
|
|
509
509
|
return typeof r == "function" ? r(a) : r;
|
|
510
|
-
},
|
|
510
|
+
}, xe = {
|
|
511
511
|
narrow: ["AC", "DC"],
|
|
512
512
|
abbreviated: ["AC", "DC"],
|
|
513
513
|
wide: ["antes de cristo", "depois de cristo"]
|
|
514
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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:
|
|
635
|
+
ordinalNumber: Me,
|
|
636
636
|
era: q({
|
|
637
|
-
values:
|
|
637
|
+
values: xe,
|
|
638
638
|
defaultWidth: "wide"
|
|
639
639
|
}),
|
|
640
640
|
quarter: q({
|
|
641
|
-
values:
|
|
641
|
+
values: Ce,
|
|
642
642
|
defaultWidth: "wide",
|
|
643
643
|
argumentCallback: (e) => e - 1
|
|
644
644
|
}),
|
|
645
645
|
month: q({
|
|
646
|
-
values:
|
|
646
|
+
values: Se,
|
|
647
647
|
defaultWidth: "wide"
|
|
648
648
|
}),
|
|
649
649
|
day: q({
|
|
650
|
-
values:
|
|
650
|
+
values: Re,
|
|
651
651
|
defaultWidth: "wide"
|
|
652
652
|
}),
|
|
653
653
|
dayPeriod: q({
|
|
654
|
-
values:
|
|
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,
|
|
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
|
-
},
|
|
663
|
+
}, je = {
|
|
664
664
|
any: [/^ac/i, /^dc/i],
|
|
665
665
|
wide: [/^antes de cristo/i, /^depois de cristo/i]
|
|
666
|
-
},
|
|
666
|
+
}, Te = {
|
|
667
667
|
narrow: /^[1234]/i,
|
|
668
668
|
abbreviated: /^T[1234]/i,
|
|
669
669
|
wide: /^[1234](º)? trimestre/i
|
|
670
|
-
},
|
|
670
|
+
}, Ae = {
|
|
671
671
|
any: [/1/i, /2/i, /3/i, /4/i]
|
|
672
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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:
|
|
735
|
-
matchPatterns:
|
|
734
|
+
era: L({
|
|
735
|
+
matchPatterns: De,
|
|
736
736
|
defaultMatchWidth: "wide",
|
|
737
|
-
parsePatterns:
|
|
737
|
+
parsePatterns: je,
|
|
738
738
|
defaultParseWidth: "any"
|
|
739
739
|
}),
|
|
740
|
-
quarter:
|
|
741
|
-
matchPatterns:
|
|
740
|
+
quarter: L({
|
|
741
|
+
matchPatterns: Te,
|
|
742
742
|
defaultMatchWidth: "wide",
|
|
743
|
-
parsePatterns:
|
|
743
|
+
parsePatterns: Ae,
|
|
744
744
|
defaultParseWidth: "any",
|
|
745
745
|
valueCallback: (e) => e + 1
|
|
746
746
|
}),
|
|
747
|
-
month:
|
|
748
|
-
matchPatterns:
|
|
747
|
+
month: L({
|
|
748
|
+
matchPatterns: Fe,
|
|
749
749
|
defaultMatchWidth: "wide",
|
|
750
|
-
parsePatterns:
|
|
750
|
+
parsePatterns: He,
|
|
751
751
|
defaultParseWidth: "any"
|
|
752
752
|
}),
|
|
753
|
-
day:
|
|
754
|
-
matchPatterns:
|
|
753
|
+
day: L({
|
|
754
|
+
matchPatterns: _e,
|
|
755
755
|
defaultMatchWidth: "wide",
|
|
756
|
-
parsePatterns:
|
|
756
|
+
parsePatterns: qe,
|
|
757
757
|
defaultParseWidth: "any"
|
|
758
758
|
}),
|
|
759
|
-
dayPeriod:
|
|
760
|
-
matchPatterns:
|
|
759
|
+
dayPeriod: L({
|
|
760
|
+
matchPatterns: Le,
|
|
761
761
|
defaultMatchWidth: "any",
|
|
762
|
-
parsePatterns:
|
|
762
|
+
parsePatterns: Be,
|
|
763
763
|
defaultParseWidth: "any"
|
|
764
764
|
})
|
|
765
|
-
},
|
|
765
|
+
}, Ie = {
|
|
766
766
|
code: "pt-BR",
|
|
767
767
|
formatDistance: be,
|
|
768
768
|
formatLong: we,
|
|
769
|
-
formatRelative:
|
|
769
|
+
formatRelative: ke,
|
|
770
770
|
localize: $e,
|
|
771
|
-
match:
|
|
771
|
+
match: ze,
|
|
772
772
|
options: {
|
|
773
773
|
weekStartsOn: 0,
|
|
774
774
|
firstWeekContainsDate: 1
|
|
775
775
|
}
|
|
776
776
|
};
|
|
777
|
-
|
|
778
|
-
const
|
|
777
|
+
ae("pt-BR", Ie);
|
|
778
|
+
const X = "dd/MM/yyyy", Ee = (e) => {
|
|
779
779
|
if (!e) return null;
|
|
780
|
-
const a = re(e,
|
|
781
|
-
return
|
|
782
|
-
}, Xe = (e) => e ?
|
|
783
|
-
({ shimRef: e, className: a, name: t, ...
|
|
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
|
-
...
|
|
787
|
+
...d,
|
|
788
788
|
className: a,
|
|
789
|
-
ref: (
|
|
790
|
-
typeof r == "function" ? r(
|
|
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:
|
|
798
|
+
className: d = "",
|
|
799
799
|
forceReadOnly: r = !1,
|
|
800
|
-
forceHidden:
|
|
800
|
+
forceHidden: s = !1
|
|
801
801
|
}) => {
|
|
802
|
-
const { control:
|
|
803
|
-
field: { onChange:
|
|
804
|
-
fieldState: { error:
|
|
805
|
-
} =
|
|
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:
|
|
808
|
-
}),
|
|
807
|
+
control: i
|
|
808
|
+
}), m = A(() => Ee(b), [b]), u = $(
|
|
809
809
|
(o) => {
|
|
810
|
-
|
|
810
|
+
R(o ? Xe(o) : "");
|
|
811
811
|
},
|
|
812
|
-
[
|
|
813
|
-
),
|
|
812
|
+
[R]
|
|
813
|
+
), c = $(
|
|
814
814
|
(o) => {
|
|
815
|
-
var
|
|
816
|
-
if (p(o), o && ((
|
|
817
|
-
const
|
|
818
|
-
|
|
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
|
|
821
|
-
return (
|
|
820
|
+
var y;
|
|
821
|
+
return (y = o.focus) == null ? void 0 : y.call(o);
|
|
822
822
|
},
|
|
823
823
|
select: () => {
|
|
824
|
-
var
|
|
825
|
-
return (
|
|
824
|
+
var y;
|
|
825
|
+
return (y = o.select) == null ? void 0 : y.call(o);
|
|
826
826
|
},
|
|
827
|
-
setCustomValidity: (
|
|
828
|
-
var
|
|
829
|
-
return (
|
|
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
|
|
833
|
-
return (
|
|
832
|
+
var y;
|
|
833
|
+
return (y = o.reportValidity) == null ? void 0 : y.call(o);
|
|
834
834
|
}
|
|
835
835
|
};
|
|
836
836
|
}
|
|
837
837
|
},
|
|
838
|
-
[p,
|
|
838
|
+
[p, i, e]
|
|
839
839
|
);
|
|
840
|
-
return
|
|
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:
|
|
843
|
-
] }) : /* @__PURE__ */
|
|
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: `${
|
|
846
|
-
|
|
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:
|
|
851
|
-
onChange:
|
|
850
|
+
selected: m,
|
|
851
|
+
onChange: u,
|
|
852
852
|
onBlur: S,
|
|
853
|
-
dateFormat:
|
|
853
|
+
dateFormat: X,
|
|
854
854
|
placeholderText: t,
|
|
855
|
-
disabled:
|
|
856
|
-
readOnly:
|
|
855
|
+
disabled: f,
|
|
856
|
+
readOnly: f,
|
|
857
857
|
locale: "pt-BR",
|
|
858
|
-
className: `form-control ${
|
|
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: !
|
|
863
|
+
isClearable: !f && !!b,
|
|
864
864
|
autoComplete: "off",
|
|
865
|
-
customInput: /* @__PURE__ */ n(Ye, { name: e, shimRef:
|
|
865
|
+
customInput: /* @__PURE__ */ n(Ye, { name: e, shimRef: c })
|
|
866
866
|
}
|
|
867
867
|
) }),
|
|
868
|
-
|
|
868
|
+
g && /* @__PURE__ */ n("span", { className: "help-block text-danger", children: String(g.message) })
|
|
869
869
|
] });
|
|
870
|
-
},
|
|
871
|
-
function
|
|
870
|
+
}, lt = F(Qe);
|
|
871
|
+
function Je({
|
|
872
872
|
mapping: e = {},
|
|
873
873
|
defaultLabel: a = "Não reconhecido",
|
|
874
874
|
className: t = "",
|
|
875
|
-
hidden:
|
|
875
|
+
hidden: d = !1,
|
|
876
876
|
label: r
|
|
877
877
|
}) {
|
|
878
|
-
const { activityId:
|
|
879
|
-
if (!
|
|
880
|
-
return /* @__PURE__ */
|
|
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
|
|
885
|
-
"--customColor":
|
|
884
|
+
const l = {
|
|
885
|
+
"--customColor": i.color
|
|
886
886
|
};
|
|
887
|
-
return /* @__PURE__ */
|
|
887
|
+
return /* @__PURE__ */ w("div", { className: `form-group ${d ? "hidden" : ""}`, children: [
|
|
888
888
|
r && /* @__PURE__ */ n("label", { children: r }),
|
|
889
|
-
/* @__PURE__ */
|
|
890
|
-
|
|
891
|
-
/* @__PURE__ */ n("span", { children:
|
|
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 =
|
|
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
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
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
|
-
|
|
1069
|
+
dt as TextArea
|
|
904
1070
|
};
|