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