diefra_ecm_ui 1.0.6 → 1.0.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 +7 -7
- package/dist/index.js +382 -387
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsxs as x, jsx as r, Fragment as
|
|
1
|
+
import { jsxs as x, jsx as r, Fragment as ce } from "react/jsx-runtime";
|
|
2
2
|
import { memo as z, useMemo as B, useCallback as C, useState as F, useRef as G, useEffect as E, forwardRef as se, createElement as Z } from "react";
|
|
3
|
-
import { useFormContext as H, useController as X, useFormState as
|
|
3
|
+
import { useFormContext as H, useController as X, useFormState as de } from "react-hook-form";
|
|
4
4
|
import { IMaskInput as le } from "react-imask";
|
|
5
5
|
import { useSection as I, useFluigRuntime as L } from "@fluig-kit/ecm";
|
|
6
6
|
import { parse as ue, isValid as me, eachDayOfInterval as he, endOfWeek as fe, 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";
|
|
@@ -16,75 +16,75 @@ function Se({
|
|
|
16
16
|
placeholder: n = "",
|
|
17
17
|
type: i = "text",
|
|
18
18
|
mask: s,
|
|
19
|
-
className:
|
|
19
|
+
className: d = "",
|
|
20
20
|
forceReadOnly: l = !1,
|
|
21
21
|
forceHidden: o = !1,
|
|
22
|
-
valueManual:
|
|
22
|
+
valueManual: g,
|
|
23
23
|
onChangeManual: a,
|
|
24
|
-
errorManual:
|
|
24
|
+
errorManual: N
|
|
25
25
|
}) {
|
|
26
|
-
var
|
|
27
|
-
const
|
|
28
|
-
let
|
|
26
|
+
var S, $;
|
|
27
|
+
const y = g !== void 0 && !!a, { isReadOnly: W, isHidden: V } = I(), _ = l || !!W(e), P = o || !!V(e), { isView: A } = L();
|
|
28
|
+
let p = null;
|
|
29
29
|
try {
|
|
30
|
-
|
|
30
|
+
p = H();
|
|
31
31
|
} catch {
|
|
32
32
|
}
|
|
33
|
-
const
|
|
33
|
+
const u = !y && p ? X({ name: e, control: p.control }) : null, m = !y && p ? de({ name: e }) : null, f = y ? g : u == null ? void 0 : u.field.value, c = y ? N : ($ = (S = m == null ? void 0 : m.errors) == null ? void 0 : S[e]) == null ? void 0 : $.message, h = B(
|
|
34
34
|
() => s ? xe[s] ?? s : null,
|
|
35
35
|
[s]
|
|
36
|
-
),
|
|
37
|
-
if (!
|
|
38
|
-
const j =
|
|
36
|
+
), b = C((w) => {
|
|
37
|
+
if (!w) return "";
|
|
38
|
+
const j = w.replace(/\D/g, "");
|
|
39
39
|
return (Number(j) / 100).toLocaleString("pt-BR", {
|
|
40
40
|
style: "currency",
|
|
41
41
|
currency: "BRL"
|
|
42
42
|
});
|
|
43
|
-
}, []),
|
|
44
|
-
(
|
|
45
|
-
[i,
|
|
46
|
-
),
|
|
47
|
-
const j =
|
|
48
|
-
|
|
49
|
-
},
|
|
50
|
-
|
|
43
|
+
}, []), D = C(
|
|
44
|
+
(w) => i === "monetary" ? b(w) : w,
|
|
45
|
+
[i, b]
|
|
46
|
+
), O = (w) => {
|
|
47
|
+
const j = D(w);
|
|
48
|
+
y ? a == null || a(j) : u == null || u.field.onChange(j);
|
|
49
|
+
}, k = () => {
|
|
50
|
+
y || u == null || u.field.onBlur();
|
|
51
51
|
};
|
|
52
|
-
if (
|
|
52
|
+
if (A)
|
|
53
53
|
return /* @__PURE__ */ x("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: f || "-" })
|
|
56
56
|
] });
|
|
57
|
-
const
|
|
57
|
+
const v = `form-control ${_ ? "readOnly" : ""} ${c ? "border-red" : ""} ${d}`;
|
|
58
58
|
return /* @__PURE__ */ x("div", { className: `form-group ${P ? "hidden" : ""}`, children: [
|
|
59
59
|
t && /* @__PURE__ */ r("label", { children: t }),
|
|
60
|
-
|
|
60
|
+
h ? /* @__PURE__ */ r(
|
|
61
61
|
le,
|
|
62
62
|
{
|
|
63
63
|
name: e,
|
|
64
|
-
mask:
|
|
65
|
-
value: String(
|
|
64
|
+
mask: h,
|
|
65
|
+
value: String(f ?? ""),
|
|
66
66
|
unmask: !1,
|
|
67
|
-
onAccept: (
|
|
67
|
+
onAccept: (w) => O(w),
|
|
68
68
|
placeholder: n,
|
|
69
69
|
readOnly: _,
|
|
70
|
-
className:
|
|
71
|
-
inputRef:
|
|
72
|
-
onBlur:
|
|
70
|
+
className: v,
|
|
71
|
+
inputRef: y || u == null ? void 0 : u.field.ref,
|
|
72
|
+
onBlur: k
|
|
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: f ?? "",
|
|
80
|
+
onChange: (w) => O(w.target.value),
|
|
81
|
+
onBlur: k,
|
|
82
82
|
placeholder: n,
|
|
83
83
|
readOnly: _,
|
|
84
|
-
className:
|
|
84
|
+
className: v
|
|
85
85
|
}
|
|
86
86
|
),
|
|
87
|
-
|
|
87
|
+
c && /* @__PURE__ */ r("p", { className: "text-danger", children: String(c) })
|
|
88
88
|
] });
|
|
89
89
|
}
|
|
90
90
|
const Vt = z(Se);
|
|
@@ -94,109 +94,109 @@ function Re({
|
|
|
94
94
|
options: n = [],
|
|
95
95
|
placeholder: i = "",
|
|
96
96
|
labelKey: s = "label",
|
|
97
|
-
valueKey:
|
|
97
|
+
valueKey: d = "value",
|
|
98
98
|
enableSearch: l = !1,
|
|
99
99
|
searchPlaceholder: o = "Buscar...",
|
|
100
|
-
loading:
|
|
100
|
+
loading: g = !1,
|
|
101
101
|
onSearchChange: a,
|
|
102
|
-
debounceTime:
|
|
103
|
-
onSelect:
|
|
104
|
-
forceReadOnly:
|
|
105
|
-
forceHidden:
|
|
102
|
+
debounceTime: N = 300,
|
|
103
|
+
onSelect: y,
|
|
104
|
+
forceReadOnly: W = !1,
|
|
105
|
+
forceHidden: V = !1,
|
|
106
106
|
valueManual: _,
|
|
107
107
|
onChangeManual: P,
|
|
108
|
-
errorManual:
|
|
108
|
+
errorManual: A
|
|
109
109
|
}) {
|
|
110
110
|
var ne;
|
|
111
|
-
const
|
|
112
|
-
let
|
|
113
|
-
},
|
|
111
|
+
const p = _ !== void 0 && !!P, { isReadOnly: u, isHidden: m } = I(), f = W || !!u(e), c = V || !!m(e), { isView: h } = L();
|
|
112
|
+
let b = "", D = () => {
|
|
113
|
+
}, O, k = null, v = () => {
|
|
114
114
|
};
|
|
115
|
-
if (
|
|
116
|
-
|
|
115
|
+
if (p)
|
|
116
|
+
b = _;
|
|
117
117
|
else
|
|
118
118
|
try {
|
|
119
119
|
const R = H(), T = X({ name: e, control: R.control });
|
|
120
|
-
|
|
120
|
+
b = T.field.value, D = T.field.onChange, O = T.field.ref, k = (ne = T.fieldState) == null ? void 0 : ne.error, v = R.clearErrors;
|
|
121
121
|
} catch {
|
|
122
122
|
}
|
|
123
|
-
const [
|
|
123
|
+
const [S, $] = F(!1), [w, j] = F(""), 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) && $(!1);
|
|
129
129
|
};
|
|
130
130
|
return document.addEventListener("mousedown", R), () => document.removeEventListener("mousedown", R);
|
|
131
131
|
}, []), E(() => {
|
|
132
|
-
|
|
133
|
-
}, [
|
|
132
|
+
S || j("");
|
|
133
|
+
}, [S]), E(() => {
|
|
134
134
|
if (!l) return;
|
|
135
135
|
const R = setTimeout(() => {
|
|
136
136
|
var T;
|
|
137
|
-
(T = U.current) == null || T.call(U,
|
|
138
|
-
},
|
|
137
|
+
(T = U.current) == null || T.call(U, w);
|
|
138
|
+
}, N);
|
|
139
139
|
return () => clearTimeout(R);
|
|
140
|
-
}, [
|
|
141
|
-
const ee = B(() => l && !a &&
|
|
142
|
-
(R) => String((R == null ? void 0 : R[s]) ?? "").toLowerCase().includes(
|
|
143
|
-
) : n ?? [], [n, l, a,
|
|
144
|
-
if (
|
|
145
|
-
if (typeof
|
|
146
|
-
return String(
|
|
140
|
+
}, [w, l, N]);
|
|
141
|
+
const ee = B(() => l && !a && w.trim() ? n.filter(
|
|
142
|
+
(R) => String((R == null ? void 0 : R[s]) ?? "").toLowerCase().includes(w.toLowerCase())
|
|
143
|
+
) : n ?? [], [n, l, a, w, s]), te = B(() => {
|
|
144
|
+
if (b == null) return "";
|
|
145
|
+
if (typeof b == "object")
|
|
146
|
+
return String(b[d] ?? "");
|
|
147
147
|
const R = (n || []).find(
|
|
148
|
-
(T) => String(T == null ? void 0 : T[
|
|
148
|
+
(T) => String(T == null ? void 0 : T[d]) === String(b)
|
|
149
149
|
);
|
|
150
|
-
return String(R ? (R == null ? void 0 : R[s]) ?? "" :
|
|
151
|
-
}, [
|
|
152
|
-
|
|
150
|
+
return String(R ? (R == null ? void 0 : R[s]) ?? "" : b);
|
|
151
|
+
}, [b, n, d, s]), oe = (R) => {
|
|
152
|
+
f || (p ? P == null || P(R[d]) : (D(R[d]), v == null || v(e)), y == null || y(R), $(!1));
|
|
153
153
|
};
|
|
154
154
|
return /* @__PURE__ */ x(
|
|
155
155
|
"div",
|
|
156
156
|
{
|
|
157
|
-
className: `select-wrapper form-group ${
|
|
157
|
+
className: `select-wrapper form-group ${c ? "hidden" : ""}`,
|
|
158
158
|
ref: q,
|
|
159
159
|
children: [
|
|
160
160
|
/* @__PURE__ */ r("label", { className: "control-label", children: t }),
|
|
161
|
-
|
|
161
|
+
h ? /* @__PURE__ */ r("span", { className: "form-control", children: te || "-" }) : /* @__PURE__ */ x(ce, { children: [
|
|
162
162
|
/* @__PURE__ */ x(
|
|
163
163
|
"div",
|
|
164
164
|
{
|
|
165
|
-
className: `select-control ${
|
|
166
|
-
onClick: () => !
|
|
167
|
-
ref:
|
|
165
|
+
className: `select-control ${k ? "border-red" : ""} ${f ? "readOnly" : ""}`,
|
|
166
|
+
onClick: () => !f && $((R) => !R),
|
|
167
|
+
ref: O,
|
|
168
168
|
children: [
|
|
169
|
-
/* @__PURE__ */ r("span", { className: `select-display ${
|
|
169
|
+
/* @__PURE__ */ r("span", { className: `select-display ${f ? "readOnly" : ""}`, children: te || i }),
|
|
170
170
|
/* @__PURE__ */ r("i", { className: "flaticon flaticon-chevron-down select-icon" })
|
|
171
171
|
]
|
|
172
172
|
}
|
|
173
173
|
),
|
|
174
|
-
|
|
174
|
+
S && !f && /* @__PURE__ */ x("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: w,
|
|
181
181
|
onChange: (R) => j(R.target.value),
|
|
182
|
-
placeholder:
|
|
182
|
+
placeholder: g ? "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: g ? /* @__PURE__ */ r("li", { className: "select-option readOnly", children: "Carregando..." }) : ee.length > 0 ? ee.map((R) => /* @__PURE__ */ r(
|
|
188
188
|
"li",
|
|
189
189
|
{
|
|
190
190
|
onClick: () => oe(R),
|
|
191
191
|
className: "select-option handleHover",
|
|
192
192
|
children: R[s]
|
|
193
193
|
},
|
|
194
|
-
R[
|
|
194
|
+
R[d]
|
|
195
195
|
)) : /* @__PURE__ */ r("li", { className: "select-option readOnly", children: "Sem resultados" }) })
|
|
196
196
|
] })
|
|
197
197
|
] }),
|
|
198
|
-
!
|
|
199
|
-
(
|
|
198
|
+
!p && /* @__PURE__ */ r("input", { type: "hidden", name: e, value: b || "" }),
|
|
199
|
+
(k || A) && /* @__PURE__ */ r("p", { className: "text-danger", children: String((k == null ? void 0 : k.message) ?? A) })
|
|
200
200
|
]
|
|
201
201
|
}
|
|
202
202
|
);
|
|
@@ -208,85 +208,85 @@ function Tt({
|
|
|
208
208
|
label: n = "",
|
|
209
209
|
valueKey: i = "value",
|
|
210
210
|
labelKey: s = "label",
|
|
211
|
-
forceReadOnly:
|
|
211
|
+
forceReadOnly: d = !1,
|
|
212
212
|
forceHidden: l = !1,
|
|
213
213
|
valueManual: o,
|
|
214
|
-
onChangeManual:
|
|
214
|
+
onChangeManual: g
|
|
215
215
|
}) {
|
|
216
|
-
var
|
|
216
|
+
var O, k;
|
|
217
217
|
let a = null;
|
|
218
218
|
try {
|
|
219
219
|
a = H();
|
|
220
220
|
} catch {
|
|
221
221
|
}
|
|
222
|
-
const
|
|
223
|
-
(
|
|
224
|
-
const
|
|
225
|
-
if (
|
|
226
|
-
|
|
222
|
+
const N = o !== void 0 && !!g, { isView: y, isReadOnly: W } = L(), { isReadOnly: V, isHidden: _ } = I(), P = V ? V(e) : !1, A = _ ? _(e) : !1, p = d || P, u = l || A, m = p || W || y, f = () => t ? t.reduce(
|
|
223
|
+
(v, S) => {
|
|
224
|
+
const $ = String(S[i]);
|
|
225
|
+
if (N)
|
|
226
|
+
v[$] = !!(o != null && o[$]);
|
|
227
227
|
else if (a) {
|
|
228
|
-
const
|
|
229
|
-
|
|
228
|
+
const w = a.getValues($);
|
|
229
|
+
v[$] = w === "on";
|
|
230
230
|
} else
|
|
231
|
-
|
|
232
|
-
return
|
|
231
|
+
v[$] = !1;
|
|
232
|
+
return v;
|
|
233
233
|
},
|
|
234
234
|
{}
|
|
235
|
-
) : {},
|
|
235
|
+
) : {}, c = !N && a ? a.watch(e) : void 0, h = B(() => N && o ? o : c && typeof c == "object" ? c : f(), [c, o, t]);
|
|
236
236
|
E(() => {
|
|
237
|
-
if (
|
|
238
|
-
const
|
|
239
|
-
(!
|
|
237
|
+
if (N || !a) return;
|
|
238
|
+
const v = a.getValues(e);
|
|
239
|
+
(!v || typeof v != "object") && a.setValue(e, h, {
|
|
240
240
|
shouldDirty: !1,
|
|
241
241
|
shouldValidate: !1
|
|
242
242
|
});
|
|
243
|
-
}, [
|
|
244
|
-
const
|
|
245
|
-
if (
|
|
246
|
-
const
|
|
247
|
-
if (
|
|
248
|
-
|
|
243
|
+
}, [h, e, a, N]);
|
|
244
|
+
const b = (v, S) => {
|
|
245
|
+
if (m) return;
|
|
246
|
+
const $ = { ...h, [v]: S };
|
|
247
|
+
if (N) {
|
|
248
|
+
g && g($);
|
|
249
249
|
return;
|
|
250
250
|
}
|
|
251
|
-
a && (a.setValue(e,
|
|
251
|
+
a && (a.setValue(e, $, {
|
|
252
252
|
shouldDirty: !0,
|
|
253
253
|
shouldValidate: !0
|
|
254
|
-
}), a.setValue(
|
|
255
|
-
},
|
|
256
|
-
return /* @__PURE__ */ x("div", { className: `form-group ${
|
|
254
|
+
}), a.setValue(v, S ? "on" : "", { shouldValidate: !1 }));
|
|
255
|
+
}, D = N ? null : (k = (O = a == null ? void 0 : a.formState) == null ? void 0 : O.errors) == null ? void 0 : k[e];
|
|
256
|
+
return /* @__PURE__ */ x("div", { className: `form-group ${u ? "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
|
|
261
|
+
className: `checkbox-group-custom ${m ? "readOnly" : ""}`,
|
|
262
|
+
children: t.map((v) => {
|
|
263
|
+
const S = String(v[i]), $ = h[S] === !0;
|
|
264
264
|
return /* @__PURE__ */ x("div", { children: [
|
|
265
|
-
!
|
|
265
|
+
!N && a && /* @__PURE__ */ r("input", { type: "hidden", ...a.register(S) }),
|
|
266
266
|
/* @__PURE__ */ x(
|
|
267
267
|
"label",
|
|
268
268
|
{
|
|
269
|
-
className: `custom-checkbox ${
|
|
269
|
+
className: `custom-checkbox ${$ ? "checked" : ""} ${m ? "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: $,
|
|
276
|
+
disabled: m,
|
|
277
|
+
onChange: (w) => b(S, w.target.checked)
|
|
278
278
|
}
|
|
279
279
|
),
|
|
280
280
|
/* @__PURE__ */ r("span", { className: "checkmark" }),
|
|
281
|
-
/* @__PURE__ */ r("span", { children:
|
|
281
|
+
/* @__PURE__ */ r("span", { children: v[s] })
|
|
282
282
|
]
|
|
283
283
|
}
|
|
284
284
|
)
|
|
285
|
-
] },
|
|
285
|
+
] }, S);
|
|
286
286
|
})
|
|
287
287
|
}
|
|
288
288
|
),
|
|
289
|
-
|
|
289
|
+
D && /* @__PURE__ */ r("p", { className: "text-danger", children: String(D.message) })
|
|
290
290
|
] });
|
|
291
291
|
}
|
|
292
292
|
function Pe({
|
|
@@ -295,68 +295,63 @@ function Pe({
|
|
|
295
295
|
options: n = [],
|
|
296
296
|
valueKey: i = "value",
|
|
297
297
|
labelKey: s = "label",
|
|
298
|
-
iconKey:
|
|
298
|
+
iconKey: d = "icon",
|
|
299
299
|
forceReadOnly: l = !1,
|
|
300
300
|
forceHidden: o = !1,
|
|
301
|
-
valueManual:
|
|
301
|
+
valueManual: g,
|
|
302
302
|
onChangeManual: a,
|
|
303
|
-
errorManual:
|
|
303
|
+
errorManual: N
|
|
304
304
|
}) {
|
|
305
|
-
var
|
|
306
|
-
const
|
|
307
|
-
let
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
const
|
|
315
|
-
(
|
|
316
|
-
|
|
305
|
+
var O;
|
|
306
|
+
const y = g !== void 0 && !!a, { isReadOnly: W, isHidden: V } = I(), _ = l || !!W(e), P = o || !!V(e), { isView: A, isReadOnly: p } = L();
|
|
307
|
+
let u = null, m = null, f = null;
|
|
308
|
+
try {
|
|
309
|
+
f = H();
|
|
310
|
+
} catch {
|
|
311
|
+
}
|
|
312
|
+
const c = !y && f ? X({ name: e, control: f.control }) : null;
|
|
313
|
+
!y && c && (u = c.field, m = (O = c.fieldState) == null ? void 0 : O.error);
|
|
314
|
+
const h = _ || p || A, b = y ? g : (u == null ? void 0 : u.value) ?? "", D = C(
|
|
315
|
+
(k) => {
|
|
316
|
+
h || (y ? a == null || a(k) : u == null || u.onChange(k));
|
|
317
317
|
},
|
|
318
|
-
[
|
|
318
|
+
[h, y, a, u]
|
|
319
319
|
);
|
|
320
320
|
return /* @__PURE__ */ x("div", { className: `form-group column ${P ? "hidden" : ""}`, children: [
|
|
321
321
|
t && /* @__PURE__ */ r("label", { className: "control-label", children: t }),
|
|
322
|
-
/* @__PURE__ */ r(
|
|
323
|
-
"
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
);
|
|
356
|
-
})
|
|
357
|
-
}
|
|
358
|
-
),
|
|
359
|
-
(u || w) && /* @__PURE__ */ r("p", { className: "text-danger", children: String((u == null ? void 0 : u.message) ?? w) })
|
|
322
|
+
/* @__PURE__ */ r("div", { className: `btn-group ${h ? "view-mode" : ""}`, "data-field-name": e, children: n.map((k) => {
|
|
323
|
+
const v = k[i], S = b === v, $ = k.color ? { "--customColor": k.color } : void 0;
|
|
324
|
+
return /* @__PURE__ */ x(
|
|
325
|
+
"label",
|
|
326
|
+
{
|
|
327
|
+
htmlFor: `${e}_${v}`,
|
|
328
|
+
style: $,
|
|
329
|
+
className: `btn fs-ellipsis ${S ? "active" : ""}`,
|
|
330
|
+
children: [
|
|
331
|
+
/* @__PURE__ */ r(
|
|
332
|
+
"input",
|
|
333
|
+
{
|
|
334
|
+
type: "radio",
|
|
335
|
+
id: `${e}_${v}`,
|
|
336
|
+
name: (u == null ? void 0 : u.name) || e,
|
|
337
|
+
value: v,
|
|
338
|
+
checked: S,
|
|
339
|
+
className: "hidden",
|
|
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
|
|
352
|
+
);
|
|
353
|
+
}) }),
|
|
354
|
+
(m || N) && /* @__PURE__ */ r("p", { className: "text-danger", children: String((m == null ? void 0 : m.message) ?? N) })
|
|
360
355
|
] });
|
|
361
356
|
}
|
|
362
357
|
const jt = z(Pe), $e = ({
|
|
@@ -365,60 +360,60 @@ const jt = z(Pe), $e = ({
|
|
|
365
360
|
placeholder: n = "",
|
|
366
361
|
className: i = "",
|
|
367
362
|
rows: s = 4,
|
|
368
|
-
maxLength:
|
|
363
|
+
maxLength: d,
|
|
369
364
|
forceReadOnly: l = !1,
|
|
370
365
|
forceHidden: o = !1,
|
|
371
|
-
valueManual:
|
|
366
|
+
valueManual: g,
|
|
372
367
|
onChangeManual: a,
|
|
373
|
-
errorManual:
|
|
368
|
+
errorManual: N
|
|
374
369
|
}) => {
|
|
375
|
-
var
|
|
376
|
-
const
|
|
377
|
-
let
|
|
378
|
-
value:
|
|
379
|
-
onChange: (
|
|
380
|
-
},
|
|
381
|
-
if (!
|
|
370
|
+
var h;
|
|
371
|
+
const y = g !== void 0 && !!a, { isReadOnly: W, isHidden: V } = I(), _ = l || !!W(e), P = o || !!V(e), { isView: A } = L(), p = G(null);
|
|
372
|
+
let u = {
|
|
373
|
+
value: g ?? "",
|
|
374
|
+
onChange: (b) => a == null ? void 0 : a(b)
|
|
375
|
+
}, m = null;
|
|
376
|
+
if (!y)
|
|
382
377
|
try {
|
|
383
|
-
const { control:
|
|
384
|
-
|
|
378
|
+
const { control: b } = H(), D = X({ name: e, control: b });
|
|
379
|
+
u = D.field, m = (h = D.fieldState) == null ? void 0 : h.error;
|
|
385
380
|
} catch {
|
|
386
381
|
}
|
|
387
|
-
const
|
|
388
|
-
|
|
382
|
+
const f = () => {
|
|
383
|
+
p.current && (p.current.style.height = "auto", p.current.style.height = `${p.current.scrollHeight}px`);
|
|
389
384
|
};
|
|
390
385
|
if (E(() => {
|
|
391
|
-
|
|
392
|
-
}, [
|
|
386
|
+
f();
|
|
387
|
+
}, [u.value]), A)
|
|
393
388
|
return /* @__PURE__ */ x("div", { className: `form-group ${P ? "hidden" : ""}`, children: [
|
|
394
389
|
/* @__PURE__ */ r("label", { children: t }),
|
|
395
|
-
/* @__PURE__ */ r("span", { className: "form-control", children:
|
|
390
|
+
/* @__PURE__ */ r("span", { className: "form-control", children: u.value || "-" })
|
|
396
391
|
] });
|
|
397
|
-
const
|
|
392
|
+
const c = `form-control ${_ ? "readOnly" : ""} ${m || N ? "border-red" : ""} ${i}`;
|
|
398
393
|
return /* @__PURE__ */ x("div", { className: `form-group ${P ? "hidden" : ""}`, children: [
|
|
399
394
|
t && /* @__PURE__ */ r("label", { children: t }),
|
|
400
395
|
/* @__PURE__ */ r(
|
|
401
396
|
"textarea",
|
|
402
397
|
{
|
|
403
|
-
ref:
|
|
398
|
+
ref: p,
|
|
404
399
|
rows: s,
|
|
405
|
-
maxLength:
|
|
406
|
-
value:
|
|
400
|
+
maxLength: d,
|
|
401
|
+
value: u.value || "",
|
|
407
402
|
placeholder: n,
|
|
408
403
|
readOnly: _,
|
|
409
|
-
className:
|
|
404
|
+
className: c,
|
|
410
405
|
style: {
|
|
411
406
|
resize: "none",
|
|
412
407
|
maxHeight: "400px",
|
|
413
408
|
overflowY: "auto"
|
|
414
409
|
},
|
|
415
|
-
onChange: (
|
|
416
|
-
|
|
410
|
+
onChange: (b) => {
|
|
411
|
+
y ? a == null || a(b.target.value) : u.onChange(b);
|
|
417
412
|
},
|
|
418
|
-
onInput:
|
|
413
|
+
onInput: f
|
|
419
414
|
}
|
|
420
415
|
),
|
|
421
|
-
(
|
|
416
|
+
(m || N) && /* @__PURE__ */ r("p", { className: "text-danger", children: String((m == null ? void 0 : m.message) ?? N) })
|
|
422
417
|
] });
|
|
423
418
|
}, Ct = z($e);
|
|
424
419
|
function J(e) {
|
|
@@ -438,26 +433,26 @@ function Q(e) {
|
|
|
438
433
|
const l = e.defaultWidth, o = n != null && n.width ? String(n.width) : e.defaultWidth;
|
|
439
434
|
s = e.values[o] || e.values[l];
|
|
440
435
|
}
|
|
441
|
-
const
|
|
442
|
-
return s[
|
|
436
|
+
const d = e.argumentCallback ? e.argumentCallback(t) : t;
|
|
437
|
+
return s[d];
|
|
443
438
|
};
|
|
444
439
|
}
|
|
445
440
|
function Y(e) {
|
|
446
441
|
return (t, n = {}) => {
|
|
447
|
-
const i = n.width, s = i && e.matchPatterns[i] || e.matchPatterns[e.defaultMatchWidth],
|
|
448
|
-
if (!
|
|
442
|
+
const i = n.width, s = i && e.matchPatterns[i] || e.matchPatterns[e.defaultMatchWidth], d = t.match(s);
|
|
443
|
+
if (!d)
|
|
449
444
|
return null;
|
|
450
|
-
const l =
|
|
445
|
+
const l = d[0], o = i && e.parsePatterns[i] || e.parsePatterns[e.defaultParseWidth], g = Array.isArray(o) ? Oe(o, (y) => y.test(l)) : (
|
|
451
446
|
// [TODO] -- I challenge you to fix the type
|
|
452
|
-
_e(o, (
|
|
447
|
+
_e(o, (y) => y.test(l))
|
|
453
448
|
);
|
|
454
449
|
let a;
|
|
455
|
-
a = e.valueCallback ? e.valueCallback(
|
|
450
|
+
a = e.valueCallback ? e.valueCallback(g) : g, a = n.valueCallback ? (
|
|
456
451
|
// [TODO] -- I challenge you to fix the type
|
|
457
452
|
n.valueCallback(a)
|
|
458
453
|
) : a;
|
|
459
|
-
const
|
|
460
|
-
return { value: a, rest:
|
|
454
|
+
const N = t.slice(l.length);
|
|
455
|
+
return { value: a, rest: N };
|
|
461
456
|
};
|
|
462
457
|
}
|
|
463
458
|
function _e(e, t) {
|
|
@@ -474,9 +469,9 @@ function Ae(e) {
|
|
|
474
469
|
return (t, n = {}) => {
|
|
475
470
|
const i = t.match(e.matchPattern);
|
|
476
471
|
if (!i) return null;
|
|
477
|
-
const s = i[0],
|
|
478
|
-
if (!
|
|
479
|
-
let l = e.valueCallback ? e.valueCallback(
|
|
472
|
+
const s = i[0], d = t.match(e.parsePattern);
|
|
473
|
+
if (!d) return null;
|
|
474
|
+
let l = e.valueCallback ? e.valueCallback(d[0]) : d[0];
|
|
480
475
|
l = n.valueCallback ? n.valueCallback(l) : l;
|
|
481
476
|
const o = t.slice(s.length);
|
|
482
477
|
return { value: l, rest: o };
|
|
@@ -876,7 +871,7 @@ const ot = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
|
876
871
|
* This source code is licensed under the ISC license.
|
|
877
872
|
* See the LICENSE file in the root directory of this source tree.
|
|
878
873
|
*/
|
|
879
|
-
const
|
|
874
|
+
const ct = (e) => e.replace(
|
|
880
875
|
/^([A-Z])|[\s-_]+(\w)/g,
|
|
881
876
|
(t, n, i) => i ? i.toUpperCase() : n.toLowerCase()
|
|
882
877
|
);
|
|
@@ -887,7 +882,7 @@ const dt = (e) => e.replace(
|
|
|
887
882
|
* See the LICENSE file in the root directory of this source tree.
|
|
888
883
|
*/
|
|
889
884
|
const re = (e) => {
|
|
890
|
-
const t =
|
|
885
|
+
const t = ct(e);
|
|
891
886
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
892
887
|
};
|
|
893
888
|
/**
|
|
@@ -896,7 +891,7 @@ const re = (e) => {
|
|
|
896
891
|
* This source code is licensed under the ISC license.
|
|
897
892
|
* See the LICENSE file in the root directory of this source tree.
|
|
898
893
|
*/
|
|
899
|
-
var
|
|
894
|
+
var dt = {
|
|
900
895
|
xmlns: "http://www.w3.org/2000/svg",
|
|
901
896
|
width: 24,
|
|
902
897
|
height: 24,
|
|
@@ -932,25 +927,25 @@ const ut = se(
|
|
|
932
927
|
strokeWidth: n = 2,
|
|
933
928
|
absoluteStrokeWidth: i,
|
|
934
929
|
className: s = "",
|
|
935
|
-
children:
|
|
930
|
+
children: d,
|
|
936
931
|
iconNode: l,
|
|
937
932
|
...o
|
|
938
|
-
},
|
|
933
|
+
}, g) => Z(
|
|
939
934
|
"svg",
|
|
940
935
|
{
|
|
941
|
-
ref:
|
|
942
|
-
...
|
|
936
|
+
ref: g,
|
|
937
|
+
...dt,
|
|
943
938
|
width: t,
|
|
944
939
|
height: t,
|
|
945
940
|
stroke: e,
|
|
946
941
|
strokeWidth: i ? Number(n) * 24 / Number(t) : n,
|
|
947
942
|
className: ie("lucide", s),
|
|
948
|
-
...!
|
|
943
|
+
...!d && !lt(o) && { "aria-hidden": "true" },
|
|
949
944
|
...o
|
|
950
945
|
},
|
|
951
946
|
[
|
|
952
|
-
...l.map(([a,
|
|
953
|
-
...Array.isArray(
|
|
947
|
+
...l.map(([a, N]) => Z(a, N)),
|
|
948
|
+
...Array.isArray(d) ? d : [d]
|
|
954
949
|
]
|
|
955
950
|
)
|
|
956
951
|
);
|
|
@@ -962,8 +957,8 @@ const ut = se(
|
|
|
962
957
|
*/
|
|
963
958
|
const M = (e, t) => {
|
|
964
959
|
const n = se(
|
|
965
|
-
({ className: i, ...s },
|
|
966
|
-
ref:
|
|
960
|
+
({ className: i, ...s }, d) => Z(ut, {
|
|
961
|
+
ref: d,
|
|
967
962
|
iconNode: t,
|
|
968
963
|
className: ie(
|
|
969
964
|
`lucide-${ot(re(e))}`,
|
|
@@ -1022,26 +1017,26 @@ const ae = "dd/MM/yyyy", bt = (e) => {
|
|
|
1022
1017
|
placeholder: n = "dd/mm/aaaa",
|
|
1023
1018
|
className: i = "",
|
|
1024
1019
|
forceReadOnly: s = !1,
|
|
1025
|
-
forceHidden:
|
|
1020
|
+
forceHidden: d = !1,
|
|
1026
1021
|
valueManual: l,
|
|
1027
1022
|
onChangeManual: o,
|
|
1028
|
-
errorManual:
|
|
1023
|
+
errorManual: g
|
|
1029
1024
|
}) => {
|
|
1030
|
-
var
|
|
1031
|
-
const [a,
|
|
1025
|
+
var v;
|
|
1026
|
+
const [a, N] = F(!1), [y, W] = F(/* @__PURE__ */ new Date()), V = gt(() => N(!1)), _ = l !== void 0 && !!o;
|
|
1032
1027
|
let P = null;
|
|
1033
1028
|
try {
|
|
1034
1029
|
P = H();
|
|
1035
1030
|
} catch {
|
|
1036
1031
|
}
|
|
1037
|
-
const { isView:
|
|
1038
|
-
if (
|
|
1039
|
-
const
|
|
1040
|
-
_ ? o == null || o(
|
|
1041
|
-
},
|
|
1042
|
-
const
|
|
1043
|
-
start: ye(ve(
|
|
1044
|
-
end: fe(pe(
|
|
1032
|
+
const { isView: A } = L(), { isReadOnly: p, isHidden: u } = I(), m = s || !!p(e), f = d || !!u(e), c = !_ && P ? X({ name: e, control: P.control }) : null, h = _ ? l : c == null ? void 0 : c.field.value, b = _ ? g : (v = c == null ? void 0 : c.fieldState.error) == null ? void 0 : v.message, D = B(() => bt(h), [h]), O = (S) => {
|
|
1033
|
+
if (m) return;
|
|
1034
|
+
const $ = wt(S);
|
|
1035
|
+
_ ? o == null || o($) : c == null || c.field.onChange($), N(!1);
|
|
1036
|
+
}, k = (S) => {
|
|
1037
|
+
const $ = he({
|
|
1038
|
+
start: ye(ve(S)),
|
|
1039
|
+
end: fe(pe(S))
|
|
1045
1040
|
});
|
|
1046
1041
|
return /* @__PURE__ */ x("div", { className: "dfe-calendar-pane", children: [
|
|
1047
1042
|
/* @__PURE__ */ x("div", { className: "dfe-calendar-header", children: [
|
|
@@ -1049,51 +1044,51 @@ const ae = "dd/MM/yyyy", bt = (e) => {
|
|
|
1049
1044
|
"button",
|
|
1050
1045
|
{
|
|
1051
1046
|
type: "button",
|
|
1052
|
-
onClick: (
|
|
1053
|
-
|
|
1047
|
+
onClick: (w) => {
|
|
1048
|
+
w.stopPropagation(), W(ge(y, 1));
|
|
1054
1049
|
},
|
|
1055
1050
|
className: "dfe-nav-btn",
|
|
1056
1051
|
children: /* @__PURE__ */ r(pt, { size: 16 })
|
|
1057
1052
|
}
|
|
1058
1053
|
),
|
|
1059
|
-
/* @__PURE__ */ r("span", { className: "dfe-month-label", children: K(
|
|
1054
|
+
/* @__PURE__ */ r("span", { className: "dfe-month-label", children: K(S, "MMMM yyyy", { locale: at }) }),
|
|
1060
1055
|
/* @__PURE__ */ r(
|
|
1061
1056
|
"button",
|
|
1062
1057
|
{
|
|
1063
1058
|
type: "button",
|
|
1064
|
-
onClick: (
|
|
1065
|
-
|
|
1059
|
+
onClick: (w) => {
|
|
1060
|
+
w.stopPropagation(), W(be(y, 1));
|
|
1066
1061
|
},
|
|
1067
1062
|
className: "dfe-nav-btn",
|
|
1068
1063
|
children: /* @__PURE__ */ r(vt, { size: 16 })
|
|
1069
1064
|
}
|
|
1070
1065
|
)
|
|
1071
1066
|
] }),
|
|
1072
|
-
/* @__PURE__ */ r("div", { className: "dfe-calendar-grid-header", children: ["D", "S", "T", "Q", "Q", "S", "S"].map((
|
|
1073
|
-
/* @__PURE__ */ r("div", { className: "dfe-calendar-grid", children:
|
|
1074
|
-
const q = !we(
|
|
1067
|
+
/* @__PURE__ */ r("div", { className: "dfe-calendar-grid-header", children: ["D", "S", "T", "Q", "Q", "S", "S"].map((w, j) => /* @__PURE__ */ r("span", { children: w }, j)) }),
|
|
1068
|
+
/* @__PURE__ */ r("div", { className: "dfe-calendar-grid", children: $.map((w, j) => {
|
|
1069
|
+
const q = !we(w, S), U = D && Ne(w, D);
|
|
1075
1070
|
return /* @__PURE__ */ r(
|
|
1076
1071
|
"div",
|
|
1077
1072
|
{
|
|
1078
|
-
onClick: () => !q &&
|
|
1073
|
+
onClick: () => !q && O(w),
|
|
1079
1074
|
className: `dfe-calendar-day
|
|
1080
1075
|
${U ? "selected" : ""}
|
|
1081
1076
|
${q ? "outside" : ""}
|
|
1082
|
-
${ke(
|
|
1083
|
-
children: K(
|
|
1077
|
+
${ke(w) ? "today" : ""}`,
|
|
1078
|
+
children: K(w, "d")
|
|
1084
1079
|
},
|
|
1085
1080
|
j
|
|
1086
1081
|
);
|
|
1087
1082
|
}) })
|
|
1088
1083
|
] });
|
|
1089
1084
|
};
|
|
1090
|
-
return
|
|
1085
|
+
return f ? null : A ? /* @__PURE__ */ x("div", { className: `form-group ${i}`, children: [
|
|
1091
1086
|
t && /* @__PURE__ */ r("label", { children: t }),
|
|
1092
|
-
/* @__PURE__ */ r("span", { className: "form-control readOnly", style: { display: "block", height: "auto" }, children:
|
|
1087
|
+
/* @__PURE__ */ r("span", { className: "form-control readOnly", style: { display: "block", height: "auto" }, children: h || "-" })
|
|
1093
1088
|
] }) : /* @__PURE__ */ x(
|
|
1094
1089
|
"div",
|
|
1095
1090
|
{
|
|
1096
|
-
ref:
|
|
1091
|
+
ref: V,
|
|
1097
1092
|
className: `form-group dfe-datepicker-container ${i}`,
|
|
1098
1093
|
style: { position: "relative" },
|
|
1099
1094
|
children: [
|
|
@@ -1101,21 +1096,21 @@ const ae = "dd/MM/yyyy", bt = (e) => {
|
|
|
1101
1096
|
/* @__PURE__ */ x(
|
|
1102
1097
|
"div",
|
|
1103
1098
|
{
|
|
1104
|
-
className: `form-control dfe-datepicker-trigger ${
|
|
1105
|
-
onClick: () => !
|
|
1099
|
+
className: `form-control dfe-datepicker-trigger ${b ? "border-red" : ""} ${m ? "disabled" : ""}`,
|
|
1100
|
+
onClick: () => !m && N(!a),
|
|
1106
1101
|
style: {
|
|
1107
1102
|
display: "flex",
|
|
1108
1103
|
alignItems: "center",
|
|
1109
|
-
cursor:
|
|
1104
|
+
cursor: m ? "default" : "pointer"
|
|
1110
1105
|
},
|
|
1111
1106
|
children: [
|
|
1112
1107
|
/* @__PURE__ */ r(ht, { size: 16, className: "dfe-calendar-icon", style: { marginRight: "8px", opacity: 0.5 } }),
|
|
1113
|
-
/* @__PURE__ */ r("span", { children:
|
|
1108
|
+
/* @__PURE__ */ r("span", { children: h || n })
|
|
1114
1109
|
]
|
|
1115
1110
|
}
|
|
1116
1111
|
),
|
|
1117
|
-
a && !
|
|
1118
|
-
|
|
1112
|
+
a && !m && /* @__PURE__ */ r("div", { className: "dfe-popover-content", children: /* @__PURE__ */ r("div", { className: "dfe-calendars-wrapper", children: k(y) }) }),
|
|
1113
|
+
b && /* @__PURE__ */ r("p", { className: "text-danger", children: String(b) })
|
|
1119
1114
|
]
|
|
1120
1115
|
}
|
|
1121
1116
|
);
|
|
@@ -1127,7 +1122,7 @@ function kt({
|
|
|
1127
1122
|
hidden: i = !1,
|
|
1128
1123
|
label: s
|
|
1129
1124
|
}) {
|
|
1130
|
-
const { activityId:
|
|
1125
|
+
const { activityId: d } = L(), l = B(() => !e || d === null || d === void 0 ? null : e[d], [d, e]);
|
|
1131
1126
|
if (!l)
|
|
1132
1127
|
return /* @__PURE__ */ x("div", { className: `form-group ${i ? "hidden" : ""}`, children: [
|
|
1133
1128
|
s && /* @__PURE__ */ r("label", { children: s }),
|
|
@@ -1151,80 +1146,80 @@ function xt({
|
|
|
1151
1146
|
defaultRowValue: n,
|
|
1152
1147
|
isView: i,
|
|
1153
1148
|
isReadOnly: s,
|
|
1154
|
-
filters:
|
|
1149
|
+
filters: d = []
|
|
1155
1150
|
}) {
|
|
1156
|
-
const { field: l } = X({ name: e, control: t }), [o,
|
|
1151
|
+
const { field: l } = X({ name: e, control: t }), [o, g] = F([]), [a, N] = F([]), y = () => Date.now() + Math.random(), W = (f) => {
|
|
1157
1152
|
try {
|
|
1158
|
-
const
|
|
1159
|
-
return Array.isArray(
|
|
1160
|
-
...
|
|
1161
|
-
_uid:
|
|
1153
|
+
const c = JSON.parse(f);
|
|
1154
|
+
return Array.isArray(c) ? c.map((h) => ({
|
|
1155
|
+
...h,
|
|
1156
|
+
_uid: h._uid || y()
|
|
1162
1157
|
})) : [];
|
|
1163
|
-
} catch (
|
|
1164
|
-
return console.error(`Erro ao ler dados da tabela "${e}":`,
|
|
1158
|
+
} catch (c) {
|
|
1159
|
+
return console.error(`Erro ao ler dados da tabela "${e}":`, c), [];
|
|
1165
1160
|
}
|
|
1166
1161
|
};
|
|
1167
1162
|
E(() => {
|
|
1168
1163
|
if (!(o.length > 0 && !i) && l.value && typeof l.value == "string") {
|
|
1169
|
-
const
|
|
1170
|
-
if (l.value ===
|
|
1171
|
-
const
|
|
1172
|
-
|
|
1164
|
+
const f = JSON.stringify(o);
|
|
1165
|
+
if (l.value === f) return;
|
|
1166
|
+
const c = W(l.value);
|
|
1167
|
+
g(c);
|
|
1173
1168
|
}
|
|
1174
1169
|
}, [l.value, i]), E(() => {
|
|
1175
1170
|
if (s) return;
|
|
1176
|
-
const
|
|
1177
|
-
l.value !==
|
|
1171
|
+
const f = JSON.stringify(o);
|
|
1172
|
+
l.value !== f && l.onChange(f);
|
|
1178
1173
|
}, [o, l, s]);
|
|
1179
|
-
const
|
|
1180
|
-
const
|
|
1181
|
-
|
|
1174
|
+
const V = C(() => {
|
|
1175
|
+
const f = { _uid: y(), ...n };
|
|
1176
|
+
g((c) => [...c, f]);
|
|
1182
1177
|
}, [n]), _ = C(() => {
|
|
1183
|
-
|
|
1184
|
-
}, [a]), P = C((
|
|
1185
|
-
|
|
1186
|
-
}, []),
|
|
1187
|
-
|
|
1188
|
-
}, []),
|
|
1189
|
-
(
|
|
1190
|
-
|
|
1178
|
+
g((f) => f.filter((c) => !a.includes(c._uid))), N([]);
|
|
1179
|
+
}, [a]), P = C((f, c, h) => {
|
|
1180
|
+
g((b) => b.map((D) => D._uid === f ? { ...D, [c]: h } : D));
|
|
1181
|
+
}, []), A = C((f) => {
|
|
1182
|
+
N((c) => c.includes(f) ? c.filter((h) => h !== f) : [...c, f]);
|
|
1183
|
+
}, []), p = C(
|
|
1184
|
+
(f) => {
|
|
1185
|
+
N(f ? o.map((c) => c._uid) : []);
|
|
1191
1186
|
},
|
|
1192
1187
|
[o]
|
|
1193
|
-
),
|
|
1194
|
-
(
|
|
1195
|
-
if ("custom" in
|
|
1196
|
-
return
|
|
1197
|
-
const
|
|
1198
|
-
switch (
|
|
1188
|
+
), u = o.length > 0 && a.length === o.length, m = B(() => !d || d.length === 0 ? o : o.filter(
|
|
1189
|
+
(f) => d.every((c) => {
|
|
1190
|
+
if ("custom" in c)
|
|
1191
|
+
return c.custom(f);
|
|
1192
|
+
const h = f[c.field];
|
|
1193
|
+
switch (c.operator) {
|
|
1199
1194
|
case "===":
|
|
1200
|
-
return
|
|
1195
|
+
return h === c.value;
|
|
1201
1196
|
case "!==":
|
|
1202
|
-
return
|
|
1197
|
+
return h !== c.value;
|
|
1203
1198
|
case ">":
|
|
1204
|
-
return
|
|
1199
|
+
return h > c.value;
|
|
1205
1200
|
case "<":
|
|
1206
|
-
return
|
|
1201
|
+
return h < c.value;
|
|
1207
1202
|
case ">=":
|
|
1208
|
-
return
|
|
1203
|
+
return h >= c.value;
|
|
1209
1204
|
case "<=":
|
|
1210
|
-
return
|
|
1205
|
+
return h <= c.value;
|
|
1211
1206
|
default:
|
|
1212
1207
|
return !0;
|
|
1213
1208
|
}
|
|
1214
1209
|
})
|
|
1215
|
-
), [o,
|
|
1210
|
+
), [o, d]);
|
|
1216
1211
|
return {
|
|
1217
1212
|
field: l,
|
|
1218
1213
|
tableRows: o,
|
|
1219
|
-
visibleRows:
|
|
1214
|
+
visibleRows: m,
|
|
1220
1215
|
selectedRowIds: a,
|
|
1221
|
-
isAllSelected:
|
|
1216
|
+
isAllSelected: u,
|
|
1222
1217
|
handle: {
|
|
1223
|
-
addRow:
|
|
1218
|
+
addRow: V,
|
|
1224
1219
|
removeRows: _,
|
|
1225
1220
|
updateCellValue: P,
|
|
1226
|
-
toggleSelection:
|
|
1227
|
-
toggleSelectAll:
|
|
1221
|
+
toggleSelection: A,
|
|
1222
|
+
toggleSelectAll: p
|
|
1228
1223
|
}
|
|
1229
1224
|
};
|
|
1230
1225
|
}
|
|
@@ -1234,30 +1229,30 @@ const Lt = ({
|
|
|
1234
1229
|
columns: n,
|
|
1235
1230
|
defaultRowValue: i = {},
|
|
1236
1231
|
forceReadOnly: s = !1,
|
|
1237
|
-
layout:
|
|
1232
|
+
layout: d = "fluid",
|
|
1238
1233
|
actions: l = !0,
|
|
1239
1234
|
filters: o = []
|
|
1240
1235
|
}) => {
|
|
1241
|
-
const { control:
|
|
1236
|
+
const { control: g } = H(), { isView: a, isReadOnly: N } = L(), { isReadOnly: y } = I(), W = s || a || N || y && y(e), { field: V, visibleRows: _, selectedRowIds: P, isAllSelected: A, handle: p } = xt({
|
|
1242
1237
|
name: e,
|
|
1243
|
-
control:
|
|
1238
|
+
control: g,
|
|
1244
1239
|
defaultRowValue: i,
|
|
1245
1240
|
isView: a,
|
|
1246
|
-
isReadOnly: !!
|
|
1241
|
+
isReadOnly: !!W,
|
|
1247
1242
|
filters: o
|
|
1248
|
-
}),
|
|
1249
|
-
return /* @__PURE__ */ x("div", { className: `table-wrapper ${
|
|
1250
|
-
/* @__PURE__ */ r("input", { type: "hidden", ...
|
|
1243
|
+
}), u = d === "fixed";
|
|
1244
|
+
return /* @__PURE__ */ x("div", { className: `table-wrapper ${u ? "table-fixed" : "table-fluid"}`, children: [
|
|
1245
|
+
/* @__PURE__ */ r("input", { type: "hidden", ...V }),
|
|
1251
1246
|
/* @__PURE__ */ x("div", { className: "header-handle", children: [
|
|
1252
1247
|
/* @__PURE__ */ r("h3", { children: t }),
|
|
1253
|
-
!
|
|
1248
|
+
!W && l && /* @__PURE__ */ x("div", { className: "handle-actions", children: [
|
|
1254
1249
|
/* @__PURE__ */ x(
|
|
1255
1250
|
"button",
|
|
1256
1251
|
{
|
|
1257
1252
|
type: "button",
|
|
1258
1253
|
className: `btn ${P.length > 0 ? "btn-danger" : "btn-primary"}`,
|
|
1259
1254
|
disabled: P.length === 0,
|
|
1260
|
-
onClick:
|
|
1255
|
+
onClick: p.removeRows,
|
|
1261
1256
|
children: [
|
|
1262
1257
|
"Remover (",
|
|
1263
1258
|
P.length,
|
|
@@ -1265,53 +1260,53 @@ const Lt = ({
|
|
|
1265
1260
|
]
|
|
1266
1261
|
}
|
|
1267
1262
|
),
|
|
1268
|
-
/* @__PURE__ */ r("button", { type: "button", className: "btn-add", onClick:
|
|
1263
|
+
/* @__PURE__ */ r("button", { type: "button", className: "btn-add", onClick: p.addRow, children: "Adicionar" })
|
|
1269
1264
|
] })
|
|
1270
1265
|
] }),
|
|
1271
1266
|
/* @__PURE__ */ r("div", { className: "table-scroll", children: /* @__PURE__ */ x("table", { className: "table-custom", children: [
|
|
1272
1267
|
/* @__PURE__ */ r("thead", { children: /* @__PURE__ */ x("tr", { children: [
|
|
1273
|
-
!
|
|
1268
|
+
!W && /* @__PURE__ */ r("th", { style: { width: "50px" }, children: /* @__PURE__ */ r(
|
|
1274
1269
|
"input",
|
|
1275
1270
|
{
|
|
1276
1271
|
type: "checkbox",
|
|
1277
|
-
checked:
|
|
1278
|
-
onChange: (
|
|
1272
|
+
checked: A,
|
|
1273
|
+
onChange: (m) => p.toggleSelectAll(m.target.checked)
|
|
1279
1274
|
}
|
|
1280
1275
|
) }),
|
|
1281
|
-
n.map((
|
|
1276
|
+
n.map((m) => /* @__PURE__ */ r(
|
|
1282
1277
|
"th",
|
|
1283
1278
|
{
|
|
1284
|
-
style:
|
|
1285
|
-
children:
|
|
1279
|
+
style: m.width ? { minWidth: u ? m.width : "100%" } : { width: "max-content" },
|
|
1280
|
+
children: m.label
|
|
1286
1281
|
},
|
|
1287
|
-
String(
|
|
1282
|
+
String(m.key)
|
|
1288
1283
|
))
|
|
1289
1284
|
] }) }),
|
|
1290
1285
|
/* @__PURE__ */ x("tbody", { children: [
|
|
1291
|
-
_.map((
|
|
1292
|
-
!
|
|
1286
|
+
_.map((m, f) => /* @__PURE__ */ x("tr", { children: [
|
|
1287
|
+
!W && /* @__PURE__ */ r("td", { children: /* @__PURE__ */ r(
|
|
1293
1288
|
"input",
|
|
1294
1289
|
{
|
|
1295
1290
|
type: "checkbox",
|
|
1296
|
-
checked: P.includes(
|
|
1297
|
-
onChange: () =>
|
|
1291
|
+
checked: P.includes(m._uid),
|
|
1292
|
+
onChange: () => p.toggleSelection(m._uid)
|
|
1298
1293
|
}
|
|
1299
1294
|
) }),
|
|
1300
|
-
n.map((
|
|
1301
|
-
row:
|
|
1302
|
-
index:
|
|
1303
|
-
updateRow: (
|
|
1304
|
-
isLocked: !!
|
|
1295
|
+
n.map((c) => /* @__PURE__ */ r("td", { children: c.render ? c.render.length <= 1 ? c.render({
|
|
1296
|
+
row: m,
|
|
1297
|
+
index: f,
|
|
1298
|
+
updateRow: (h, b) => p.updateCellValue(m._uid, String(h), b),
|
|
1299
|
+
isLocked: !!W,
|
|
1305
1300
|
isView: !!a
|
|
1306
|
-
}) :
|
|
1307
|
-
u,
|
|
1301
|
+
}) : c.render(
|
|
1308
1302
|
m,
|
|
1309
|
-
|
|
1310
|
-
|
|
1303
|
+
f,
|
|
1304
|
+
(h, b) => p.updateCellValue(m._uid, h, b),
|
|
1305
|
+
!!W,
|
|
1311
1306
|
!!a
|
|
1312
|
-
) :
|
|
1313
|
-
] },
|
|
1314
|
-
_.length === 0 && /* @__PURE__ */ r("tr", { className: "empty-row", children: /* @__PURE__ */ r("td", { colSpan: 100, className: "text-center", children:
|
|
1307
|
+
) : m[c.key] }, `${m._uid}-${String(c.key)}`))
|
|
1308
|
+
] }, m._uid)),
|
|
1309
|
+
_.length === 0 && /* @__PURE__ */ r("tr", { className: "empty-row", children: /* @__PURE__ */ r("td", { colSpan: 100, className: "text-center", children: W ? "Nenhum registro encontrado." : "Nenhum registro." }) })
|
|
1315
1310
|
] })
|
|
1316
1311
|
] }) })
|
|
1317
1312
|
] });
|
|
@@ -1322,18 +1317,18 @@ const Lt = ({
|
|
|
1322
1317
|
s = H().watch;
|
|
1323
1318
|
} catch {
|
|
1324
1319
|
}
|
|
1325
|
-
const
|
|
1320
|
+
const d = t !== void 0 ? t : s ? s(e) : void 0, l = C(() => {
|
|
1326
1321
|
try {
|
|
1327
|
-
const
|
|
1328
|
-
if (
|
|
1329
|
-
const a =
|
|
1330
|
-
i(a || (
|
|
1322
|
+
const g = window.top.__REACT_ATTACHMENT_BRIDGE__;
|
|
1323
|
+
if (g) {
|
|
1324
|
+
const a = g.getAttachment(e, d);
|
|
1325
|
+
i(a || (d ? { name: d, documentId: 0 } : null));
|
|
1331
1326
|
} else
|
|
1332
|
-
i(
|
|
1327
|
+
i(d ? { name: d, documentId: 0 } : null);
|
|
1333
1328
|
} catch {
|
|
1334
|
-
i(
|
|
1329
|
+
i(d ? { name: d, documentId: 0 } : null);
|
|
1335
1330
|
}
|
|
1336
|
-
}, [e,
|
|
1331
|
+
}, [e, d, t]);
|
|
1337
1332
|
return E(() => {
|
|
1338
1333
|
l();
|
|
1339
1334
|
const o = setInterval(l, 2e3);
|
|
@@ -1345,99 +1340,99 @@ const Lt = ({
|
|
|
1345
1340
|
help: n,
|
|
1346
1341
|
valueManual: i,
|
|
1347
1342
|
onChangeManual: s,
|
|
1348
|
-
forceReadOnly:
|
|
1343
|
+
forceReadOnly: d = !1,
|
|
1349
1344
|
forceHidden: l = !1
|
|
1350
1345
|
}) => {
|
|
1351
|
-
const o = !!s, { isReadOnly:
|
|
1346
|
+
const o = !!s, { isReadOnly: g, isHidden: a } = I(), { isView: N } = L(), y = d || N || !!g(e), W = l || !!a(e), [V, _] = F(!1);
|
|
1352
1347
|
let P = null;
|
|
1353
1348
|
try {
|
|
1354
1349
|
P = H().control;
|
|
1355
1350
|
} catch {
|
|
1356
1351
|
}
|
|
1357
|
-
const
|
|
1352
|
+
const A = P && !o ? X({ name: e, control: P }).field : {
|
|
1358
1353
|
value: i,
|
|
1359
|
-
onChange: (
|
|
1360
|
-
}, { attachment:
|
|
1361
|
-
var
|
|
1354
|
+
onChange: (O) => s == null ? void 0 : s(O)
|
|
1355
|
+
}, { attachment: p, sync: u } = St(e, i), m = () => {
|
|
1356
|
+
var O;
|
|
1362
1357
|
try {
|
|
1363
|
-
const
|
|
1358
|
+
const k = window.top;
|
|
1364
1359
|
return {
|
|
1365
|
-
bridge:
|
|
1366
|
-
toast: (
|
|
1360
|
+
bridge: k.__REACT_ATTACHMENT_BRIDGE__,
|
|
1361
|
+
toast: (O = k.FLUIGC) == null ? void 0 : O.toast
|
|
1367
1362
|
};
|
|
1368
1363
|
} catch {
|
|
1369
1364
|
return { bridge: null, toast: null };
|
|
1370
1365
|
}
|
|
1371
|
-
},
|
|
1372
|
-
if (
|
|
1373
|
-
const
|
|
1374
|
-
|
|
1375
|
-
const
|
|
1376
|
-
if (!
|
|
1377
|
-
const { bridge:
|
|
1378
|
-
_(!0),
|
|
1379
|
-
o ? s == null || s(
|
|
1380
|
-
_(!1),
|
|
1381
|
-
}, 1e3),
|
|
1366
|
+
}, f = C(() => {
|
|
1367
|
+
if (y) return;
|
|
1368
|
+
const O = document.createElement("input");
|
|
1369
|
+
O.type = "file", O.onchange = (k) => {
|
|
1370
|
+
const v = k.target.files[0];
|
|
1371
|
+
if (!v) return;
|
|
1372
|
+
const { bridge: S, toast: $ } = m();
|
|
1373
|
+
_(!0), S ? S.upload(v, e, (w) => {
|
|
1374
|
+
o ? s == null || s(w.name) : A.onChange(w.name), setTimeout(() => {
|
|
1375
|
+
_(!1), u();
|
|
1376
|
+
}, 1e3), $ && $({
|
|
1382
1377
|
title: "Sucesso",
|
|
1383
1378
|
message: "Arquivo enviado",
|
|
1384
1379
|
type: "success"
|
|
1385
1380
|
});
|
|
1386
|
-
}) : (o ? s == null || s(
|
|
1387
|
-
},
|
|
1388
|
-
}, [e,
|
|
1389
|
-
if (
|
|
1390
|
-
const
|
|
1391
|
-
if (!
|
|
1392
|
-
const { bridge:
|
|
1393
|
-
|
|
1381
|
+
}) : (o ? s == null || s(v.name) : A.onChange(v.name), _(!1));
|
|
1382
|
+
}, O.click();
|
|
1383
|
+
}, [e, A, u, s, y, o]), c = (O) => {
|
|
1384
|
+
if (O.stopPropagation(), y) return;
|
|
1385
|
+
const k = (p == null ? void 0 : p.name) || i || A.value;
|
|
1386
|
+
if (!k) return;
|
|
1387
|
+
const { bridge: v, toast: S } = m();
|
|
1388
|
+
v ? v.removeByFileName(k) ? (o ? s == null || s("") : A.onChange(""), u()) : S && S({
|
|
1394
1389
|
title: "Erro",
|
|
1395
1390
|
message: "Erro ao remover anexo",
|
|
1396
1391
|
type: "danger"
|
|
1397
|
-
}) : (o ? s == null || s("") :
|
|
1398
|
-
},
|
|
1392
|
+
}) : (o ? s == null || s("") : A.onChange(""), u());
|
|
1393
|
+
}, h = !!p && !V, b = (p == null ? void 0 : p.name) || i || A.value, D = [
|
|
1399
1394
|
"fluig-attachment__box",
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1395
|
+
h ? "fluig-attachment__box--has-file" : "",
|
|
1396
|
+
V ? "fluig-attachment__box--uploading" : "",
|
|
1397
|
+
y && !h ? "readOnly" : "",
|
|
1398
|
+
y && h ? "fluig-attachment__box--readonly-view" : ""
|
|
1404
1399
|
].join(" ");
|
|
1405
|
-
return
|
|
1400
|
+
return W ? null : /* @__PURE__ */ x("div", { className: "form-group fluig-attachment", children: [
|
|
1406
1401
|
t && /* @__PURE__ */ r("label", { className: "fluig-attachment__label", children: t }),
|
|
1407
1402
|
/* @__PURE__ */ x(
|
|
1408
1403
|
"div",
|
|
1409
1404
|
{
|
|
1410
|
-
className:
|
|
1405
|
+
className: D,
|
|
1411
1406
|
onClick: () => {
|
|
1412
|
-
if (
|
|
1413
|
-
const
|
|
1414
|
-
|
|
1407
|
+
if (h) {
|
|
1408
|
+
const O = m(), k = (p == null ? void 0 : p.physicalFileName) || (p == null ? void 0 : p.description) || (p == null ? void 0 : p.name) || b;
|
|
1409
|
+
O.bridge && k && O.bridge.view(k);
|
|
1415
1410
|
} else
|
|
1416
|
-
|
|
1411
|
+
f();
|
|
1417
1412
|
},
|
|
1418
1413
|
children: [
|
|
1419
1414
|
/* @__PURE__ */ x("span", { className: "fluig-attachment__content", children: [
|
|
1420
1415
|
/* @__PURE__ */ r(
|
|
1421
1416
|
"i",
|
|
1422
1417
|
{
|
|
1423
|
-
className: `flaticon icon-sm ${
|
|
1418
|
+
className: `flaticon icon-sm ${V ? "flaticon-loading" : h ? "flaticon-file" : "flaticon-paperclip"} fluig-attachment__icon`
|
|
1424
1419
|
}
|
|
1425
1420
|
),
|
|
1426
|
-
/* @__PURE__ */ r("span", { className: "fluig-attachment__filename", children:
|
|
1421
|
+
/* @__PURE__ */ r("span", { className: "fluig-attachment__filename", children: V ? " Enviando..." : h ? b : y ? "Nenhum arquivo" : n || "Anexar" })
|
|
1427
1422
|
] }),
|
|
1428
|
-
|
|
1423
|
+
h && !y && /* @__PURE__ */ r(
|
|
1429
1424
|
"button",
|
|
1430
1425
|
{
|
|
1431
1426
|
type: "button",
|
|
1432
1427
|
className: "fluig-attachment__btn-remove btn btn-link text-danger",
|
|
1433
|
-
onClick:
|
|
1428
|
+
onClick: c,
|
|
1434
1429
|
children: /* @__PURE__ */ r("i", { className: "flaticon flaticon-trash icon-sm" })
|
|
1435
1430
|
}
|
|
1436
1431
|
)
|
|
1437
1432
|
]
|
|
1438
1433
|
}
|
|
1439
1434
|
),
|
|
1440
|
-
!o && P && /* @__PURE__ */ r("input", { type: "hidden", name: e, value:
|
|
1435
|
+
!o && P && /* @__PURE__ */ r("input", { type: "hidden", name: e, value: A.value || "" })
|
|
1441
1436
|
] });
|
|
1442
1437
|
}, Ft = z(Rt);
|
|
1443
1438
|
function It({
|
|
@@ -1446,12 +1441,12 @@ function It({
|
|
|
1446
1441
|
onOpen: n,
|
|
1447
1442
|
onClose: i,
|
|
1448
1443
|
content: s,
|
|
1449
|
-
footer:
|
|
1444
|
+
footer: d,
|
|
1450
1445
|
width: l
|
|
1451
1446
|
}) {
|
|
1452
1447
|
const o = C(
|
|
1453
|
-
(
|
|
1454
|
-
|
|
1448
|
+
(g) => {
|
|
1449
|
+
g.key === "Escape" && i();
|
|
1455
1450
|
},
|
|
1456
1451
|
[i]
|
|
1457
1452
|
);
|
|
@@ -1469,7 +1464,7 @@ function It({
|
|
|
1469
1464
|
{
|
|
1470
1465
|
style: { maxWidth: l },
|
|
1471
1466
|
className: "modal-container",
|
|
1472
|
-
onClick: (
|
|
1467
|
+
onClick: (g) => g.stopPropagation(),
|
|
1473
1468
|
children: [
|
|
1474
1469
|
/* @__PURE__ */ x("div", { className: "modal-header", children: [
|
|
1475
1470
|
/* @__PURE__ */ r("h3", { children: e }),
|
|
@@ -1491,7 +1486,7 @@ function It({
|
|
|
1491
1486
|
)
|
|
1492
1487
|
] }),
|
|
1493
1488
|
/* @__PURE__ */ r("div", { className: "modal-content", children: s }),
|
|
1494
|
-
|
|
1489
|
+
d && /* @__PURE__ */ r("div", { className: "modal-footer", children: d })
|
|
1495
1490
|
]
|
|
1496
1491
|
}
|
|
1497
1492
|
)
|