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