diefra_ecm_ui 1.0.7 → 1.0.9
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/diefra_ecm_ui.css +1 -1
- package/dist/index.cjs +7 -7
- package/dist/index.js +465 -478
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,288 +1,288 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { memo as z, useMemo as B, useCallback as C, useState as
|
|
3
|
-
import { useFormContext as H, useController as X, useFormState as
|
|
1
|
+
import { jsxs as k, jsx as r, Fragment as ce } from "react/jsx-runtime";
|
|
2
|
+
import { memo as z, useMemo as B, useCallback as C, useState as I, useRef as G, useEffect as E, forwardRef as ie, createElement as Z } from "react";
|
|
3
|
+
import { useFormContext as H, useController as X, useFormState as se } from "react-hook-form";
|
|
4
4
|
import { IMaskInput as le } from "react-imask";
|
|
5
|
-
import { useSection as
|
|
6
|
-
import { parse as ue, isValid as me, eachDayOfInterval as
|
|
5
|
+
import { useSection as F, useFluigRuntime as L } from "@fluig-kit/ecm";
|
|
6
|
+
import { parse as ue, isValid as me, eachDayOfInterval as fe, endOfWeek as he, endOfMonth as pe, startOfWeek as ye, startOfMonth as ve, subMonths as ge, format as K, addMonths as be, isSameMonth as we, isSameDay as Ne, isToday as ke } from "date-fns";
|
|
7
7
|
const xe = {
|
|
8
8
|
cpf: "000.000.000-00",
|
|
9
9
|
cnpj: "00.000.000/0000-00",
|
|
10
10
|
telefone: "(00) 00000-0000",
|
|
11
11
|
cep: "00000-000"
|
|
12
12
|
};
|
|
13
|
-
function
|
|
13
|
+
function Re({
|
|
14
14
|
name: e,
|
|
15
15
|
label: t = "",
|
|
16
16
|
placeholder: n = "",
|
|
17
|
-
type:
|
|
18
|
-
mask:
|
|
19
|
-
className:
|
|
17
|
+
type: s = "text",
|
|
18
|
+
mask: i,
|
|
19
|
+
className: c = "",
|
|
20
20
|
forceReadOnly: l = !1,
|
|
21
21
|
forceHidden: o = !1,
|
|
22
|
-
valueManual:
|
|
22
|
+
valueManual: b,
|
|
23
23
|
onChangeManual: a,
|
|
24
24
|
errorManual: N
|
|
25
25
|
}) {
|
|
26
|
-
var
|
|
27
|
-
const
|
|
26
|
+
var x, P;
|
|
27
|
+
const h = b !== void 0 && !!a, { isReadOnly: W, isHidden: V } = F(), O = l || !!W(e), S = o || !!V(e), { isView: A } = L();
|
|
28
28
|
let p = null;
|
|
29
29
|
try {
|
|
30
30
|
p = H();
|
|
31
31
|
} catch {
|
|
32
32
|
}
|
|
33
|
-
const
|
|
34
|
-
() =>
|
|
35
|
-
[
|
|
36
|
-
),
|
|
37
|
-
if (!
|
|
38
|
-
const j =
|
|
33
|
+
const v = !h && p ? X({ name: e, control: p.control }) : null, u = !h && p ? se({ name: e }) : null, m = h ? b : v == null ? void 0 : v.field.value, d = h ? N : (P = (x = u == null ? void 0 : u.errors) == null ? void 0 : x[e]) == null ? void 0 : P.message, f = B(
|
|
34
|
+
() => i ? xe[i] ?? i : null,
|
|
35
|
+
[i]
|
|
36
|
+
), w = C((g) => {
|
|
37
|
+
if (!g) return "";
|
|
38
|
+
const j = g.replace(/\D/g, "");
|
|
39
39
|
return (Number(j) / 100).toLocaleString("pt-BR", {
|
|
40
40
|
style: "currency",
|
|
41
41
|
currency: "BRL"
|
|
42
42
|
});
|
|
43
43
|
}, []), D = C(
|
|
44
|
-
(
|
|
45
|
-
[
|
|
46
|
-
),
|
|
47
|
-
const j = D(
|
|
48
|
-
|
|
49
|
-
},
|
|
50
|
-
|
|
44
|
+
(g) => s === "monetary" ? w(g) : g,
|
|
45
|
+
[s, w]
|
|
46
|
+
), $ = (g) => {
|
|
47
|
+
const j = D(g);
|
|
48
|
+
h ? a == null || a(j) : v == null || v.field.onChange(j);
|
|
49
|
+
}, _ = () => {
|
|
50
|
+
h || v == null || v.field.onBlur();
|
|
51
51
|
};
|
|
52
52
|
if (A)
|
|
53
|
-
return /* @__PURE__ */
|
|
53
|
+
return /* @__PURE__ */ k("div", { className: "form-group", children: [
|
|
54
54
|
/* @__PURE__ */ r("label", { children: t }),
|
|
55
|
-
/* @__PURE__ */ r("span", { className: "form-control", children:
|
|
55
|
+
/* @__PURE__ */ r("span", { className: "form-control", children: m || "-" })
|
|
56
56
|
] });
|
|
57
|
-
const
|
|
58
|
-
return /* @__PURE__ */
|
|
57
|
+
const y = `form-control ${O ? "readOnly" : ""} ${d ? "border-red" : ""} ${c}`;
|
|
58
|
+
return /* @__PURE__ */ k("div", { className: `form-group ${S ? "hidden" : ""}`, children: [
|
|
59
59
|
t && /* @__PURE__ */ r("label", { children: t }),
|
|
60
|
-
|
|
60
|
+
f ? /* @__PURE__ */ r(
|
|
61
61
|
le,
|
|
62
62
|
{
|
|
63
63
|
name: e,
|
|
64
|
-
mask:
|
|
65
|
-
value: String(
|
|
64
|
+
mask: f,
|
|
65
|
+
value: String(m ?? ""),
|
|
66
66
|
unmask: !1,
|
|
67
|
-
onAccept: (
|
|
67
|
+
onAccept: (g) => $(g),
|
|
68
68
|
placeholder: n,
|
|
69
|
-
readOnly:
|
|
70
|
-
className:
|
|
71
|
-
inputRef:
|
|
72
|
-
onBlur:
|
|
69
|
+
readOnly: O,
|
|
70
|
+
className: y,
|
|
71
|
+
inputRef: h || v == null ? void 0 : v.field.ref,
|
|
72
|
+
onBlur: _
|
|
73
73
|
}
|
|
74
74
|
) : /* @__PURE__ */ r(
|
|
75
75
|
"input",
|
|
76
76
|
{
|
|
77
77
|
type: "text",
|
|
78
78
|
name: e,
|
|
79
|
-
value:
|
|
80
|
-
onChange: (
|
|
81
|
-
onBlur:
|
|
79
|
+
value: m ?? "",
|
|
80
|
+
onChange: (g) => $(g.target.value),
|
|
81
|
+
onBlur: _,
|
|
82
82
|
placeholder: n,
|
|
83
|
-
readOnly:
|
|
84
|
-
className:
|
|
83
|
+
readOnly: O,
|
|
84
|
+
className: y
|
|
85
85
|
}
|
|
86
86
|
),
|
|
87
|
-
|
|
87
|
+
d && /* @__PURE__ */ r("p", { className: "text-danger", children: String(d) })
|
|
88
88
|
] });
|
|
89
89
|
}
|
|
90
|
-
const Vt = z(
|
|
91
|
-
function
|
|
90
|
+
const Vt = z(Re);
|
|
91
|
+
function Se({
|
|
92
92
|
name: e,
|
|
93
93
|
label: t = "",
|
|
94
94
|
options: n = [],
|
|
95
|
-
placeholder:
|
|
96
|
-
labelKey:
|
|
97
|
-
valueKey:
|
|
95
|
+
placeholder: s = "",
|
|
96
|
+
labelKey: i = "label",
|
|
97
|
+
valueKey: c = "value",
|
|
98
98
|
enableSearch: l = !1,
|
|
99
99
|
searchPlaceholder: o = "Buscar...",
|
|
100
|
-
loading:
|
|
100
|
+
loading: b = !1,
|
|
101
101
|
onSearchChange: a,
|
|
102
102
|
debounceTime: N = 300,
|
|
103
|
-
onSelect:
|
|
103
|
+
onSelect: h,
|
|
104
104
|
forceReadOnly: W = !1,
|
|
105
105
|
forceHidden: V = !1,
|
|
106
|
-
valueManual:
|
|
107
|
-
onChangeManual:
|
|
106
|
+
valueManual: O,
|
|
107
|
+
onChangeManual: S,
|
|
108
108
|
errorManual: A
|
|
109
109
|
}) {
|
|
110
110
|
var ne;
|
|
111
|
-
const p =
|
|
112
|
-
let
|
|
113
|
-
},
|
|
111
|
+
const p = O !== void 0 && !!S, { isReadOnly: v, isHidden: u } = F(), m = W || !!v(e), d = V || !!u(e), { isView: f } = L();
|
|
112
|
+
let w = "", D = () => {
|
|
113
|
+
}, $, _ = null, y = () => {
|
|
114
114
|
};
|
|
115
115
|
if (p)
|
|
116
|
-
|
|
116
|
+
w = O;
|
|
117
117
|
else
|
|
118
118
|
try {
|
|
119
119
|
const R = H(), T = X({ name: e, control: R.control });
|
|
120
|
-
|
|
120
|
+
w = T.field.value, D = T.field.onChange, $ = T.field.ref, _ = (ne = T.fieldState) == null ? void 0 : ne.error, y = R.clearErrors;
|
|
121
121
|
} catch {
|
|
122
122
|
}
|
|
123
|
-
const [
|
|
123
|
+
const [x, P] = I(!1), [g, j] = I(""), q = G(null), U = G(a);
|
|
124
124
|
E(() => {
|
|
125
125
|
U.current = a;
|
|
126
126
|
}, [a]), E(() => {
|
|
127
127
|
const R = (T) => {
|
|
128
|
-
q.current && !q.current.contains(T.target) &&
|
|
128
|
+
q.current && !q.current.contains(T.target) && P(!1);
|
|
129
129
|
};
|
|
130
130
|
return document.addEventListener("mousedown", R), () => document.removeEventListener("mousedown", R);
|
|
131
131
|
}, []), E(() => {
|
|
132
|
-
|
|
133
|
-
}, [
|
|
132
|
+
x || j("");
|
|
133
|
+
}, [x]), E(() => {
|
|
134
134
|
if (!l) return;
|
|
135
135
|
const R = setTimeout(() => {
|
|
136
136
|
var T;
|
|
137
|
-
(T = U.current) == null || T.call(U,
|
|
137
|
+
(T = U.current) == null || T.call(U, g);
|
|
138
138
|
}, N);
|
|
139
139
|
return () => clearTimeout(R);
|
|
140
|
-
}, [
|
|
141
|
-
const ee = B(() => l && !a &&
|
|
142
|
-
(R) => String((R == null ? void 0 : R[
|
|
143
|
-
) : n ?? [], [n, l, a,
|
|
144
|
-
if (
|
|
145
|
-
if (typeof
|
|
146
|
-
return String(
|
|
140
|
+
}, [g, l, N]);
|
|
141
|
+
const ee = B(() => l && !a && g.trim() ? n.filter(
|
|
142
|
+
(R) => String((R == null ? void 0 : R[i]) ?? "").toLowerCase().includes(g.toLowerCase())
|
|
143
|
+
) : n ?? [], [n, l, a, g, i]), te = B(() => {
|
|
144
|
+
if (w == null) return "";
|
|
145
|
+
if (typeof w == "object")
|
|
146
|
+
return String(w[c] ?? "");
|
|
147
147
|
const R = (n || []).find(
|
|
148
|
-
(T) => String(T == null ? void 0 : T[
|
|
148
|
+
(T) => String(T == null ? void 0 : T[c]) === String(w)
|
|
149
149
|
);
|
|
150
|
-
return String(R ? (R == null ? void 0 : R[
|
|
151
|
-
}, [
|
|
152
|
-
|
|
150
|
+
return String(R ? (R == null ? void 0 : R[i]) ?? "" : w);
|
|
151
|
+
}, [w, n, c, i]), de = (R) => {
|
|
152
|
+
m || (p ? S == null || S(R[c]) : (D(R[c]), y == null || y(e)), h == null || h(R), P(!1));
|
|
153
153
|
};
|
|
154
|
-
return /* @__PURE__ */
|
|
154
|
+
return /* @__PURE__ */ k(
|
|
155
155
|
"div",
|
|
156
156
|
{
|
|
157
|
-
className: `select-wrapper form-group ${
|
|
157
|
+
className: `select-wrapper form-group ${d ? "hidden" : ""}`,
|
|
158
158
|
ref: q,
|
|
159
159
|
children: [
|
|
160
160
|
/* @__PURE__ */ r("label", { className: "control-label", children: t }),
|
|
161
|
-
|
|
162
|
-
/* @__PURE__ */
|
|
161
|
+
f ? /* @__PURE__ */ r("span", { className: "form-control", children: te || "-" }) : /* @__PURE__ */ k(ce, { children: [
|
|
162
|
+
/* @__PURE__ */ k(
|
|
163
163
|
"div",
|
|
164
164
|
{
|
|
165
|
-
className: `select-control ${
|
|
166
|
-
onClick: () => !
|
|
167
|
-
ref:
|
|
165
|
+
className: `select-control ${_ ? "border-red" : ""} ${m ? "readOnly" : ""}`,
|
|
166
|
+
onClick: () => !m && P((R) => !R),
|
|
167
|
+
ref: $,
|
|
168
168
|
children: [
|
|
169
|
-
/* @__PURE__ */ r("span", { className: `select-display ${
|
|
169
|
+
/* @__PURE__ */ r("span", { className: `select-display ${m ? "readOnly" : ""}`, children: te || s }),
|
|
170
170
|
/* @__PURE__ */ r("i", { className: "flaticon flaticon-chevron-down select-icon" })
|
|
171
171
|
]
|
|
172
172
|
}
|
|
173
173
|
),
|
|
174
|
-
|
|
174
|
+
x && !m && /* @__PURE__ */ k("div", { className: "select-dropdown", children: [
|
|
175
175
|
l && /* @__PURE__ */ r("div", { className: "select-search", children: /* @__PURE__ */ r(
|
|
176
176
|
"input",
|
|
177
177
|
{
|
|
178
178
|
type: "text",
|
|
179
179
|
className: "select-search-input",
|
|
180
|
-
value:
|
|
180
|
+
value: g,
|
|
181
181
|
onChange: (R) => j(R.target.value),
|
|
182
|
-
placeholder:
|
|
182
|
+
placeholder: b ? "Carregando..." : o,
|
|
183
183
|
autoFocus: !0,
|
|
184
184
|
onClick: (R) => R.stopPropagation()
|
|
185
185
|
}
|
|
186
186
|
) }),
|
|
187
|
-
/* @__PURE__ */ r("ul", { className: "select-options", children:
|
|
187
|
+
/* @__PURE__ */ r("ul", { className: "select-options", children: b ? /* @__PURE__ */ r("li", { className: "select-option readOnly", children: "Carregando..." }) : ee.length > 0 ? ee.map((R) => /* @__PURE__ */ r(
|
|
188
188
|
"li",
|
|
189
189
|
{
|
|
190
|
-
onClick: () =>
|
|
190
|
+
onClick: () => de(R),
|
|
191
191
|
className: "select-option handleHover",
|
|
192
|
-
children: R[
|
|
192
|
+
children: R[i]
|
|
193
193
|
},
|
|
194
|
-
R[
|
|
194
|
+
R[c]
|
|
195
195
|
)) : /* @__PURE__ */ r("li", { className: "select-option readOnly", children: "Sem resultados" }) })
|
|
196
196
|
] })
|
|
197
197
|
] }),
|
|
198
|
-
!p && /* @__PURE__ */ r("input", { type: "hidden", name: e, value:
|
|
199
|
-
(
|
|
198
|
+
!p && /* @__PURE__ */ r("input", { type: "hidden", name: e, value: w || "" }),
|
|
199
|
+
(_ || A) && /* @__PURE__ */ r("p", { className: "text-danger", children: String((_ == null ? void 0 : _.message) ?? A) })
|
|
200
200
|
]
|
|
201
201
|
}
|
|
202
202
|
);
|
|
203
203
|
}
|
|
204
|
-
const Dt = z(
|
|
204
|
+
const Dt = z(Se);
|
|
205
205
|
function Tt({
|
|
206
206
|
name: e,
|
|
207
207
|
options: t = [],
|
|
208
208
|
label: n = "",
|
|
209
|
-
valueKey:
|
|
210
|
-
labelKey:
|
|
211
|
-
forceReadOnly:
|
|
209
|
+
valueKey: s = "value",
|
|
210
|
+
labelKey: i = "label",
|
|
211
|
+
forceReadOnly: c = !1,
|
|
212
212
|
forceHidden: l = !1,
|
|
213
213
|
valueManual: o,
|
|
214
|
-
onChangeManual:
|
|
214
|
+
onChangeManual: b
|
|
215
215
|
}) {
|
|
216
|
-
var
|
|
216
|
+
var $, _;
|
|
217
217
|
let a = null;
|
|
218
218
|
try {
|
|
219
219
|
a = H();
|
|
220
220
|
} catch {
|
|
221
221
|
}
|
|
222
|
-
const N = o !== void 0 && !!
|
|
223
|
-
(
|
|
224
|
-
const
|
|
222
|
+
const N = o !== void 0 && !!b, { isView: h, isReadOnly: W } = L(), { isReadOnly: V, isHidden: O } = F(), S = V ? V(e) : !1, A = O ? O(e) : !1, p = c || S, v = l || A, u = p || W || h, m = () => t ? t.reduce(
|
|
223
|
+
(y, x) => {
|
|
224
|
+
const P = String(x[s]);
|
|
225
225
|
if (N)
|
|
226
|
-
|
|
226
|
+
y[P] = !!(o != null && o[P]);
|
|
227
227
|
else if (a) {
|
|
228
|
-
const
|
|
229
|
-
|
|
228
|
+
const g = a.getValues(P);
|
|
229
|
+
y[P] = g === "on";
|
|
230
230
|
} else
|
|
231
|
-
|
|
232
|
-
return
|
|
231
|
+
y[P] = !1;
|
|
232
|
+
return y;
|
|
233
233
|
},
|
|
234
234
|
{}
|
|
235
|
-
) : {},
|
|
235
|
+
) : {}, d = !N && a ? a.watch(e) : void 0, f = B(() => N && o ? o : d && typeof d == "object" ? d : m(), [d, o, t]);
|
|
236
236
|
E(() => {
|
|
237
237
|
if (N || !a) return;
|
|
238
|
-
const
|
|
239
|
-
(!
|
|
238
|
+
const y = a.getValues(e);
|
|
239
|
+
(!y || typeof y != "object") && a.setValue(e, f, {
|
|
240
240
|
shouldDirty: !1,
|
|
241
241
|
shouldValidate: !1
|
|
242
242
|
});
|
|
243
|
-
}, [
|
|
244
|
-
const
|
|
245
|
-
if (
|
|
246
|
-
const
|
|
243
|
+
}, [f, e, a, N]);
|
|
244
|
+
const w = (y, x) => {
|
|
245
|
+
if (u) return;
|
|
246
|
+
const P = { ...f, [y]: x };
|
|
247
247
|
if (N) {
|
|
248
|
-
|
|
248
|
+
b && b(P);
|
|
249
249
|
return;
|
|
250
250
|
}
|
|
251
|
-
a && (a.setValue(e,
|
|
251
|
+
a && (a.setValue(e, P, {
|
|
252
252
|
shouldDirty: !0,
|
|
253
253
|
shouldValidate: !0
|
|
254
|
-
}), a.setValue(
|
|
255
|
-
}, D = N ? null : (
|
|
256
|
-
return /* @__PURE__ */
|
|
254
|
+
}), a.setValue(y, x ? "on" : "", { shouldValidate: !1 }));
|
|
255
|
+
}, D = N ? null : (_ = ($ = a == null ? void 0 : a.formState) == null ? void 0 : $.errors) == null ? void 0 : _[e];
|
|
256
|
+
return /* @__PURE__ */ k("div", { className: `form-group ${v ? "hidden" : ""}`, children: [
|
|
257
257
|
n && /* @__PURE__ */ r("label", { children: n }),
|
|
258
258
|
/* @__PURE__ */ r(
|
|
259
259
|
"div",
|
|
260
260
|
{
|
|
261
|
-
className: `checkbox-group-custom ${
|
|
262
|
-
children: t.map((
|
|
263
|
-
const
|
|
264
|
-
return /* @__PURE__ */
|
|
265
|
-
!N && a && /* @__PURE__ */ r("input", { type: "hidden", ...a.register(
|
|
266
|
-
/* @__PURE__ */
|
|
261
|
+
className: `checkbox-group-custom ${u ? "readOnly" : ""}`,
|
|
262
|
+
children: t.map((y) => {
|
|
263
|
+
const x = String(y[s]), P = f[x] === !0;
|
|
264
|
+
return /* @__PURE__ */ k("div", { children: [
|
|
265
|
+
!N && a && /* @__PURE__ */ r("input", { type: "hidden", ...a.register(x) }),
|
|
266
|
+
/* @__PURE__ */ k(
|
|
267
267
|
"label",
|
|
268
268
|
{
|
|
269
|
-
className: `custom-checkbox ${
|
|
269
|
+
className: `custom-checkbox ${P ? "checked" : ""} ${u ? "readOnly" : ""}`,
|
|
270
270
|
children: [
|
|
271
271
|
/* @__PURE__ */ r(
|
|
272
272
|
"input",
|
|
273
273
|
{
|
|
274
274
|
type: "checkbox",
|
|
275
|
-
checked:
|
|
276
|
-
disabled:
|
|
277
|
-
onChange: (
|
|
275
|
+
checked: P,
|
|
276
|
+
disabled: u,
|
|
277
|
+
onChange: (g) => w(x, g.target.checked)
|
|
278
278
|
}
|
|
279
279
|
),
|
|
280
280
|
/* @__PURE__ */ r("span", { className: "checkmark" }),
|
|
281
|
-
/* @__PURE__ */ r("span", { children:
|
|
281
|
+
/* @__PURE__ */ r("span", { children: y[i] })
|
|
282
282
|
]
|
|
283
283
|
}
|
|
284
284
|
)
|
|
285
|
-
] },
|
|
285
|
+
] }, x);
|
|
286
286
|
})
|
|
287
287
|
}
|
|
288
288
|
),
|
|
@@ -293,129 +293,116 @@ function Pe({
|
|
|
293
293
|
name: e,
|
|
294
294
|
label: t = "",
|
|
295
295
|
options: n = [],
|
|
296
|
-
valueKey:
|
|
297
|
-
labelKey:
|
|
298
|
-
iconKey:
|
|
296
|
+
valueKey: s = "value",
|
|
297
|
+
labelKey: i = "label",
|
|
298
|
+
iconKey: c = "icon",
|
|
299
299
|
forceReadOnly: l = !1,
|
|
300
300
|
forceHidden: o = !1,
|
|
301
|
-
valueManual:
|
|
301
|
+
valueManual: b,
|
|
302
302
|
onChangeManual: a,
|
|
303
303
|
errorManual: N
|
|
304
304
|
}) {
|
|
305
|
-
var
|
|
306
|
-
const
|
|
307
|
-
let
|
|
305
|
+
var $, _;
|
|
306
|
+
const h = b !== void 0 && !!a, { isReadOnly: W, isHidden: V } = F(), O = l || !!W(e), S = o || !!V(e), { isView: A, isReadOnly: p } = L();
|
|
307
|
+
let v = null;
|
|
308
308
|
try {
|
|
309
|
-
|
|
309
|
+
v = H();
|
|
310
310
|
} catch {
|
|
311
311
|
}
|
|
312
|
-
const
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
(k) => {
|
|
316
|
-
h || (y ? a == null || a(k) : u == null || u.onChange(k));
|
|
312
|
+
const u = !h && v ? X({ name: e, control: v.control, defaultValue: "" }) : null, m = !h && v ? se({ name: e }) : null, d = h ? N : (_ = ($ = m == null ? void 0 : m.errors) == null ? void 0 : $[e]) == null ? void 0 : _.message, f = O || p || A, w = h ? b : (u == null ? void 0 : u.field.value) ?? "", D = C(
|
|
313
|
+
(y) => {
|
|
314
|
+
f || (h ? a == null || a(y) : (u == null || u.field.onChange(y), u == null || u.field.onBlur()));
|
|
317
315
|
},
|
|
318
|
-
[
|
|
316
|
+
[f, h, a, u]
|
|
319
317
|
);
|
|
320
|
-
return /* @__PURE__ */
|
|
318
|
+
return /* @__PURE__ */ k("div", { className: `form-group column ${S ? "hidden" : ""}`, children: [
|
|
321
319
|
t && /* @__PURE__ */ r("label", { className: "control-label", children: t }),
|
|
322
|
-
/* @__PURE__ */ r("div", { className: `btn-group ${
|
|
323
|
-
const
|
|
324
|
-
return
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
{
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
onChange: () => D(v),
|
|
341
|
-
onBlur: u == null ? void 0 : u.onBlur,
|
|
342
|
-
ref: u == null ? void 0 : u.ref,
|
|
343
|
-
disabled: h
|
|
344
|
-
}
|
|
345
|
-
),
|
|
346
|
-
k[d] && /* @__PURE__ */ r("i", { className: `${k[d]} icon-sm` }),
|
|
347
|
-
" ",
|
|
348
|
-
k[s]
|
|
349
|
-
]
|
|
350
|
-
},
|
|
351
|
-
v
|
|
320
|
+
/* @__PURE__ */ r("div", { className: `btn-group ${f ? "view-mode" : ""}`, "data-field-name": e, children: n.map((y) => {
|
|
321
|
+
const x = y[s], P = w === x, g = y.color ? { "--customColor": y.color } : void 0;
|
|
322
|
+
return (
|
|
323
|
+
// Trocado de <label> para <div> para evitar comportamentos nativos de clique do HTML
|
|
324
|
+
/* @__PURE__ */ k(
|
|
325
|
+
"div",
|
|
326
|
+
{
|
|
327
|
+
style: g,
|
|
328
|
+
className: `btn fs-ellipsis ${P ? "active" : ""}`,
|
|
329
|
+
onClick: () => D(x),
|
|
330
|
+
children: [
|
|
331
|
+
y[c] && /* @__PURE__ */ r("i", { className: `${y[c]} icon-sm` }),
|
|
332
|
+
" ",
|
|
333
|
+
y[i]
|
|
334
|
+
]
|
|
335
|
+
},
|
|
336
|
+
x
|
|
337
|
+
)
|
|
352
338
|
);
|
|
353
339
|
}) }),
|
|
354
|
-
|
|
340
|
+
!h && /* @__PURE__ */ r("input", { type: "hidden", name: e, value: w || "" }),
|
|
341
|
+
(d || N) && /* @__PURE__ */ r("p", { className: "text-danger", children: String(d ?? N) })
|
|
355
342
|
] });
|
|
356
343
|
}
|
|
357
|
-
const jt = z(Pe),
|
|
344
|
+
const jt = z(Pe), Oe = ({
|
|
358
345
|
name: e,
|
|
359
346
|
label: t = "",
|
|
360
347
|
placeholder: n = "",
|
|
361
|
-
className:
|
|
362
|
-
rows:
|
|
363
|
-
maxLength:
|
|
348
|
+
className: s = "",
|
|
349
|
+
rows: i = 4,
|
|
350
|
+
maxLength: c,
|
|
364
351
|
forceReadOnly: l = !1,
|
|
365
352
|
forceHidden: o = !1,
|
|
366
|
-
valueManual:
|
|
353
|
+
valueManual: b,
|
|
367
354
|
onChangeManual: a,
|
|
368
355
|
errorManual: N
|
|
369
356
|
}) => {
|
|
370
|
-
var
|
|
371
|
-
const
|
|
372
|
-
let
|
|
373
|
-
value:
|
|
374
|
-
onChange: (
|
|
375
|
-
},
|
|
376
|
-
if (!
|
|
357
|
+
var f;
|
|
358
|
+
const h = b !== void 0 && !!a, { isReadOnly: W, isHidden: V } = F(), O = l || !!W(e), S = o || !!V(e), { isView: A } = L(), p = G(null);
|
|
359
|
+
let v = {
|
|
360
|
+
value: b ?? "",
|
|
361
|
+
onChange: (w) => a == null ? void 0 : a(w)
|
|
362
|
+
}, u = null;
|
|
363
|
+
if (!h)
|
|
377
364
|
try {
|
|
378
|
-
const { control:
|
|
379
|
-
|
|
365
|
+
const { control: w } = H(), D = X({ name: e, control: w });
|
|
366
|
+
v = D.field, u = (f = D.fieldState) == null ? void 0 : f.error;
|
|
380
367
|
} catch {
|
|
381
368
|
}
|
|
382
|
-
const
|
|
369
|
+
const m = () => {
|
|
383
370
|
p.current && (p.current.style.height = "auto", p.current.style.height = `${p.current.scrollHeight}px`);
|
|
384
371
|
};
|
|
385
372
|
if (E(() => {
|
|
386
|
-
|
|
387
|
-
}, [
|
|
388
|
-
return /* @__PURE__ */
|
|
373
|
+
m();
|
|
374
|
+
}, [v.value]), A)
|
|
375
|
+
return /* @__PURE__ */ k("div", { className: `form-group ${S ? "hidden" : ""}`, children: [
|
|
389
376
|
/* @__PURE__ */ r("label", { children: t }),
|
|
390
|
-
/* @__PURE__ */ r("span", { className: "form-control", children:
|
|
377
|
+
/* @__PURE__ */ r("span", { className: "form-control", children: v.value || "-" })
|
|
391
378
|
] });
|
|
392
|
-
const
|
|
393
|
-
return /* @__PURE__ */
|
|
379
|
+
const d = `form-control ${O ? "readOnly" : ""} ${u || N ? "border-red" : ""} ${s}`;
|
|
380
|
+
return /* @__PURE__ */ k("div", { className: `form-group ${S ? "hidden" : ""}`, children: [
|
|
394
381
|
t && /* @__PURE__ */ r("label", { children: t }),
|
|
395
382
|
/* @__PURE__ */ r(
|
|
396
383
|
"textarea",
|
|
397
384
|
{
|
|
398
385
|
ref: p,
|
|
399
|
-
rows:
|
|
400
|
-
maxLength:
|
|
401
|
-
value:
|
|
386
|
+
rows: i,
|
|
387
|
+
maxLength: c,
|
|
388
|
+
value: v.value || "",
|
|
402
389
|
placeholder: n,
|
|
403
|
-
readOnly:
|
|
404
|
-
className:
|
|
390
|
+
readOnly: O,
|
|
391
|
+
className: d,
|
|
405
392
|
style: {
|
|
406
393
|
resize: "none",
|
|
407
394
|
maxHeight: "400px",
|
|
408
395
|
overflowY: "auto"
|
|
409
396
|
},
|
|
410
|
-
onChange: (
|
|
411
|
-
|
|
397
|
+
onChange: (w) => {
|
|
398
|
+
h ? a == null || a(w.target.value) : v.onChange(w);
|
|
412
399
|
},
|
|
413
|
-
onInput:
|
|
400
|
+
onInput: m
|
|
414
401
|
}
|
|
415
402
|
),
|
|
416
|
-
(
|
|
403
|
+
(u || N) && /* @__PURE__ */ r("p", { className: "text-danger", children: String((u == null ? void 0 : u.message) ?? N) })
|
|
417
404
|
] });
|
|
418
|
-
}, Ct = z(
|
|
405
|
+
}, Ct = z(Oe);
|
|
419
406
|
function J(e) {
|
|
420
407
|
return (t = {}) => {
|
|
421
408
|
const n = t.width ? String(t.width) : e.defaultWidth;
|
|
@@ -424,30 +411,30 @@ function J(e) {
|
|
|
424
411
|
}
|
|
425
412
|
function Q(e) {
|
|
426
413
|
return (t, n) => {
|
|
427
|
-
const
|
|
428
|
-
let
|
|
429
|
-
if (
|
|
414
|
+
const s = n != null && n.context ? String(n.context) : "standalone";
|
|
415
|
+
let i;
|
|
416
|
+
if (s === "formatting" && e.formattingValues) {
|
|
430
417
|
const l = e.defaultFormattingWidth || e.defaultWidth, o = n != null && n.width ? String(n.width) : l;
|
|
431
|
-
|
|
418
|
+
i = e.formattingValues[o] || e.formattingValues[l];
|
|
432
419
|
} else {
|
|
433
420
|
const l = e.defaultWidth, o = n != null && n.width ? String(n.width) : e.defaultWidth;
|
|
434
|
-
|
|
421
|
+
i = e.values[o] || e.values[l];
|
|
435
422
|
}
|
|
436
|
-
const
|
|
437
|
-
return
|
|
423
|
+
const c = e.argumentCallback ? e.argumentCallback(t) : t;
|
|
424
|
+
return i[c];
|
|
438
425
|
};
|
|
439
426
|
}
|
|
440
427
|
function Y(e) {
|
|
441
428
|
return (t, n = {}) => {
|
|
442
|
-
const
|
|
443
|
-
if (!
|
|
429
|
+
const s = n.width, i = s && e.matchPatterns[s] || e.matchPatterns[e.defaultMatchWidth], c = t.match(i);
|
|
430
|
+
if (!c)
|
|
444
431
|
return null;
|
|
445
|
-
const l =
|
|
432
|
+
const l = c[0], o = s && e.parsePatterns[s] || e.parsePatterns[e.defaultParseWidth], b = Array.isArray(o) ? $e(o, (h) => h.test(l)) : (
|
|
446
433
|
// [TODO] -- I challenge you to fix the type
|
|
447
|
-
_e(o, (
|
|
434
|
+
_e(o, (h) => h.test(l))
|
|
448
435
|
);
|
|
449
436
|
let a;
|
|
450
|
-
a = e.valueCallback ? e.valueCallback(
|
|
437
|
+
a = e.valueCallback ? e.valueCallback(b) : b, a = n.valueCallback ? (
|
|
451
438
|
// [TODO] -- I challenge you to fix the type
|
|
452
439
|
n.valueCallback(a)
|
|
453
440
|
) : a;
|
|
@@ -460,20 +447,20 @@ function _e(e, t) {
|
|
|
460
447
|
if (Object.prototype.hasOwnProperty.call(e, n) && t(e[n]))
|
|
461
448
|
return n;
|
|
462
449
|
}
|
|
463
|
-
function
|
|
450
|
+
function $e(e, t) {
|
|
464
451
|
for (let n = 0; n < e.length; n++)
|
|
465
452
|
if (t(e[n]))
|
|
466
453
|
return n;
|
|
467
454
|
}
|
|
468
455
|
function Ae(e) {
|
|
469
456
|
return (t, n = {}) => {
|
|
470
|
-
const
|
|
471
|
-
if (!
|
|
472
|
-
const
|
|
473
|
-
if (!
|
|
474
|
-
let l = e.valueCallback ? e.valueCallback(
|
|
457
|
+
const s = t.match(e.matchPattern);
|
|
458
|
+
if (!s) return null;
|
|
459
|
+
const i = s[0], c = t.match(e.parsePattern);
|
|
460
|
+
if (!c) return null;
|
|
461
|
+
let l = e.valueCallback ? e.valueCallback(c[0]) : c[0];
|
|
475
462
|
l = n.valueCallback ? n.valueCallback(l) : l;
|
|
476
|
-
const o = t.slice(
|
|
463
|
+
const o = t.slice(i.length);
|
|
477
464
|
return { value: l, rest: o };
|
|
478
465
|
};
|
|
479
466
|
}
|
|
@@ -540,9 +527,9 @@ const We = {
|
|
|
540
527
|
other: "quase {{count}} anos"
|
|
541
528
|
}
|
|
542
529
|
}, Ve = (e, t, n) => {
|
|
543
|
-
let
|
|
544
|
-
const
|
|
545
|
-
return typeof
|
|
530
|
+
let s;
|
|
531
|
+
const i = We[e];
|
|
532
|
+
return typeof i == "string" ? s = i : t === 1 ? s = i.one : s = i.other.replace("{{count}}", String(t)), n != null && n.addSuffix ? n.comparison && n.comparison > 0 ? "em " + s : "há " + s : s;
|
|
546
533
|
}, De = {
|
|
547
534
|
full: "EEEE, d 'de' MMMM 'de' y",
|
|
548
535
|
long: "d 'de' MMMM 'de' y",
|
|
@@ -581,18 +568,18 @@ const We = {
|
|
|
581
568
|
tomorrow: "'amanhã às' p",
|
|
582
569
|
nextWeek: "eeee 'às' p",
|
|
583
570
|
other: "P"
|
|
584
|
-
}, He = (e, t, n,
|
|
585
|
-
const
|
|
586
|
-
return typeof
|
|
571
|
+
}, He = (e, t, n, s) => {
|
|
572
|
+
const i = Ee[e];
|
|
573
|
+
return typeof i == "function" ? i(t) : i;
|
|
587
574
|
}, Le = {
|
|
588
575
|
narrow: ["AC", "DC"],
|
|
589
576
|
abbreviated: ["AC", "DC"],
|
|
590
577
|
wide: ["antes de cristo", "depois de cristo"]
|
|
591
|
-
},
|
|
578
|
+
}, Ie = {
|
|
592
579
|
narrow: ["1", "2", "3", "4"],
|
|
593
580
|
abbreviated: ["T1", "T2", "T3", "T4"],
|
|
594
581
|
wide: ["1º trimestre", "2º trimestre", "3º trimestre", "4º trimestre"]
|
|
595
|
-
},
|
|
582
|
+
}, Fe = {
|
|
596
583
|
narrow: ["j", "f", "m", "a", "m", "j", "j", "a", "s", "o", "n", "d"],
|
|
597
584
|
abbreviated: [
|
|
598
585
|
"jan",
|
|
@@ -715,12 +702,12 @@ const We = {
|
|
|
715
702
|
defaultWidth: "wide"
|
|
716
703
|
}),
|
|
717
704
|
quarter: Q({
|
|
718
|
-
values:
|
|
705
|
+
values: Ie,
|
|
719
706
|
defaultWidth: "wide",
|
|
720
707
|
argumentCallback: (e) => e - 1
|
|
721
708
|
}),
|
|
722
709
|
month: Q({
|
|
723
|
-
values:
|
|
710
|
+
values: Fe,
|
|
724
711
|
defaultWidth: "wide"
|
|
725
712
|
}),
|
|
726
713
|
day: Q({
|
|
@@ -791,7 +778,7 @@ const We = {
|
|
|
791
778
|
}, rt = {
|
|
792
779
|
narrow: /^(a|p|mn|md|(da) (manhã|tarde|noite))/i,
|
|
793
780
|
any: /^([ap]\.?\s?m\.?|meia[-\s]noite|meio[-\s]dia|(da) (manhã|tarde|noite))/i
|
|
794
|
-
},
|
|
781
|
+
}, it = {
|
|
795
782
|
any: {
|
|
796
783
|
am: /^a/i,
|
|
797
784
|
pm: /^p/i,
|
|
@@ -802,7 +789,7 @@ const We = {
|
|
|
802
789
|
evening: /tarde/i,
|
|
803
790
|
night: /noite/i
|
|
804
791
|
}
|
|
805
|
-
},
|
|
792
|
+
}, st = {
|
|
806
793
|
ordinalNumber: Ae({
|
|
807
794
|
matchPattern: Qe,
|
|
808
795
|
parsePattern: Ye,
|
|
@@ -836,7 +823,7 @@ const We = {
|
|
|
836
823
|
dayPeriod: Y({
|
|
837
824
|
matchPatterns: rt,
|
|
838
825
|
defaultMatchWidth: "any",
|
|
839
|
-
parsePatterns:
|
|
826
|
+
parsePatterns: it,
|
|
840
827
|
defaultParseWidth: "any"
|
|
841
828
|
})
|
|
842
829
|
}, at = {
|
|
@@ -845,7 +832,7 @@ const We = {
|
|
|
845
832
|
formatLong: Ce,
|
|
846
833
|
formatRelative: He,
|
|
847
834
|
localize: Ue,
|
|
848
|
-
match:
|
|
835
|
+
match: st,
|
|
849
836
|
options: {
|
|
850
837
|
weekStartsOn: 0,
|
|
851
838
|
firstWeekContainsDate: 1
|
|
@@ -857,7 +844,7 @@ const We = {
|
|
|
857
844
|
* This source code is licensed under the ISC license.
|
|
858
845
|
* See the LICENSE file in the root directory of this source tree.
|
|
859
846
|
*/
|
|
860
|
-
const
|
|
847
|
+
const ae = (...e) => e.filter((t, n, s) => !!t && t.trim() !== "" && s.indexOf(t) === n).join(" ").trim();
|
|
861
848
|
/**
|
|
862
849
|
* @license lucide-react v0.575.0 - ISC
|
|
863
850
|
*
|
|
@@ -871,9 +858,9 @@ const ot = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
|
871
858
|
* This source code is licensed under the ISC license.
|
|
872
859
|
* See the LICENSE file in the root directory of this source tree.
|
|
873
860
|
*/
|
|
874
|
-
const
|
|
861
|
+
const dt = (e) => e.replace(
|
|
875
862
|
/^([A-Z])|[\s-_]+(\w)/g,
|
|
876
|
-
(t, n,
|
|
863
|
+
(t, n, s) => s ? s.toUpperCase() : n.toLowerCase()
|
|
877
864
|
);
|
|
878
865
|
/**
|
|
879
866
|
* @license lucide-react v0.575.0 - ISC
|
|
@@ -882,7 +869,7 @@ const ct = (e) => e.replace(
|
|
|
882
869
|
* See the LICENSE file in the root directory of this source tree.
|
|
883
870
|
*/
|
|
884
871
|
const re = (e) => {
|
|
885
|
-
const t =
|
|
872
|
+
const t = dt(e);
|
|
886
873
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
887
874
|
};
|
|
888
875
|
/**
|
|
@@ -891,7 +878,7 @@ const re = (e) => {
|
|
|
891
878
|
* This source code is licensed under the ISC license.
|
|
892
879
|
* See the LICENSE file in the root directory of this source tree.
|
|
893
880
|
*/
|
|
894
|
-
var
|
|
881
|
+
var ct = {
|
|
895
882
|
xmlns: "http://www.w3.org/2000/svg",
|
|
896
883
|
width: 24,
|
|
897
884
|
height: 24,
|
|
@@ -920,32 +907,32 @@ const lt = (e) => {
|
|
|
920
907
|
* This source code is licensed under the ISC license.
|
|
921
908
|
* See the LICENSE file in the root directory of this source tree.
|
|
922
909
|
*/
|
|
923
|
-
const ut =
|
|
910
|
+
const ut = ie(
|
|
924
911
|
({
|
|
925
912
|
color: e = "currentColor",
|
|
926
913
|
size: t = 24,
|
|
927
914
|
strokeWidth: n = 2,
|
|
928
|
-
absoluteStrokeWidth:
|
|
929
|
-
className:
|
|
930
|
-
children:
|
|
915
|
+
absoluteStrokeWidth: s,
|
|
916
|
+
className: i = "",
|
|
917
|
+
children: c,
|
|
931
918
|
iconNode: l,
|
|
932
919
|
...o
|
|
933
|
-
},
|
|
920
|
+
}, b) => Z(
|
|
934
921
|
"svg",
|
|
935
922
|
{
|
|
936
|
-
ref:
|
|
937
|
-
...
|
|
923
|
+
ref: b,
|
|
924
|
+
...ct,
|
|
938
925
|
width: t,
|
|
939
926
|
height: t,
|
|
940
927
|
stroke: e,
|
|
941
|
-
strokeWidth:
|
|
942
|
-
className:
|
|
943
|
-
...!
|
|
928
|
+
strokeWidth: s ? Number(n) * 24 / Number(t) : n,
|
|
929
|
+
className: ae("lucide", i),
|
|
930
|
+
...!c && !lt(o) && { "aria-hidden": "true" },
|
|
944
931
|
...o
|
|
945
932
|
},
|
|
946
933
|
[
|
|
947
934
|
...l.map(([a, N]) => Z(a, N)),
|
|
948
|
-
...Array.isArray(
|
|
935
|
+
...Array.isArray(c) ? c : [c]
|
|
949
936
|
]
|
|
950
937
|
)
|
|
951
938
|
);
|
|
@@ -956,16 +943,16 @@ const ut = se(
|
|
|
956
943
|
* See the LICENSE file in the root directory of this source tree.
|
|
957
944
|
*/
|
|
958
945
|
const M = (e, t) => {
|
|
959
|
-
const n =
|
|
960
|
-
({ className:
|
|
961
|
-
ref:
|
|
946
|
+
const n = ie(
|
|
947
|
+
({ className: s, ...i }, c) => Z(ut, {
|
|
948
|
+
ref: c,
|
|
962
949
|
iconNode: t,
|
|
963
|
-
className:
|
|
950
|
+
className: ae(
|
|
964
951
|
`lucide-${ot(re(e))}`,
|
|
965
952
|
`lucide-${e}`,
|
|
966
|
-
|
|
953
|
+
s
|
|
967
954
|
),
|
|
968
|
-
...
|
|
955
|
+
...i
|
|
969
956
|
})
|
|
970
957
|
);
|
|
971
958
|
return n.displayName = re(e), n;
|
|
@@ -981,14 +968,14 @@ const mt = [
|
|
|
981
968
|
["path", { d: "M16 2v4", key: "4m81vk" }],
|
|
982
969
|
["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
|
|
983
970
|
["path", { d: "M3 10h18", key: "8toen8" }]
|
|
984
|
-
],
|
|
971
|
+
], ft = M("calendar", mt);
|
|
985
972
|
/**
|
|
986
973
|
* @license lucide-react v0.575.0 - ISC
|
|
987
974
|
*
|
|
988
975
|
* This source code is licensed under the ISC license.
|
|
989
976
|
* See the LICENSE file in the root directory of this source tree.
|
|
990
977
|
*/
|
|
991
|
-
const
|
|
978
|
+
const ht = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]], pt = M("chevron-left", ht);
|
|
992
979
|
/**
|
|
993
980
|
* @license lucide-react v0.575.0 - ISC
|
|
994
981
|
*
|
|
@@ -999,118 +986,118 @@ const yt = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]], vt = M("chevron-ri
|
|
|
999
986
|
function gt(e) {
|
|
1000
987
|
const t = G(null);
|
|
1001
988
|
return E(() => {
|
|
1002
|
-
function n(
|
|
1003
|
-
t.current && !t.current.contains(
|
|
989
|
+
function n(s) {
|
|
990
|
+
t.current && !t.current.contains(s.target) && e();
|
|
1004
991
|
}
|
|
1005
992
|
return document.addEventListener("mousedown", n), () => {
|
|
1006
993
|
document.removeEventListener("mousedown", n);
|
|
1007
994
|
};
|
|
1008
995
|
}, [e]), t;
|
|
1009
996
|
}
|
|
1010
|
-
const
|
|
997
|
+
const oe = "dd/MM/yyyy", bt = (e) => {
|
|
1011
998
|
if (!e) return null;
|
|
1012
|
-
const t = ue(e,
|
|
999
|
+
const t = ue(e, oe, /* @__PURE__ */ new Date());
|
|
1013
1000
|
return me(t) ? t : null;
|
|
1014
|
-
}, wt = (e) => e ? K(e,
|
|
1001
|
+
}, wt = (e) => e ? K(e, oe) : "", Nt = ({
|
|
1015
1002
|
name: e,
|
|
1016
1003
|
label: t = "",
|
|
1017
1004
|
placeholder: n = "dd/mm/aaaa",
|
|
1018
|
-
className:
|
|
1019
|
-
forceReadOnly:
|
|
1020
|
-
forceHidden:
|
|
1005
|
+
className: s = "",
|
|
1006
|
+
forceReadOnly: i = !1,
|
|
1007
|
+
forceHidden: c = !1,
|
|
1021
1008
|
valueManual: l,
|
|
1022
1009
|
onChangeManual: o,
|
|
1023
|
-
errorManual:
|
|
1010
|
+
errorManual: b
|
|
1024
1011
|
}) => {
|
|
1025
|
-
var
|
|
1026
|
-
const [a, N] =
|
|
1027
|
-
let
|
|
1012
|
+
var y;
|
|
1013
|
+
const [a, N] = I(!1), [h, W] = I(/* @__PURE__ */ new Date()), V = gt(() => N(!1)), O = l !== void 0 && !!o;
|
|
1014
|
+
let S = null;
|
|
1028
1015
|
try {
|
|
1029
|
-
|
|
1016
|
+
S = H();
|
|
1030
1017
|
} catch {
|
|
1031
1018
|
}
|
|
1032
|
-
const { isView: A } = L(), { isReadOnly: p, isHidden:
|
|
1033
|
-
if (
|
|
1034
|
-
const
|
|
1035
|
-
|
|
1036
|
-
},
|
|
1037
|
-
const
|
|
1038
|
-
start: ye(ve(
|
|
1039
|
-
end:
|
|
1019
|
+
const { isView: A } = L(), { isReadOnly: p, isHidden: v } = F(), u = i || !!p(e), m = c || !!v(e), d = !O && S ? X({ name: e, control: S.control }) : null, f = O ? l : d == null ? void 0 : d.field.value, w = O ? b : (y = d == null ? void 0 : d.fieldState.error) == null ? void 0 : y.message, D = B(() => bt(f), [f]), $ = (x) => {
|
|
1020
|
+
if (u) return;
|
|
1021
|
+
const P = wt(x);
|
|
1022
|
+
O ? o == null || o(P) : d == null || d.field.onChange(P), N(!1);
|
|
1023
|
+
}, _ = (x) => {
|
|
1024
|
+
const P = fe({
|
|
1025
|
+
start: ye(ve(x)),
|
|
1026
|
+
end: he(pe(x))
|
|
1040
1027
|
});
|
|
1041
|
-
return /* @__PURE__ */
|
|
1042
|
-
/* @__PURE__ */
|
|
1028
|
+
return /* @__PURE__ */ k("div", { className: "dfe-calendar-pane", children: [
|
|
1029
|
+
/* @__PURE__ */ k("div", { className: "dfe-calendar-header", children: [
|
|
1043
1030
|
/* @__PURE__ */ r(
|
|
1044
1031
|
"button",
|
|
1045
1032
|
{
|
|
1046
1033
|
type: "button",
|
|
1047
|
-
onClick: (
|
|
1048
|
-
|
|
1034
|
+
onClick: (g) => {
|
|
1035
|
+
g.stopPropagation(), W(ge(h, 1));
|
|
1049
1036
|
},
|
|
1050
1037
|
className: "dfe-nav-btn",
|
|
1051
1038
|
children: /* @__PURE__ */ r(pt, { size: 16 })
|
|
1052
1039
|
}
|
|
1053
1040
|
),
|
|
1054
|
-
/* @__PURE__ */ r("span", { className: "dfe-month-label", children: K(
|
|
1041
|
+
/* @__PURE__ */ r("span", { className: "dfe-month-label", children: K(x, "MMMM yyyy", { locale: at }) }),
|
|
1055
1042
|
/* @__PURE__ */ r(
|
|
1056
1043
|
"button",
|
|
1057
1044
|
{
|
|
1058
1045
|
type: "button",
|
|
1059
|
-
onClick: (
|
|
1060
|
-
|
|
1046
|
+
onClick: (g) => {
|
|
1047
|
+
g.stopPropagation(), W(be(h, 1));
|
|
1061
1048
|
},
|
|
1062
1049
|
className: "dfe-nav-btn",
|
|
1063
1050
|
children: /* @__PURE__ */ r(vt, { size: 16 })
|
|
1064
1051
|
}
|
|
1065
1052
|
)
|
|
1066
1053
|
] }),
|
|
1067
|
-
/* @__PURE__ */ r("div", { className: "dfe-calendar-grid-header", children: ["D", "S", "T", "Q", "Q", "S", "S"].map((
|
|
1068
|
-
/* @__PURE__ */ r("div", { className: "dfe-calendar-grid", children:
|
|
1069
|
-
const q = !we(
|
|
1054
|
+
/* @__PURE__ */ r("div", { className: "dfe-calendar-grid-header", children: ["D", "S", "T", "Q", "Q", "S", "S"].map((g, j) => /* @__PURE__ */ r("span", { children: g }, j)) }),
|
|
1055
|
+
/* @__PURE__ */ r("div", { className: "dfe-calendar-grid", children: P.map((g, j) => {
|
|
1056
|
+
const q = !we(g, x), U = D && Ne(g, D);
|
|
1070
1057
|
return /* @__PURE__ */ r(
|
|
1071
1058
|
"div",
|
|
1072
1059
|
{
|
|
1073
|
-
onClick: () => !q &&
|
|
1060
|
+
onClick: () => !q && $(g),
|
|
1074
1061
|
className: `dfe-calendar-day
|
|
1075
1062
|
${U ? "selected" : ""}
|
|
1076
1063
|
${q ? "outside" : ""}
|
|
1077
|
-
${ke(
|
|
1078
|
-
children: K(
|
|
1064
|
+
${ke(g) ? "today" : ""}`,
|
|
1065
|
+
children: K(g, "d")
|
|
1079
1066
|
},
|
|
1080
1067
|
j
|
|
1081
1068
|
);
|
|
1082
1069
|
}) })
|
|
1083
1070
|
] });
|
|
1084
1071
|
};
|
|
1085
|
-
return
|
|
1072
|
+
return m ? null : A ? /* @__PURE__ */ k("div", { className: `form-group ${s}`, children: [
|
|
1086
1073
|
t && /* @__PURE__ */ r("label", { children: t }),
|
|
1087
|
-
/* @__PURE__ */ r("span", { className: "form-control readOnly", style: { display: "block", height: "auto" }, children:
|
|
1088
|
-
] }) : /* @__PURE__ */
|
|
1074
|
+
/* @__PURE__ */ r("span", { className: "form-control readOnly", style: { display: "block", height: "auto" }, children: f || "-" })
|
|
1075
|
+
] }) : /* @__PURE__ */ k(
|
|
1089
1076
|
"div",
|
|
1090
1077
|
{
|
|
1091
1078
|
ref: V,
|
|
1092
|
-
className: `form-group dfe-datepicker-container ${
|
|
1079
|
+
className: `form-group dfe-datepicker-container ${s}`,
|
|
1093
1080
|
style: { position: "relative" },
|
|
1094
1081
|
children: [
|
|
1095
1082
|
t && /* @__PURE__ */ r("label", { children: t }),
|
|
1096
|
-
/* @__PURE__ */
|
|
1083
|
+
/* @__PURE__ */ k(
|
|
1097
1084
|
"div",
|
|
1098
1085
|
{
|
|
1099
|
-
className: `form-control dfe-datepicker-trigger ${
|
|
1100
|
-
onClick: () => !
|
|
1086
|
+
className: `form-control dfe-datepicker-trigger ${w ? "border-red" : ""} ${u ? "disabled" : ""}`,
|
|
1087
|
+
onClick: () => !u && N(!a),
|
|
1101
1088
|
style: {
|
|
1102
1089
|
display: "flex",
|
|
1103
1090
|
alignItems: "center",
|
|
1104
|
-
cursor:
|
|
1091
|
+
cursor: u ? "default" : "pointer"
|
|
1105
1092
|
},
|
|
1106
1093
|
children: [
|
|
1107
|
-
/* @__PURE__ */ r(
|
|
1108
|
-
/* @__PURE__ */ r("span", { children:
|
|
1094
|
+
/* @__PURE__ */ r(ft, { size: 16, className: "dfe-calendar-icon", style: { marginRight: "8px", opacity: 0.5 } }),
|
|
1095
|
+
/* @__PURE__ */ r("span", { children: f || n })
|
|
1109
1096
|
]
|
|
1110
1097
|
}
|
|
1111
1098
|
),
|
|
1112
|
-
a && !
|
|
1113
|
-
|
|
1099
|
+
a && !u && /* @__PURE__ */ r("div", { className: "dfe-popover-content", children: /* @__PURE__ */ r("div", { className: "dfe-calendars-wrapper", children: _(h) }) }),
|
|
1100
|
+
w && /* @__PURE__ */ r("p", { className: "text-danger", children: String(w) })
|
|
1114
1101
|
]
|
|
1115
1102
|
}
|
|
1116
1103
|
);
|
|
@@ -1119,21 +1106,21 @@ function kt({
|
|
|
1119
1106
|
mapping: e = {},
|
|
1120
1107
|
defaultLabel: t = "Não reconhecido",
|
|
1121
1108
|
className: n = "",
|
|
1122
|
-
hidden:
|
|
1123
|
-
label:
|
|
1109
|
+
hidden: s = !1,
|
|
1110
|
+
label: i
|
|
1124
1111
|
}) {
|
|
1125
|
-
const { activityId:
|
|
1112
|
+
const { activityId: c } = L(), l = B(() => !e || c === null || c === void 0 ? null : e[c], [c, e]);
|
|
1126
1113
|
if (!l)
|
|
1127
|
-
return /* @__PURE__ */
|
|
1128
|
-
|
|
1114
|
+
return /* @__PURE__ */ k("div", { className: `form-group ${s ? "hidden" : ""}`, children: [
|
|
1115
|
+
i && /* @__PURE__ */ r("label", { children: i }),
|
|
1129
1116
|
/* @__PURE__ */ r("div", { className: `status-badge default ${n}`, children: t })
|
|
1130
1117
|
] });
|
|
1131
1118
|
const o = {
|
|
1132
1119
|
"--customColor": l.color
|
|
1133
1120
|
};
|
|
1134
|
-
return /* @__PURE__ */
|
|
1135
|
-
|
|
1136
|
-
/* @__PURE__ */
|
|
1121
|
+
return /* @__PURE__ */ k("div", { className: `form-group ${s ? "hidden" : ""}`, children: [
|
|
1122
|
+
i && /* @__PURE__ */ r("label", { children: i }),
|
|
1123
|
+
/* @__PURE__ */ k("div", { className: `status-badge ${n}`, style: o, children: [
|
|
1137
1124
|
l.icon && /* @__PURE__ */ r("i", { className: l.icon }),
|
|
1138
1125
|
/* @__PURE__ */ r("span", { children: l.label })
|
|
1139
1126
|
] })
|
|
@@ -1144,80 +1131,80 @@ function xt({
|
|
|
1144
1131
|
name: e,
|
|
1145
1132
|
control: t,
|
|
1146
1133
|
defaultRowValue: n,
|
|
1147
|
-
isView:
|
|
1148
|
-
isReadOnly:
|
|
1149
|
-
filters:
|
|
1134
|
+
isView: s,
|
|
1135
|
+
isReadOnly: i,
|
|
1136
|
+
filters: c = []
|
|
1150
1137
|
}) {
|
|
1151
|
-
const { field: l } = X({ name: e, control: t }), [o,
|
|
1138
|
+
const { field: l } = X({ name: e, control: t }), [o, b] = I([]), [a, N] = I([]), h = () => Date.now() + Math.random(), W = (m) => {
|
|
1152
1139
|
try {
|
|
1153
|
-
const
|
|
1154
|
-
return Array.isArray(
|
|
1155
|
-
...
|
|
1156
|
-
_uid:
|
|
1140
|
+
const d = JSON.parse(m);
|
|
1141
|
+
return Array.isArray(d) ? d.map((f) => ({
|
|
1142
|
+
...f,
|
|
1143
|
+
_uid: f._uid || h()
|
|
1157
1144
|
})) : [];
|
|
1158
|
-
} catch (
|
|
1159
|
-
return console.error(`Erro ao ler dados da tabela "${e}":`,
|
|
1145
|
+
} catch (d) {
|
|
1146
|
+
return console.error(`Erro ao ler dados da tabela "${e}":`, d), [];
|
|
1160
1147
|
}
|
|
1161
1148
|
};
|
|
1162
1149
|
E(() => {
|
|
1163
|
-
if (!(o.length > 0 && !
|
|
1164
|
-
const
|
|
1165
|
-
if (l.value ===
|
|
1166
|
-
const
|
|
1167
|
-
|
|
1150
|
+
if (!(o.length > 0 && !s) && l.value && typeof l.value == "string") {
|
|
1151
|
+
const m = JSON.stringify(o);
|
|
1152
|
+
if (l.value === m) return;
|
|
1153
|
+
const d = W(l.value);
|
|
1154
|
+
b(d);
|
|
1168
1155
|
}
|
|
1169
|
-
}, [l.value,
|
|
1170
|
-
if (
|
|
1171
|
-
const
|
|
1172
|
-
l.value !==
|
|
1173
|
-
}, [o, l,
|
|
1156
|
+
}, [l.value, s]), E(() => {
|
|
1157
|
+
if (i) return;
|
|
1158
|
+
const m = JSON.stringify(o);
|
|
1159
|
+
l.value !== m && l.onChange(m);
|
|
1160
|
+
}, [o, l, i]);
|
|
1174
1161
|
const V = C(() => {
|
|
1175
|
-
const
|
|
1176
|
-
|
|
1177
|
-
}, [n]),
|
|
1178
|
-
|
|
1179
|
-
}, [a]),
|
|
1180
|
-
|
|
1181
|
-
}, []), A = C((
|
|
1182
|
-
N((
|
|
1162
|
+
const m = { _uid: h(), ...n };
|
|
1163
|
+
b((d) => [...d, m]);
|
|
1164
|
+
}, [n]), O = C(() => {
|
|
1165
|
+
b((m) => m.filter((d) => !a.includes(d._uid))), N([]);
|
|
1166
|
+
}, [a]), S = C((m, d, f) => {
|
|
1167
|
+
b((w) => w.map((D) => D._uid === m ? { ...D, [d]: f } : D));
|
|
1168
|
+
}, []), A = C((m) => {
|
|
1169
|
+
N((d) => d.includes(m) ? d.filter((f) => f !== m) : [...d, m]);
|
|
1183
1170
|
}, []), p = C(
|
|
1184
|
-
(
|
|
1185
|
-
N(
|
|
1171
|
+
(m) => {
|
|
1172
|
+
N(m ? o.map((d) => d._uid) : []);
|
|
1186
1173
|
},
|
|
1187
1174
|
[o]
|
|
1188
|
-
),
|
|
1189
|
-
(
|
|
1190
|
-
if ("custom" in
|
|
1191
|
-
return
|
|
1192
|
-
const
|
|
1193
|
-
switch (
|
|
1175
|
+
), v = o.length > 0 && a.length === o.length, u = B(() => !c || c.length === 0 ? o : o.filter(
|
|
1176
|
+
(m) => c.every((d) => {
|
|
1177
|
+
if ("custom" in d)
|
|
1178
|
+
return d.custom(m);
|
|
1179
|
+
const f = m[d.field];
|
|
1180
|
+
switch (d.operator) {
|
|
1194
1181
|
case "===":
|
|
1195
|
-
return
|
|
1182
|
+
return f === d.value;
|
|
1196
1183
|
case "!==":
|
|
1197
|
-
return
|
|
1184
|
+
return f !== d.value;
|
|
1198
1185
|
case ">":
|
|
1199
|
-
return
|
|
1186
|
+
return f > d.value;
|
|
1200
1187
|
case "<":
|
|
1201
|
-
return
|
|
1188
|
+
return f < d.value;
|
|
1202
1189
|
case ">=":
|
|
1203
|
-
return
|
|
1190
|
+
return f >= d.value;
|
|
1204
1191
|
case "<=":
|
|
1205
|
-
return
|
|
1192
|
+
return f <= d.value;
|
|
1206
1193
|
default:
|
|
1207
1194
|
return !0;
|
|
1208
1195
|
}
|
|
1209
1196
|
})
|
|
1210
|
-
), [o,
|
|
1197
|
+
), [o, c]);
|
|
1211
1198
|
return {
|
|
1212
1199
|
field: l,
|
|
1213
1200
|
tableRows: o,
|
|
1214
|
-
visibleRows:
|
|
1201
|
+
visibleRows: u,
|
|
1215
1202
|
selectedRowIds: a,
|
|
1216
|
-
isAllSelected:
|
|
1203
|
+
isAllSelected: v,
|
|
1217
1204
|
handle: {
|
|
1218
1205
|
addRow: V,
|
|
1219
|
-
removeRows:
|
|
1220
|
-
updateCellValue:
|
|
1206
|
+
removeRows: O,
|
|
1207
|
+
updateCellValue: S,
|
|
1221
1208
|
toggleSelection: A,
|
|
1222
1209
|
toggleSelectAll: p
|
|
1223
1210
|
}
|
|
@@ -1227,35 +1214,35 @@ const Lt = ({
|
|
|
1227
1214
|
name: e,
|
|
1228
1215
|
title: t = "Tabela Dinâmica",
|
|
1229
1216
|
columns: n,
|
|
1230
|
-
defaultRowValue:
|
|
1231
|
-
forceReadOnly:
|
|
1232
|
-
layout:
|
|
1217
|
+
defaultRowValue: s = {},
|
|
1218
|
+
forceReadOnly: i = !1,
|
|
1219
|
+
layout: c = "fluid",
|
|
1233
1220
|
actions: l = !0,
|
|
1234
1221
|
filters: o = []
|
|
1235
1222
|
}) => {
|
|
1236
|
-
const { control:
|
|
1223
|
+
const { control: b } = H(), { isView: a, isReadOnly: N } = L(), { isReadOnly: h } = F(), W = i || a || N || h && h(e), { field: V, visibleRows: O, selectedRowIds: S, isAllSelected: A, handle: p } = xt({
|
|
1237
1224
|
name: e,
|
|
1238
|
-
control:
|
|
1239
|
-
defaultRowValue:
|
|
1225
|
+
control: b,
|
|
1226
|
+
defaultRowValue: s,
|
|
1240
1227
|
isView: a,
|
|
1241
1228
|
isReadOnly: !!W,
|
|
1242
1229
|
filters: o
|
|
1243
|
-
}),
|
|
1244
|
-
return /* @__PURE__ */
|
|
1230
|
+
}), v = c === "fixed";
|
|
1231
|
+
return /* @__PURE__ */ k("div", { className: `table-wrapper ${v ? "table-fixed" : "table-fluid"}`, children: [
|
|
1245
1232
|
/* @__PURE__ */ r("input", { type: "hidden", ...V }),
|
|
1246
|
-
/* @__PURE__ */
|
|
1233
|
+
/* @__PURE__ */ k("div", { className: "header-handle", children: [
|
|
1247
1234
|
/* @__PURE__ */ r("h3", { children: t }),
|
|
1248
|
-
!W && l && /* @__PURE__ */
|
|
1249
|
-
/* @__PURE__ */
|
|
1235
|
+
!W && l && /* @__PURE__ */ k("div", { className: "handle-actions", children: [
|
|
1236
|
+
/* @__PURE__ */ k(
|
|
1250
1237
|
"button",
|
|
1251
1238
|
{
|
|
1252
1239
|
type: "button",
|
|
1253
|
-
className: `btn ${
|
|
1254
|
-
disabled:
|
|
1240
|
+
className: `btn ${S.length > 0 ? "btn-danger" : "btn-primary"}`,
|
|
1241
|
+
disabled: S.length === 0,
|
|
1255
1242
|
onClick: p.removeRows,
|
|
1256
1243
|
children: [
|
|
1257
1244
|
"Remover (",
|
|
1258
|
-
|
|
1245
|
+
S.length,
|
|
1259
1246
|
")"
|
|
1260
1247
|
]
|
|
1261
1248
|
}
|
|
@@ -1263,192 +1250,192 @@ const Lt = ({
|
|
|
1263
1250
|
/* @__PURE__ */ r("button", { type: "button", className: "btn-add", onClick: p.addRow, children: "Adicionar" })
|
|
1264
1251
|
] })
|
|
1265
1252
|
] }),
|
|
1266
|
-
/* @__PURE__ */ r("div", { className: "table-scroll", children: /* @__PURE__ */
|
|
1267
|
-
/* @__PURE__ */ r("thead", { children: /* @__PURE__ */
|
|
1253
|
+
/* @__PURE__ */ r("div", { className: "table-scroll", children: /* @__PURE__ */ k("table", { className: "table-custom", children: [
|
|
1254
|
+
/* @__PURE__ */ r("thead", { children: /* @__PURE__ */ k("tr", { children: [
|
|
1268
1255
|
!W && /* @__PURE__ */ r("th", { style: { width: "50px" }, children: /* @__PURE__ */ r(
|
|
1269
1256
|
"input",
|
|
1270
1257
|
{
|
|
1271
1258
|
type: "checkbox",
|
|
1272
1259
|
checked: A,
|
|
1273
|
-
onChange: (
|
|
1260
|
+
onChange: (u) => p.toggleSelectAll(u.target.checked)
|
|
1274
1261
|
}
|
|
1275
1262
|
) }),
|
|
1276
|
-
n.map((
|
|
1263
|
+
n.map((u) => /* @__PURE__ */ r(
|
|
1277
1264
|
"th",
|
|
1278
1265
|
{
|
|
1279
|
-
style:
|
|
1280
|
-
children:
|
|
1266
|
+
style: u.width ? { minWidth: v ? u.width : "100%" } : { width: "max-content" },
|
|
1267
|
+
children: u.label
|
|
1281
1268
|
},
|
|
1282
|
-
String(
|
|
1269
|
+
String(u.key)
|
|
1283
1270
|
))
|
|
1284
1271
|
] }) }),
|
|
1285
|
-
/* @__PURE__ */
|
|
1286
|
-
|
|
1272
|
+
/* @__PURE__ */ k("tbody", { children: [
|
|
1273
|
+
O.map((u, m) => /* @__PURE__ */ k("tr", { children: [
|
|
1287
1274
|
!W && /* @__PURE__ */ r("td", { children: /* @__PURE__ */ r(
|
|
1288
1275
|
"input",
|
|
1289
1276
|
{
|
|
1290
1277
|
type: "checkbox",
|
|
1291
|
-
checked:
|
|
1292
|
-
onChange: () => p.toggleSelection(
|
|
1278
|
+
checked: S.includes(u._uid),
|
|
1279
|
+
onChange: () => p.toggleSelection(u._uid)
|
|
1293
1280
|
}
|
|
1294
1281
|
) }),
|
|
1295
|
-
n.map((
|
|
1296
|
-
row:
|
|
1297
|
-
index:
|
|
1298
|
-
updateRow: (
|
|
1282
|
+
n.map((d) => /* @__PURE__ */ r("td", { children: d.render ? d.render.length <= 1 ? d.render({
|
|
1283
|
+
row: u,
|
|
1284
|
+
index: m,
|
|
1285
|
+
updateRow: (f, w) => p.updateCellValue(u._uid, String(f), w),
|
|
1299
1286
|
isLocked: !!W,
|
|
1300
1287
|
isView: !!a
|
|
1301
|
-
}) :
|
|
1288
|
+
}) : d.render(
|
|
1289
|
+
u,
|
|
1302
1290
|
m,
|
|
1303
|
-
f,
|
|
1304
|
-
(h, b) => p.updateCellValue(m._uid, h, b),
|
|
1291
|
+
(f, w) => p.updateCellValue(u._uid, f, w),
|
|
1305
1292
|
!!W,
|
|
1306
1293
|
!!a
|
|
1307
|
-
) :
|
|
1308
|
-
] },
|
|
1309
|
-
|
|
1294
|
+
) : u[d.key] }, `${u._uid}-${String(d.key)}`))
|
|
1295
|
+
] }, u._uid)),
|
|
1296
|
+
O.length === 0 && /* @__PURE__ */ r("tr", { className: "empty-row", children: /* @__PURE__ */ r("td", { colSpan: 100, className: "text-center", children: W ? "Nenhum registro encontrado." : "Nenhum registro." }) })
|
|
1310
1297
|
] })
|
|
1311
1298
|
] }) })
|
|
1312
1299
|
] });
|
|
1313
|
-
},
|
|
1314
|
-
const [n,
|
|
1315
|
-
let
|
|
1300
|
+
}, Rt = (e, t) => {
|
|
1301
|
+
const [n, s] = I(null);
|
|
1302
|
+
let i = null;
|
|
1316
1303
|
try {
|
|
1317
|
-
|
|
1304
|
+
i = H().watch;
|
|
1318
1305
|
} catch {
|
|
1319
1306
|
}
|
|
1320
|
-
const
|
|
1307
|
+
const c = t !== void 0 ? t : i ? i(e) : void 0, l = C(() => {
|
|
1321
1308
|
try {
|
|
1322
|
-
const
|
|
1323
|
-
if (
|
|
1324
|
-
const a =
|
|
1325
|
-
|
|
1309
|
+
const b = window.top.__REACT_ATTACHMENT_BRIDGE__;
|
|
1310
|
+
if (b) {
|
|
1311
|
+
const a = b.getAttachment(e, c);
|
|
1312
|
+
s(a || (c ? { name: c, documentId: 0 } : null));
|
|
1326
1313
|
} else
|
|
1327
|
-
|
|
1314
|
+
s(c ? { name: c, documentId: 0 } : null);
|
|
1328
1315
|
} catch {
|
|
1329
|
-
|
|
1316
|
+
s(c ? { name: c, documentId: 0 } : null);
|
|
1330
1317
|
}
|
|
1331
|
-
}, [e,
|
|
1318
|
+
}, [e, c, t]);
|
|
1332
1319
|
return E(() => {
|
|
1333
1320
|
l();
|
|
1334
1321
|
const o = setInterval(l, 2e3);
|
|
1335
1322
|
return () => clearInterval(o);
|
|
1336
1323
|
}, [l]), { attachment: n, sync: l };
|
|
1337
|
-
},
|
|
1324
|
+
}, St = ({
|
|
1338
1325
|
name: e,
|
|
1339
1326
|
label: t,
|
|
1340
1327
|
help: n,
|
|
1341
|
-
valueManual:
|
|
1342
|
-
onChangeManual:
|
|
1343
|
-
forceReadOnly:
|
|
1328
|
+
valueManual: s,
|
|
1329
|
+
onChangeManual: i,
|
|
1330
|
+
forceReadOnly: c = !1,
|
|
1344
1331
|
forceHidden: l = !1
|
|
1345
1332
|
}) => {
|
|
1346
|
-
const o = !!
|
|
1347
|
-
let
|
|
1333
|
+
const o = !!i, { isReadOnly: b, isHidden: a } = F(), { isView: N } = L(), h = c || N || !!b(e), W = l || !!a(e), [V, O] = I(!1);
|
|
1334
|
+
let S = null;
|
|
1348
1335
|
try {
|
|
1349
|
-
|
|
1336
|
+
S = H().control;
|
|
1350
1337
|
} catch {
|
|
1351
1338
|
}
|
|
1352
|
-
const A =
|
|
1353
|
-
value:
|
|
1354
|
-
onChange: (
|
|
1355
|
-
}, { attachment: p, sync:
|
|
1356
|
-
var
|
|
1339
|
+
const A = S && !o ? X({ name: e, control: S }).field : {
|
|
1340
|
+
value: s,
|
|
1341
|
+
onChange: ($) => i == null ? void 0 : i($)
|
|
1342
|
+
}, { attachment: p, sync: v } = Rt(e, s), u = () => {
|
|
1343
|
+
var $;
|
|
1357
1344
|
try {
|
|
1358
|
-
const
|
|
1345
|
+
const _ = window.top;
|
|
1359
1346
|
return {
|
|
1360
|
-
bridge:
|
|
1361
|
-
toast: (
|
|
1347
|
+
bridge: _.__REACT_ATTACHMENT_BRIDGE__,
|
|
1348
|
+
toast: ($ = _.FLUIGC) == null ? void 0 : $.toast
|
|
1362
1349
|
};
|
|
1363
1350
|
} catch {
|
|
1364
1351
|
return { bridge: null, toast: null };
|
|
1365
1352
|
}
|
|
1366
|
-
},
|
|
1367
|
-
if (
|
|
1368
|
-
const
|
|
1369
|
-
|
|
1370
|
-
const
|
|
1371
|
-
if (!
|
|
1372
|
-
const { bridge:
|
|
1373
|
-
|
|
1374
|
-
o ?
|
|
1375
|
-
|
|
1376
|
-
}, 1e3),
|
|
1353
|
+
}, m = C(() => {
|
|
1354
|
+
if (h) return;
|
|
1355
|
+
const $ = document.createElement("input");
|
|
1356
|
+
$.type = "file", $.onchange = (_) => {
|
|
1357
|
+
const y = _.target.files[0];
|
|
1358
|
+
if (!y) return;
|
|
1359
|
+
const { bridge: x, toast: P } = u();
|
|
1360
|
+
O(!0), x ? x.upload(y, e, (g) => {
|
|
1361
|
+
o ? i == null || i(g.name) : A.onChange(g.name), setTimeout(() => {
|
|
1362
|
+
O(!1), v();
|
|
1363
|
+
}, 1e3), P && P({
|
|
1377
1364
|
title: "Sucesso",
|
|
1378
1365
|
message: "Arquivo enviado",
|
|
1379
1366
|
type: "success"
|
|
1380
1367
|
});
|
|
1381
|
-
}) : (o ?
|
|
1382
|
-
},
|
|
1383
|
-
}, [e, A,
|
|
1384
|
-
if (
|
|
1385
|
-
const
|
|
1386
|
-
if (!
|
|
1387
|
-
const { bridge:
|
|
1388
|
-
|
|
1368
|
+
}) : (o ? i == null || i(y.name) : A.onChange(y.name), O(!1));
|
|
1369
|
+
}, $.click();
|
|
1370
|
+
}, [e, A, v, i, h, o]), d = ($) => {
|
|
1371
|
+
if ($.stopPropagation(), h) return;
|
|
1372
|
+
const _ = (p == null ? void 0 : p.name) || s || A.value;
|
|
1373
|
+
if (!_) return;
|
|
1374
|
+
const { bridge: y, toast: x } = u();
|
|
1375
|
+
y ? y.removeByFileName(_) ? (o ? i == null || i("") : A.onChange(""), v()) : x && x({
|
|
1389
1376
|
title: "Erro",
|
|
1390
1377
|
message: "Erro ao remover anexo",
|
|
1391
1378
|
type: "danger"
|
|
1392
|
-
}) : (o ?
|
|
1393
|
-
},
|
|
1379
|
+
}) : (o ? i == null || i("") : A.onChange(""), v());
|
|
1380
|
+
}, f = !!p && !V, w = (p == null ? void 0 : p.name) || s || A.value, D = [
|
|
1394
1381
|
"fluig-attachment__box",
|
|
1395
|
-
|
|
1382
|
+
f ? "fluig-attachment__box--has-file" : "",
|
|
1396
1383
|
V ? "fluig-attachment__box--uploading" : "",
|
|
1397
|
-
|
|
1398
|
-
|
|
1384
|
+
h && !f ? "readOnly" : "",
|
|
1385
|
+
h && f ? "fluig-attachment__box--readonly-view" : ""
|
|
1399
1386
|
].join(" ");
|
|
1400
|
-
return W ? null : /* @__PURE__ */
|
|
1387
|
+
return W ? null : /* @__PURE__ */ k("div", { className: "form-group fluig-attachment", children: [
|
|
1401
1388
|
t && /* @__PURE__ */ r("label", { className: "fluig-attachment__label", children: t }),
|
|
1402
|
-
/* @__PURE__ */
|
|
1389
|
+
/* @__PURE__ */ k(
|
|
1403
1390
|
"div",
|
|
1404
1391
|
{
|
|
1405
1392
|
className: D,
|
|
1406
1393
|
onClick: () => {
|
|
1407
|
-
if (
|
|
1408
|
-
const
|
|
1409
|
-
|
|
1394
|
+
if (f) {
|
|
1395
|
+
const $ = u(), _ = (p == null ? void 0 : p.physicalFileName) || (p == null ? void 0 : p.description) || (p == null ? void 0 : p.name) || w;
|
|
1396
|
+
$.bridge && _ && $.bridge.view(_);
|
|
1410
1397
|
} else
|
|
1411
|
-
|
|
1398
|
+
m();
|
|
1412
1399
|
},
|
|
1413
1400
|
children: [
|
|
1414
|
-
/* @__PURE__ */
|
|
1401
|
+
/* @__PURE__ */ k("span", { className: "fluig-attachment__content", children: [
|
|
1415
1402
|
/* @__PURE__ */ r(
|
|
1416
1403
|
"i",
|
|
1417
1404
|
{
|
|
1418
|
-
className: `flaticon icon-sm ${V ? "flaticon-loading" :
|
|
1405
|
+
className: `flaticon icon-sm ${V ? "flaticon-loading" : f ? "flaticon-file" : "flaticon-paperclip"} fluig-attachment__icon`
|
|
1419
1406
|
}
|
|
1420
1407
|
),
|
|
1421
|
-
/* @__PURE__ */ r("span", { className: "fluig-attachment__filename", children: V ? " Enviando..." :
|
|
1408
|
+
/* @__PURE__ */ r("span", { className: "fluig-attachment__filename", children: V ? " Enviando..." : f ? w : h ? "Nenhum arquivo" : n || "Anexar" })
|
|
1422
1409
|
] }),
|
|
1423
|
-
|
|
1410
|
+
f && !h && /* @__PURE__ */ r(
|
|
1424
1411
|
"button",
|
|
1425
1412
|
{
|
|
1426
1413
|
type: "button",
|
|
1427
1414
|
className: "fluig-attachment__btn-remove btn btn-link text-danger",
|
|
1428
|
-
onClick:
|
|
1415
|
+
onClick: d,
|
|
1429
1416
|
children: /* @__PURE__ */ r("i", { className: "flaticon flaticon-trash icon-sm" })
|
|
1430
1417
|
}
|
|
1431
1418
|
)
|
|
1432
1419
|
]
|
|
1433
1420
|
}
|
|
1434
1421
|
),
|
|
1435
|
-
!o &&
|
|
1422
|
+
!o && S && /* @__PURE__ */ r("input", { type: "hidden", name: e, value: A.value || "" })
|
|
1436
1423
|
] });
|
|
1437
|
-
},
|
|
1438
|
-
function
|
|
1424
|
+
}, It = z(St);
|
|
1425
|
+
function Ft({
|
|
1439
1426
|
title: e,
|
|
1440
1427
|
isOpen: t,
|
|
1441
1428
|
onOpen: n,
|
|
1442
|
-
onClose:
|
|
1443
|
-
content:
|
|
1444
|
-
footer:
|
|
1429
|
+
onClose: s,
|
|
1430
|
+
content: i,
|
|
1431
|
+
footer: c,
|
|
1445
1432
|
width: l
|
|
1446
1433
|
}) {
|
|
1447
1434
|
const o = C(
|
|
1448
|
-
(
|
|
1449
|
-
|
|
1435
|
+
(b) => {
|
|
1436
|
+
b.key === "Escape" && s();
|
|
1450
1437
|
},
|
|
1451
|
-
[
|
|
1438
|
+
[s]
|
|
1452
1439
|
);
|
|
1453
1440
|
return E(() => (t && (document.addEventListener("keydown", o), n == null || n(), document.body.style.overflow = "hidden"), () => {
|
|
1454
1441
|
document.removeEventListener("keydown", o), document.body.style.overflow = "auto";
|
|
@@ -1456,23 +1443,23 @@ function It({
|
|
|
1456
1443
|
"div",
|
|
1457
1444
|
{
|
|
1458
1445
|
className: "modal-overlay",
|
|
1459
|
-
onClick:
|
|
1446
|
+
onClick: s,
|
|
1460
1447
|
"aria-modal": "true",
|
|
1461
1448
|
role: "dialog",
|
|
1462
|
-
children: /* @__PURE__ */
|
|
1449
|
+
children: /* @__PURE__ */ k(
|
|
1463
1450
|
"div",
|
|
1464
1451
|
{
|
|
1465
1452
|
style: { maxWidth: l },
|
|
1466
1453
|
className: "modal-container",
|
|
1467
|
-
onClick: (
|
|
1454
|
+
onClick: (b) => b.stopPropagation(),
|
|
1468
1455
|
children: [
|
|
1469
|
-
/* @__PURE__ */
|
|
1456
|
+
/* @__PURE__ */ k("div", { className: "modal-header", children: [
|
|
1470
1457
|
/* @__PURE__ */ r("h3", { children: e }),
|
|
1471
1458
|
/* @__PURE__ */ r(
|
|
1472
1459
|
"div",
|
|
1473
1460
|
{
|
|
1474
1461
|
className: "btn-close-modal",
|
|
1475
|
-
onClick:
|
|
1462
|
+
onClick: s,
|
|
1476
1463
|
role: "button",
|
|
1477
1464
|
"aria-label": "Fechar modal",
|
|
1478
1465
|
children: /* @__PURE__ */ r(
|
|
@@ -1485,8 +1472,8 @@ function It({
|
|
|
1485
1472
|
}
|
|
1486
1473
|
)
|
|
1487
1474
|
] }),
|
|
1488
|
-
/* @__PURE__ */ r("div", { className: "modal-content", children:
|
|
1489
|
-
|
|
1475
|
+
/* @__PURE__ */ r("div", { className: "modal-content", children: i }),
|
|
1476
|
+
c && /* @__PURE__ */ r("div", { className: "modal-footer", children: c })
|
|
1490
1477
|
]
|
|
1491
1478
|
}
|
|
1492
1479
|
)
|
|
@@ -1494,11 +1481,11 @@ function It({
|
|
|
1494
1481
|
) : null;
|
|
1495
1482
|
}
|
|
1496
1483
|
export {
|
|
1497
|
-
|
|
1484
|
+
It as Attachment,
|
|
1498
1485
|
Tt as Checkbox,
|
|
1499
1486
|
Et as DatePicker,
|
|
1500
1487
|
Vt as Input,
|
|
1501
|
-
|
|
1488
|
+
Ft as Modal,
|
|
1502
1489
|
jt as RadioBtn,
|
|
1503
1490
|
Dt as Select,
|
|
1504
1491
|
Lt as SimpleTable,
|