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