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