@tech-diefra/fluig-ui 1.1.2 → 1.1.3
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/components/SimpleTable/index.d.ts +10 -1
- package/dist/components/SimpleTable/useSimpleTable.d.ts +11 -6
- package/dist/index.cjs +1 -1
- package/dist/index.js +443 -414
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { memo as F, useMemo as
|
|
3
|
-
import { useFormContext as
|
|
1
|
+
import { jsxs as y, jsx as a, Fragment as Z } from "react/jsx-runtime";
|
|
2
|
+
import { memo as F, useMemo as j, useCallback as V, useState as B, useRef as U, useEffect as D, forwardRef as K } from "react";
|
|
3
|
+
import { useFormContext as T, useController as H, useFormState as ee } from "react-hook-form";
|
|
4
4
|
import { IMaskInput as te } from "react-imask";
|
|
5
|
-
import { useSection as
|
|
5
|
+
import { useSection as A, useFluigRuntime as W } from "@fluig-kit/ecm";
|
|
6
6
|
import ne, { registerLocale as ae } from "react-datepicker";
|
|
7
|
-
import { parse as re, isValid as
|
|
7
|
+
import { parse as re, isValid as oe, format as ie } from "date-fns";
|
|
8
8
|
const se = {
|
|
9
9
|
cpf: "000.000.000-00",
|
|
10
10
|
cnpj: "00.000.000/0000-00",
|
|
@@ -13,391 +13,391 @@ const se = {
|
|
|
13
13
|
};
|
|
14
14
|
function de({
|
|
15
15
|
name: e,
|
|
16
|
-
label:
|
|
16
|
+
label: r = "",
|
|
17
17
|
placeholder: t = "",
|
|
18
|
-
type:
|
|
19
|
-
mask:
|
|
20
|
-
className:
|
|
21
|
-
forceReadOnly:
|
|
22
|
-
forceHidden:
|
|
18
|
+
type: l = "text",
|
|
19
|
+
mask: i,
|
|
20
|
+
className: c = "",
|
|
21
|
+
forceReadOnly: s = !1,
|
|
22
|
+
forceHidden: d = !1
|
|
23
23
|
}) {
|
|
24
|
-
const { isReadOnly:
|
|
25
|
-
if (!
|
|
26
|
-
const
|
|
27
|
-
return (Number(
|
|
24
|
+
const { isReadOnly: k, isHidden: m } = A(), w = s || !!k(e), N = d || !!m(e), { control: x } = T(), { isView: P } = W(), { field: g } = H({ name: e, control: x }), { errors: v } = ee({ name: e }), b = v == null ? void 0 : v[e], C = j(() => i ? se[i] ?? i : null, [i]), S = V((n) => {
|
|
25
|
+
if (!n) return "";
|
|
26
|
+
const o = n.replace(/\D/g, "");
|
|
27
|
+
return (Number(o) / 100).toLocaleString("pt-BR", {
|
|
28
28
|
style: "currency",
|
|
29
29
|
currency: "BRL"
|
|
30
30
|
});
|
|
31
|
-
}, []),
|
|
32
|
-
(
|
|
33
|
-
[
|
|
31
|
+
}, []), h = V(
|
|
32
|
+
(n) => l === "monetary" ? S(n) : n,
|
|
33
|
+
[l, S]
|
|
34
34
|
);
|
|
35
|
-
return
|
|
36
|
-
/* @__PURE__ */
|
|
37
|
-
/* @__PURE__ */
|
|
38
|
-
] }) : /* @__PURE__ */
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
|
|
35
|
+
return P ? /* @__PURE__ */ y("div", { className: "form-group", children: [
|
|
36
|
+
/* @__PURE__ */ a("label", { children: r }),
|
|
37
|
+
/* @__PURE__ */ a("span", { className: "form-control", children: g.value || "-" })
|
|
38
|
+
] }) : /* @__PURE__ */ y("div", { className: `form-group ${N ? "hidden" : ""}`, children: [
|
|
39
|
+
/* @__PURE__ */ a("label", { children: r }),
|
|
40
|
+
C ? /* @__PURE__ */ a(
|
|
41
41
|
te,
|
|
42
42
|
{
|
|
43
43
|
name: e,
|
|
44
|
-
mask:
|
|
45
|
-
value: String(
|
|
44
|
+
mask: C,
|
|
45
|
+
value: String(g.value ?? ""),
|
|
46
46
|
unmask: !1,
|
|
47
|
-
onAccept: (
|
|
47
|
+
onAccept: (n) => g.onChange(h(n)),
|
|
48
48
|
placeholder: t,
|
|
49
|
-
readOnly:
|
|
50
|
-
className: `form-control ${
|
|
51
|
-
inputRef:
|
|
52
|
-
onBlur:
|
|
49
|
+
readOnly: w,
|
|
50
|
+
className: `form-control ${b ? "border-red" : ""} ${c}`,
|
|
51
|
+
inputRef: g.ref,
|
|
52
|
+
onBlur: g.onBlur
|
|
53
53
|
}
|
|
54
|
-
) : /* @__PURE__ */
|
|
54
|
+
) : /* @__PURE__ */ a(
|
|
55
55
|
"input",
|
|
56
56
|
{
|
|
57
|
-
...
|
|
57
|
+
...g,
|
|
58
58
|
type: "text",
|
|
59
|
-
value:
|
|
60
|
-
onChange: (
|
|
59
|
+
value: g.value ?? "",
|
|
60
|
+
onChange: (n) => g.onChange(h(n.target.value)),
|
|
61
61
|
placeholder: t,
|
|
62
|
-
readOnly:
|
|
63
|
-
className: `form-control ${
|
|
62
|
+
readOnly: w,
|
|
63
|
+
className: `form-control ${b ? "border-red" : ""} ${c}`
|
|
64
64
|
}
|
|
65
65
|
),
|
|
66
|
-
|
|
66
|
+
b && /* @__PURE__ */ a("p", { className: "text-danger", children: String(b.message) })
|
|
67
67
|
] });
|
|
68
68
|
}
|
|
69
69
|
const rt = F(de);
|
|
70
70
|
function le({
|
|
71
71
|
name: e,
|
|
72
|
-
label:
|
|
72
|
+
label: r = "",
|
|
73
73
|
options: t = [],
|
|
74
|
-
placeholder:
|
|
75
|
-
labelKey:
|
|
76
|
-
valueKey:
|
|
77
|
-
enableSearch:
|
|
78
|
-
searchPlaceholder:
|
|
79
|
-
loading:
|
|
80
|
-
onSearchChange:
|
|
81
|
-
debounceTime:
|
|
82
|
-
onSelect:
|
|
83
|
-
forceReadOnly:
|
|
84
|
-
forceHidden:
|
|
74
|
+
placeholder: l = "",
|
|
75
|
+
labelKey: i = "label",
|
|
76
|
+
valueKey: c = "value",
|
|
77
|
+
enableSearch: s = !1,
|
|
78
|
+
searchPlaceholder: d = "Buscar...",
|
|
79
|
+
loading: k = !1,
|
|
80
|
+
onSearchChange: m,
|
|
81
|
+
debounceTime: w = 300,
|
|
82
|
+
onSelect: N,
|
|
83
|
+
forceReadOnly: x = !1,
|
|
84
|
+
forceHidden: P = !1
|
|
85
85
|
}) {
|
|
86
|
-
const { isReadOnly:
|
|
87
|
-
field: { onChange:
|
|
88
|
-
fieldState: { error:
|
|
86
|
+
const { isReadOnly: g, isHidden: v } = A(), b = x || !!g(e), C = P || !!v(e), { control: S, clearErrors: h } = T(), { isView: n } = W(), {
|
|
87
|
+
field: { onChange: o, value: u, ref: O },
|
|
88
|
+
fieldState: { error: f }
|
|
89
89
|
} = H({
|
|
90
90
|
name: e,
|
|
91
|
-
control:
|
|
92
|
-
}), [
|
|
91
|
+
control: S
|
|
92
|
+
}), [R, M] = B(!1), [$, Y] = B(""), z = U(null), I = U(m);
|
|
93
93
|
D(() => {
|
|
94
|
-
I.current =
|
|
95
|
-
}, [
|
|
96
|
-
const
|
|
97
|
-
z.current && !z.current.contains(_.target) &&
|
|
94
|
+
I.current = m;
|
|
95
|
+
}, [m]), D(() => {
|
|
96
|
+
const p = (_) => {
|
|
97
|
+
z.current && !z.current.contains(_.target) && M(!1);
|
|
98
98
|
};
|
|
99
|
-
return document.addEventListener("mousedown",
|
|
99
|
+
return document.addEventListener("mousedown", p), () => document.removeEventListener("mousedown", p);
|
|
100
100
|
}, []), D(() => {
|
|
101
|
-
|
|
102
|
-
}, [
|
|
103
|
-
if (!
|
|
104
|
-
const
|
|
105
|
-
I.current && I.current(
|
|
106
|
-
},
|
|
107
|
-
return () => clearTimeout(
|
|
108
|
-
}, [
|
|
109
|
-
const Q =
|
|
110
|
-
(
|
|
111
|
-
) : t ?? [], [t,
|
|
112
|
-
if (
|
|
113
|
-
if (typeof
|
|
114
|
-
return String(
|
|
115
|
-
const
|
|
116
|
-
(_) => String(_ == null ? void 0 : _[
|
|
101
|
+
R || Y("");
|
|
102
|
+
}, [R]), D(() => {
|
|
103
|
+
if (!s) return;
|
|
104
|
+
const p = setTimeout(() => {
|
|
105
|
+
I.current && I.current($);
|
|
106
|
+
}, w);
|
|
107
|
+
return () => clearTimeout(p);
|
|
108
|
+
}, [$, s, w]);
|
|
109
|
+
const Q = j(() => s && !m && $.trim() ? t.filter(
|
|
110
|
+
(p) => String((p == null ? void 0 : p[i]) ?? "").toLowerCase().includes($.toLowerCase())
|
|
111
|
+
) : t ?? [], [t, s, m, $, i]), J = j(() => {
|
|
112
|
+
if (u == null) return "";
|
|
113
|
+
if (typeof u == "object")
|
|
114
|
+
return String(u[c] ?? "");
|
|
115
|
+
const p = (t || []).find(
|
|
116
|
+
(_) => String(_ == null ? void 0 : _[c]) === String(u)
|
|
117
117
|
);
|
|
118
|
-
return String(
|
|
119
|
-
}, [
|
|
120
|
-
|
|
118
|
+
return String(p ? (p == null ? void 0 : p[i]) ?? "" : u);
|
|
119
|
+
}, [u, t, c, i]), G = (p) => {
|
|
120
|
+
b || (o(p[c]), N && N(p), h(e), M(!1));
|
|
121
121
|
};
|
|
122
|
-
return /* @__PURE__ */
|
|
122
|
+
return /* @__PURE__ */ y(
|
|
123
123
|
"div",
|
|
124
124
|
{
|
|
125
|
-
className: `select-wrapper form-group ${
|
|
125
|
+
className: `select-wrapper form-group ${C ? "hidden" : ""}`,
|
|
126
126
|
ref: z,
|
|
127
127
|
children: [
|
|
128
|
-
/* @__PURE__ */
|
|
129
|
-
|
|
130
|
-
/* @__PURE__ */
|
|
128
|
+
/* @__PURE__ */ a("label", { className: "control-label", children: r }),
|
|
129
|
+
n ? /* @__PURE__ */ a("span", { className: "form-control", children: J || "-" }) : /* @__PURE__ */ y(Z, { children: [
|
|
130
|
+
/* @__PURE__ */ y(
|
|
131
131
|
"div",
|
|
132
132
|
{
|
|
133
|
-
className: `select-control ${
|
|
134
|
-
onClick: () => !
|
|
135
|
-
ref:
|
|
133
|
+
className: `select-control ${f ? "border-red" : ""} ${b ? "readOnly" : ""}`,
|
|
134
|
+
onClick: () => !b && M((p) => !p),
|
|
135
|
+
ref: O,
|
|
136
136
|
children: [
|
|
137
|
-
/* @__PURE__ */
|
|
138
|
-
/* @__PURE__ */
|
|
137
|
+
/* @__PURE__ */ a("span", { className: `select-display ${b ? "readOnly" : ""}`, children: J || l }),
|
|
138
|
+
/* @__PURE__ */ a("i", { className: "flaticon flaticon-chevron-down select-icon" })
|
|
139
139
|
]
|
|
140
140
|
}
|
|
141
141
|
),
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
R && !b && /* @__PURE__ */ y("div", { className: "select-dropdown", children: [
|
|
143
|
+
s && /* @__PURE__ */ a("div", { className: "select-search", children: /* @__PURE__ */ a(
|
|
144
144
|
"input",
|
|
145
145
|
{
|
|
146
146
|
type: "text",
|
|
147
147
|
className: "select-search-input",
|
|
148
|
-
value:
|
|
149
|
-
onChange: (
|
|
150
|
-
placeholder:
|
|
148
|
+
value: $,
|
|
149
|
+
onChange: (p) => Y(p.target.value),
|
|
150
|
+
placeholder: k ? "Carregando..." : d,
|
|
151
151
|
autoFocus: !0,
|
|
152
|
-
onClick: (
|
|
152
|
+
onClick: (p) => p.stopPropagation()
|
|
153
153
|
}
|
|
154
154
|
) }),
|
|
155
|
-
/* @__PURE__ */
|
|
155
|
+
/* @__PURE__ */ a("ul", { className: "select-options", children: k ? /* @__PURE__ */ a("li", { className: "select-option readOnly", children: "Carregando..." }) : Q.length > 0 ? Q.map((p) => /* @__PURE__ */ a(
|
|
156
156
|
"li",
|
|
157
157
|
{
|
|
158
|
-
onClick: () => G(
|
|
158
|
+
onClick: () => G(p),
|
|
159
159
|
className: "select-option handleHover",
|
|
160
|
-
children:
|
|
160
|
+
children: p[i]
|
|
161
161
|
},
|
|
162
|
-
|
|
163
|
-
)) : /* @__PURE__ */
|
|
162
|
+
p[c]
|
|
163
|
+
)) : /* @__PURE__ */ a("li", { className: "select-option readOnly", children: "Sem resultados" }) })
|
|
164
164
|
] })
|
|
165
165
|
] }),
|
|
166
|
-
/* @__PURE__ */
|
|
167
|
-
|
|
166
|
+
/* @__PURE__ */ a("input", { type: "hidden", name: e, value: u || "" }),
|
|
167
|
+
f && /* @__PURE__ */ a("p", { className: "text-danger", children: String(f.message) })
|
|
168
168
|
]
|
|
169
169
|
}
|
|
170
170
|
);
|
|
171
171
|
}
|
|
172
|
-
const
|
|
173
|
-
function
|
|
172
|
+
const ot = F(le);
|
|
173
|
+
function it({
|
|
174
174
|
name: e,
|
|
175
|
-
options:
|
|
175
|
+
options: r = [],
|
|
176
176
|
label: t = "",
|
|
177
|
-
valueKey:
|
|
178
|
-
labelKey:
|
|
179
|
-
forceReadOnly:
|
|
180
|
-
forceHidden:
|
|
177
|
+
valueKey: l = "value",
|
|
178
|
+
labelKey: i = "label",
|
|
179
|
+
forceReadOnly: c = !1,
|
|
180
|
+
forceHidden: s = !1
|
|
181
181
|
}) {
|
|
182
|
-
var
|
|
183
|
-
const
|
|
184
|
-
if (!
|
|
182
|
+
var u, O;
|
|
183
|
+
const d = T(), { isView: k, isReadOnly: m } = W(), { isReadOnly: w, isHidden: N } = A(), x = w ? w(e) : !1, P = N ? N(e) : !1, g = c || x, v = s || P, b = g || m || k;
|
|
184
|
+
if (!d || !e)
|
|
185
185
|
return console.error("Checkbox requer contexto de formulário e nome."), null;
|
|
186
|
-
const
|
|
187
|
-
const
|
|
188
|
-
return
|
|
189
|
-
}, {}),
|
|
186
|
+
const C = () => !r || !d ? {} : r.reduce((f, R) => {
|
|
187
|
+
const M = R[l], $ = d.getValues(M);
|
|
188
|
+
return f[M] = $ === "on", f;
|
|
189
|
+
}, {}), S = d.watch(e), h = j(() => S && typeof S == "object" ? S : C(), [S, r, l]);
|
|
190
190
|
D(() => {
|
|
191
|
-
const
|
|
192
|
-
(!
|
|
191
|
+
const f = d.getValues(e);
|
|
192
|
+
(!f || typeof f != "object") && d.setValue(e, h, {
|
|
193
193
|
shouldDirty: !1,
|
|
194
194
|
shouldValidate: !1
|
|
195
195
|
});
|
|
196
|
-
}, [
|
|
197
|
-
const
|
|
198
|
-
if (
|
|
199
|
-
const
|
|
200
|
-
|
|
196
|
+
}, [h, e, d]);
|
|
197
|
+
const n = (f, R) => {
|
|
198
|
+
if (b) return;
|
|
199
|
+
const M = { ...h, [f]: R };
|
|
200
|
+
d.setValue(e, M, {
|
|
201
201
|
shouldDirty: !0,
|
|
202
202
|
shouldValidate: !0
|
|
203
|
-
}),
|
|
204
|
-
},
|
|
205
|
-
return /* @__PURE__ */
|
|
206
|
-
t && /* @__PURE__ */
|
|
207
|
-
/* @__PURE__ */
|
|
203
|
+
}), d.setValue(f, R ? "on" : "", { shouldValidate: !1 });
|
|
204
|
+
}, o = (O = (u = d.formState) == null ? void 0 : u.errors) == null ? void 0 : O[e];
|
|
205
|
+
return /* @__PURE__ */ y("div", { className: `form-group ${v ? "hidden" : ""}`, children: [
|
|
206
|
+
t && /* @__PURE__ */ a("label", { children: t }),
|
|
207
|
+
/* @__PURE__ */ a(
|
|
208
208
|
"div",
|
|
209
209
|
{
|
|
210
|
-
className: `checkbox-group-custom ${
|
|
211
|
-
children:
|
|
212
|
-
const
|
|
213
|
-
return /* @__PURE__ */
|
|
214
|
-
/* @__PURE__ */
|
|
215
|
-
/* @__PURE__ */
|
|
210
|
+
className: `checkbox-group-custom ${b ? "readOnly" : ""}`,
|
|
211
|
+
children: r.map((f) => {
|
|
212
|
+
const R = String(f[l]), M = h[R] === !0;
|
|
213
|
+
return /* @__PURE__ */ y("div", { children: [
|
|
214
|
+
/* @__PURE__ */ a("input", { type: "hidden", ...d.register(R) }),
|
|
215
|
+
/* @__PURE__ */ y(
|
|
216
216
|
"label",
|
|
217
217
|
{
|
|
218
|
-
className: `custom-checkbox ${
|
|
218
|
+
className: `custom-checkbox ${M ? "checked" : ""} ${b ? "readOnly" : ""}`,
|
|
219
219
|
children: [
|
|
220
|
-
/* @__PURE__ */
|
|
220
|
+
/* @__PURE__ */ a(
|
|
221
221
|
"input",
|
|
222
222
|
{
|
|
223
223
|
type: "checkbox",
|
|
224
|
-
checked:
|
|
225
|
-
disabled:
|
|
226
|
-
onChange: (
|
|
224
|
+
checked: M,
|
|
225
|
+
disabled: b,
|
|
226
|
+
onChange: ($) => n(R, $.target.checked)
|
|
227
227
|
}
|
|
228
228
|
),
|
|
229
|
-
/* @__PURE__ */
|
|
230
|
-
/* @__PURE__ */
|
|
229
|
+
/* @__PURE__ */ a("span", { className: "checkmark" }),
|
|
230
|
+
/* @__PURE__ */ a("span", { children: f[i] })
|
|
231
231
|
]
|
|
232
232
|
}
|
|
233
233
|
)
|
|
234
|
-
] },
|
|
234
|
+
] }, R);
|
|
235
235
|
})
|
|
236
236
|
}
|
|
237
237
|
),
|
|
238
|
-
|
|
238
|
+
o && /* @__PURE__ */ a("p", { className: "text-danger", children: String(o.message) })
|
|
239
239
|
] });
|
|
240
240
|
}
|
|
241
241
|
function ce({
|
|
242
242
|
name: e,
|
|
243
|
-
label:
|
|
243
|
+
label: r = "",
|
|
244
244
|
options: t = [],
|
|
245
|
-
valueKey:
|
|
246
|
-
labelKey:
|
|
247
|
-
iconKey:
|
|
248
|
-
forceReadOnly:
|
|
249
|
-
forceHidden:
|
|
245
|
+
valueKey: l = "value",
|
|
246
|
+
labelKey: i = "label",
|
|
247
|
+
iconKey: c = "icon",
|
|
248
|
+
forceReadOnly: s = !1,
|
|
249
|
+
forceHidden: d = !1
|
|
250
250
|
}) {
|
|
251
|
-
const { isReadOnly:
|
|
252
|
-
field:
|
|
253
|
-
fieldState: { error:
|
|
251
|
+
const { isReadOnly: k, isHidden: m } = A(), w = s || !!k(e), N = d || !!m(e), { control: x } = T(), { isView: P, isReadOnly: g } = W(), {
|
|
252
|
+
field: v,
|
|
253
|
+
fieldState: { error: b }
|
|
254
254
|
} = H({
|
|
255
255
|
name: e,
|
|
256
|
-
control:
|
|
257
|
-
}),
|
|
258
|
-
(
|
|
259
|
-
|
|
256
|
+
control: x
|
|
257
|
+
}), C = w || g || P, S = v.value ?? "", h = V(
|
|
258
|
+
(n) => {
|
|
259
|
+
C || v.onChange(n);
|
|
260
260
|
},
|
|
261
|
-
[
|
|
261
|
+
[C, v]
|
|
262
262
|
);
|
|
263
|
-
return /* @__PURE__ */
|
|
264
|
-
|
|
265
|
-
/* @__PURE__ */
|
|
263
|
+
return /* @__PURE__ */ y("div", { className: `form-group column ${N ? "hidden" : ""}`, children: [
|
|
264
|
+
r && /* @__PURE__ */ a("label", { className: "control-label", children: r }),
|
|
265
|
+
/* @__PURE__ */ a(
|
|
266
266
|
"div",
|
|
267
267
|
{
|
|
268
|
-
className: `btn-group ${
|
|
268
|
+
className: `btn-group ${C ? "view-mode" : ""}`,
|
|
269
269
|
"data-field-name": e,
|
|
270
|
-
children: t.map((
|
|
271
|
-
const
|
|
272
|
-
return /* @__PURE__ */
|
|
270
|
+
children: t.map((n) => {
|
|
271
|
+
const o = n[l], u = S === o, O = n.color ? { "--customColor": n.color } : void 0;
|
|
272
|
+
return /* @__PURE__ */ y(
|
|
273
273
|
"label",
|
|
274
274
|
{
|
|
275
|
-
htmlFor: `${e}_${
|
|
276
|
-
style:
|
|
277
|
-
className: `btn fs-ellipsis ${
|
|
275
|
+
htmlFor: `${e}_${o}`,
|
|
276
|
+
style: O,
|
|
277
|
+
className: `btn fs-ellipsis ${u ? "active" : ""}`,
|
|
278
278
|
children: [
|
|
279
|
-
/* @__PURE__ */
|
|
279
|
+
/* @__PURE__ */ a(
|
|
280
280
|
"input",
|
|
281
281
|
{
|
|
282
282
|
type: "radio",
|
|
283
|
-
id: `${e}_${
|
|
283
|
+
id: `${e}_${o}`,
|
|
284
284
|
name: e,
|
|
285
|
-
value:
|
|
286
|
-
checked:
|
|
285
|
+
value: o,
|
|
286
|
+
checked: u,
|
|
287
287
|
className: "hidden",
|
|
288
|
-
onChange: () =>
|
|
289
|
-
disabled:
|
|
288
|
+
onChange: () => h(o),
|
|
289
|
+
disabled: C
|
|
290
290
|
}
|
|
291
291
|
),
|
|
292
|
-
|
|
292
|
+
n[c] && /* @__PURE__ */ a("i", { className: `${n[c]} icon-sm` }),
|
|
293
293
|
" ",
|
|
294
|
-
|
|
294
|
+
n[i]
|
|
295
295
|
]
|
|
296
296
|
},
|
|
297
|
-
|
|
297
|
+
o
|
|
298
298
|
);
|
|
299
299
|
})
|
|
300
300
|
}
|
|
301
301
|
),
|
|
302
|
-
|
|
302
|
+
b && /* @__PURE__ */ a("p", { className: "text-danger", children: String(b.message) })
|
|
303
303
|
] });
|
|
304
304
|
}
|
|
305
305
|
const st = F(ce), ue = ({
|
|
306
306
|
name: e,
|
|
307
|
-
label:
|
|
307
|
+
label: r = "",
|
|
308
308
|
placeholder: t = "",
|
|
309
|
-
className:
|
|
310
|
-
rows:
|
|
311
|
-
maxLength:
|
|
312
|
-
forceReadOnly:
|
|
313
|
-
forceHidden:
|
|
309
|
+
className: l = "",
|
|
310
|
+
rows: i = 4,
|
|
311
|
+
maxLength: c,
|
|
312
|
+
forceReadOnly: s = !1,
|
|
313
|
+
forceHidden: d = !1
|
|
314
314
|
}) => {
|
|
315
|
-
const { isReadOnly:
|
|
316
|
-
field:
|
|
317
|
-
fieldState: { error:
|
|
315
|
+
const { isReadOnly: k, isHidden: m } = A(), w = s || !!k(e), N = d || !!m(e), { control: x } = T(), { isView: P } = W(), {
|
|
316
|
+
field: g,
|
|
317
|
+
fieldState: { error: v }
|
|
318
318
|
} = H({
|
|
319
319
|
name: e,
|
|
320
|
-
control:
|
|
320
|
+
control: x
|
|
321
321
|
});
|
|
322
|
-
return
|
|
323
|
-
/* @__PURE__ */
|
|
324
|
-
/* @__PURE__ */
|
|
325
|
-
] }) : /* @__PURE__ */
|
|
326
|
-
/* @__PURE__ */
|
|
327
|
-
/* @__PURE__ */
|
|
322
|
+
return P ? /* @__PURE__ */ y("div", { className: `form-group ${N ? "hidden" : ""}`, children: [
|
|
323
|
+
/* @__PURE__ */ a("label", { children: r }),
|
|
324
|
+
/* @__PURE__ */ a("span", { className: "form-control", children: g.value || "-" })
|
|
325
|
+
] }) : /* @__PURE__ */ y("div", { className: `form-group ${N ? "hidden" : ""}`, children: [
|
|
326
|
+
/* @__PURE__ */ a("label", { children: r }),
|
|
327
|
+
/* @__PURE__ */ a(
|
|
328
328
|
"textarea",
|
|
329
329
|
{
|
|
330
|
-
...
|
|
331
|
-
rows:
|
|
332
|
-
maxLength:
|
|
333
|
-
value:
|
|
330
|
+
...g,
|
|
331
|
+
rows: i,
|
|
332
|
+
maxLength: c,
|
|
333
|
+
value: g.value || "",
|
|
334
334
|
placeholder: t,
|
|
335
|
-
readOnly:
|
|
336
|
-
className: `form-control ${
|
|
335
|
+
readOnly: w,
|
|
336
|
+
className: `form-control ${v ? "border-red" : ""} ${l}`
|
|
337
337
|
}
|
|
338
338
|
),
|
|
339
|
-
|
|
339
|
+
v && /* @__PURE__ */ a("p", { className: "text-danger", children: String(v.message) })
|
|
340
340
|
] });
|
|
341
341
|
}, dt = F(ue);
|
|
342
342
|
function E(e) {
|
|
343
|
-
return (
|
|
344
|
-
const t =
|
|
343
|
+
return (r = {}) => {
|
|
344
|
+
const t = r.width ? String(r.width) : e.defaultWidth;
|
|
345
345
|
return e.formats[t] || e.formats[e.defaultWidth];
|
|
346
346
|
};
|
|
347
347
|
}
|
|
348
348
|
function q(e) {
|
|
349
|
-
return (
|
|
350
|
-
const
|
|
351
|
-
let
|
|
352
|
-
if (
|
|
353
|
-
const
|
|
354
|
-
|
|
349
|
+
return (r, t) => {
|
|
350
|
+
const l = t != null && t.context ? String(t.context) : "standalone";
|
|
351
|
+
let i;
|
|
352
|
+
if (l === "formatting" && e.formattingValues) {
|
|
353
|
+
const s = e.defaultFormattingWidth || e.defaultWidth, d = t != null && t.width ? String(t.width) : s;
|
|
354
|
+
i = e.formattingValues[d] || e.formattingValues[s];
|
|
355
355
|
} else {
|
|
356
|
-
const
|
|
357
|
-
|
|
356
|
+
const s = e.defaultWidth, d = t != null && t.width ? String(t.width) : e.defaultWidth;
|
|
357
|
+
i = e.values[d] || e.values[s];
|
|
358
358
|
}
|
|
359
|
-
const
|
|
360
|
-
return
|
|
359
|
+
const c = e.argumentCallback ? e.argumentCallback(r) : r;
|
|
360
|
+
return i[c];
|
|
361
361
|
};
|
|
362
362
|
}
|
|
363
363
|
function L(e) {
|
|
364
|
-
return (
|
|
365
|
-
const
|
|
366
|
-
if (!
|
|
364
|
+
return (r, t = {}) => {
|
|
365
|
+
const l = t.width, i = l && e.matchPatterns[l] || e.matchPatterns[e.defaultMatchWidth], c = r.match(i);
|
|
366
|
+
if (!c)
|
|
367
367
|
return null;
|
|
368
|
-
const
|
|
368
|
+
const s = c[0], d = l && e.parsePatterns[l] || e.parsePatterns[e.defaultParseWidth], k = Array.isArray(d) ? he(d, (N) => N.test(s)) : (
|
|
369
369
|
// [TODO] -- I challenge you to fix the type
|
|
370
|
-
me(
|
|
370
|
+
me(d, (N) => N.test(s))
|
|
371
371
|
);
|
|
372
|
-
let
|
|
373
|
-
|
|
372
|
+
let m;
|
|
373
|
+
m = e.valueCallback ? e.valueCallback(k) : k, m = t.valueCallback ? (
|
|
374
374
|
// [TODO] -- I challenge you to fix the type
|
|
375
|
-
t.valueCallback(
|
|
376
|
-
) :
|
|
377
|
-
const
|
|
378
|
-
return { value:
|
|
375
|
+
t.valueCallback(m)
|
|
376
|
+
) : m;
|
|
377
|
+
const w = r.slice(s.length);
|
|
378
|
+
return { value: m, rest: w };
|
|
379
379
|
};
|
|
380
380
|
}
|
|
381
|
-
function me(e,
|
|
381
|
+
function me(e, r) {
|
|
382
382
|
for (const t in e)
|
|
383
|
-
if (Object.prototype.hasOwnProperty.call(e, t) &&
|
|
383
|
+
if (Object.prototype.hasOwnProperty.call(e, t) && r(e[t]))
|
|
384
384
|
return t;
|
|
385
385
|
}
|
|
386
|
-
function he(e,
|
|
386
|
+
function he(e, r) {
|
|
387
387
|
for (let t = 0; t < e.length; t++)
|
|
388
|
-
if (
|
|
388
|
+
if (r(e[t]))
|
|
389
389
|
return t;
|
|
390
390
|
}
|
|
391
391
|
function fe(e) {
|
|
392
|
-
return (
|
|
393
|
-
const
|
|
394
|
-
if (!
|
|
395
|
-
const
|
|
396
|
-
if (!
|
|
397
|
-
let
|
|
398
|
-
|
|
399
|
-
const
|
|
400
|
-
return { value:
|
|
392
|
+
return (r, t = {}) => {
|
|
393
|
+
const l = r.match(e.matchPattern);
|
|
394
|
+
if (!l) return null;
|
|
395
|
+
const i = l[0], c = r.match(e.parsePattern);
|
|
396
|
+
if (!c) return null;
|
|
397
|
+
let s = e.valueCallback ? e.valueCallback(c[0]) : c[0];
|
|
398
|
+
s = t.valueCallback ? t.valueCallback(s) : s;
|
|
399
|
+
const d = r.slice(i.length);
|
|
400
|
+
return { value: s, rest: d };
|
|
401
401
|
};
|
|
402
402
|
}
|
|
403
403
|
const ge = {
|
|
@@ -462,10 +462,10 @@ const ge = {
|
|
|
462
462
|
one: "quase 1 ano",
|
|
463
463
|
other: "quase {{count}} anos"
|
|
464
464
|
}
|
|
465
|
-
}, be = (e,
|
|
466
|
-
let
|
|
467
|
-
const
|
|
468
|
-
return typeof
|
|
465
|
+
}, be = (e, r, t) => {
|
|
466
|
+
let l;
|
|
467
|
+
const i = ge[e];
|
|
468
|
+
return typeof i == "string" ? l = i : r === 1 ? l = i.one : l = i.other.replace("{{count}}", String(r)), t != null && t.addSuffix ? t.comparison && t.comparison > 0 ? "em " + l : "há " + l : l;
|
|
469
469
|
}, pe = {
|
|
470
470
|
full: "EEEE, d 'de' MMMM 'de' y",
|
|
471
471
|
long: "d 'de' MMMM 'de' y",
|
|
@@ -496,17 +496,17 @@ const ge = {
|
|
|
496
496
|
})
|
|
497
497
|
}, Ne = {
|
|
498
498
|
lastWeek: (e) => {
|
|
499
|
-
const
|
|
500
|
-
return "'" + (
|
|
499
|
+
const r = e.getDay();
|
|
500
|
+
return "'" + (r === 0 || r === 6 ? "último" : "última") + "' eeee 'às' p";
|
|
501
501
|
},
|
|
502
502
|
yesterday: "'ontem às' p",
|
|
503
503
|
today: "'hoje às' p",
|
|
504
504
|
tomorrow: "'amanhã às' p",
|
|
505
505
|
nextWeek: "eeee 'às' p",
|
|
506
506
|
other: "P"
|
|
507
|
-
}, ke = (e,
|
|
508
|
-
const
|
|
509
|
-
return typeof
|
|
507
|
+
}, ke = (e, r, t, l) => {
|
|
508
|
+
const i = Ne[e];
|
|
509
|
+
return typeof i == "function" ? i(r) : i;
|
|
510
510
|
}, xe = {
|
|
511
511
|
narrow: ["AC", "DC"],
|
|
512
512
|
abbreviated: ["AC", "DC"],
|
|
@@ -628,9 +628,9 @@ const ge = {
|
|
|
628
628
|
evening: "da tarde",
|
|
629
629
|
night: "da noite"
|
|
630
630
|
}
|
|
631
|
-
}, Me = (e,
|
|
631
|
+
}, Me = (e, r) => {
|
|
632
632
|
const t = Number(e);
|
|
633
|
-
return (
|
|
633
|
+
return (r == null ? void 0 : r.unit) === "week" ? t + "ª" : t + "º";
|
|
634
634
|
}, $e = {
|
|
635
635
|
ordinalNumber: Me,
|
|
636
636
|
era: q({
|
|
@@ -777,281 +777,310 @@ const ge = {
|
|
|
777
777
|
ae("pt-BR", Ie);
|
|
778
778
|
const X = "dd/MM/yyyy", Ee = (e) => {
|
|
779
779
|
if (!e) return null;
|
|
780
|
-
const
|
|
781
|
-
return
|
|
782
|
-
}, Xe = (e) => e ?
|
|
783
|
-
({ shimRef: e, className:
|
|
780
|
+
const r = re(e, X, /* @__PURE__ */ new Date());
|
|
781
|
+
return oe(r) ? r : null;
|
|
782
|
+
}, Xe = (e) => e ? ie(e, X) : "", Ye = K(
|
|
783
|
+
({ shimRef: e, className: r, name: t, ...l }, i) => /* @__PURE__ */ a(
|
|
784
784
|
"input",
|
|
785
785
|
{
|
|
786
786
|
name: t,
|
|
787
|
-
...
|
|
788
|
-
className:
|
|
789
|
-
ref: (
|
|
790
|
-
typeof
|
|
787
|
+
...l,
|
|
788
|
+
className: r,
|
|
789
|
+
ref: (c) => {
|
|
790
|
+
typeof i == "function" ? i(c) : i && (i.current = c), e && e(c);
|
|
791
791
|
}
|
|
792
792
|
}
|
|
793
793
|
)
|
|
794
794
|
), Qe = ({
|
|
795
795
|
name: e,
|
|
796
|
-
label:
|
|
796
|
+
label: r = "",
|
|
797
797
|
placeholder: t = "dd/mm/aaaa",
|
|
798
|
-
className:
|
|
799
|
-
forceReadOnly:
|
|
800
|
-
forceHidden:
|
|
798
|
+
className: l = "",
|
|
799
|
+
forceReadOnly: i = !1,
|
|
800
|
+
forceHidden: c = !1
|
|
801
801
|
}) => {
|
|
802
|
-
const { control:
|
|
803
|
-
field: { onChange:
|
|
804
|
-
fieldState: { error:
|
|
802
|
+
const { control: s } = T(), { isView: d } = W(), { isReadOnly: k, isHidden: m } = A(), w = i || !!k(e), N = c || !!m(e), {
|
|
803
|
+
field: { onChange: x, onBlur: P, value: g, ref: v },
|
|
804
|
+
fieldState: { error: b }
|
|
805
805
|
} = H({
|
|
806
806
|
name: e,
|
|
807
|
-
control:
|
|
808
|
-
}),
|
|
809
|
-
(
|
|
810
|
-
|
|
807
|
+
control: s
|
|
808
|
+
}), C = j(() => Ee(g), [g]), S = V(
|
|
809
|
+
(n) => {
|
|
810
|
+
x(n ? Xe(n) : "");
|
|
811
811
|
},
|
|
812
|
-
[
|
|
813
|
-
),
|
|
814
|
-
(
|
|
815
|
-
var
|
|
816
|
-
if (
|
|
817
|
-
const
|
|
818
|
-
|
|
812
|
+
[x]
|
|
813
|
+
), h = V(
|
|
814
|
+
(n) => {
|
|
815
|
+
var o, u;
|
|
816
|
+
if (v(n), n && ((u = (o = s._fields) == null ? void 0 : o[e]) != null && u._f)) {
|
|
817
|
+
const O = s._fields[e];
|
|
818
|
+
O._f.ref = {
|
|
819
819
|
focus: () => {
|
|
820
|
-
var
|
|
821
|
-
return (
|
|
820
|
+
var f;
|
|
821
|
+
return (f = n.focus) == null ? void 0 : f.call(n);
|
|
822
822
|
},
|
|
823
823
|
select: () => {
|
|
824
|
-
var
|
|
825
|
-
return (
|
|
824
|
+
var f;
|
|
825
|
+
return (f = n.select) == null ? void 0 : f.call(n);
|
|
826
826
|
},
|
|
827
|
-
setCustomValidity: (
|
|
828
|
-
var
|
|
829
|
-
return (
|
|
827
|
+
setCustomValidity: (f) => {
|
|
828
|
+
var R;
|
|
829
|
+
return (R = n.setCustomValidity) == null ? void 0 : R.call(n, f);
|
|
830
830
|
},
|
|
831
831
|
reportValidity: () => {
|
|
832
|
-
var
|
|
833
|
-
return (
|
|
832
|
+
var f;
|
|
833
|
+
return (f = n.reportValidity) == null ? void 0 : f.call(n);
|
|
834
834
|
}
|
|
835
835
|
};
|
|
836
836
|
}
|
|
837
837
|
},
|
|
838
|
-
[
|
|
838
|
+
[v, s, e]
|
|
839
839
|
);
|
|
840
|
-
return
|
|
841
|
-
/* @__PURE__ */
|
|
842
|
-
/* @__PURE__ */
|
|
843
|
-
] }) : /* @__PURE__ */
|
|
844
|
-
|
|
845
|
-
/* @__PURE__ */
|
|
840
|
+
return N ? null : d ? /* @__PURE__ */ y("div", { className: "form-group", children: [
|
|
841
|
+
/* @__PURE__ */ a("label", { children: r }),
|
|
842
|
+
/* @__PURE__ */ a("span", { className: "form-control", children: g || "-" })
|
|
843
|
+
] }) : /* @__PURE__ */ y("div", { className: `form-group fluig-style-guide ${l}`, children: [
|
|
844
|
+
r && /* @__PURE__ */ a("label", { className: "control-label", htmlFor: e, children: r }),
|
|
845
|
+
/* @__PURE__ */ a("div", { className: `${b ? "border-red" : ""}`, children: /* @__PURE__ */ a(
|
|
846
846
|
ne,
|
|
847
847
|
{
|
|
848
848
|
id: e,
|
|
849
849
|
name: e,
|
|
850
|
-
selected:
|
|
851
|
-
onChange:
|
|
852
|
-
onBlur:
|
|
850
|
+
selected: C,
|
|
851
|
+
onChange: S,
|
|
852
|
+
onBlur: P,
|
|
853
853
|
dateFormat: X,
|
|
854
854
|
placeholderText: t,
|
|
855
|
-
disabled:
|
|
856
|
-
readOnly:
|
|
855
|
+
disabled: w,
|
|
856
|
+
readOnly: w,
|
|
857
857
|
locale: "pt-BR",
|
|
858
|
-
className: `form-control ${
|
|
858
|
+
className: `form-control ${b ? "border-red" : ""}`,
|
|
859
859
|
wrapperClassName: "w-100",
|
|
860
860
|
showMonthDropdown: !0,
|
|
861
861
|
showYearDropdown: !0,
|
|
862
862
|
dropdownMode: "select",
|
|
863
|
-
isClearable: !
|
|
863
|
+
isClearable: !w && !!g,
|
|
864
864
|
autoComplete: "off",
|
|
865
|
-
customInput: /* @__PURE__ */
|
|
865
|
+
customInput: /* @__PURE__ */ a(Ye, { name: e, shimRef: h })
|
|
866
866
|
}
|
|
867
867
|
) }),
|
|
868
|
-
|
|
868
|
+
b && /* @__PURE__ */ a("span", { className: "help-block text-danger", children: String(b.message) })
|
|
869
869
|
] });
|
|
870
870
|
}, lt = F(Qe);
|
|
871
871
|
function Je({
|
|
872
872
|
mapping: e = {},
|
|
873
|
-
defaultLabel:
|
|
873
|
+
defaultLabel: r = "Não reconhecido",
|
|
874
874
|
className: t = "",
|
|
875
|
-
hidden:
|
|
876
|
-
label:
|
|
875
|
+
hidden: l = !1,
|
|
876
|
+
label: i
|
|
877
877
|
}) {
|
|
878
|
-
const { activityId:
|
|
879
|
-
if (!
|
|
880
|
-
return /* @__PURE__ */
|
|
881
|
-
|
|
882
|
-
/* @__PURE__ */
|
|
878
|
+
const { activityId: c } = W(), s = j(() => !e || c === null || c === void 0 ? null : e[c], [c, e]);
|
|
879
|
+
if (!s)
|
|
880
|
+
return /* @__PURE__ */ y("div", { className: `form-group ${l ? "hidden" : ""}`, children: [
|
|
881
|
+
i && /* @__PURE__ */ a("label", { children: i }),
|
|
882
|
+
/* @__PURE__ */ a("div", { className: `status-badge default ${t}`, children: r })
|
|
883
883
|
] });
|
|
884
|
-
const
|
|
885
|
-
"--customColor":
|
|
884
|
+
const d = {
|
|
885
|
+
"--customColor": s.color
|
|
886
886
|
};
|
|
887
|
-
return /* @__PURE__ */
|
|
888
|
-
|
|
889
|
-
/* @__PURE__ */
|
|
890
|
-
|
|
891
|
-
/* @__PURE__ */
|
|
887
|
+
return /* @__PURE__ */ y("div", { className: `form-group ${l ? "hidden" : ""}`, children: [
|
|
888
|
+
i && /* @__PURE__ */ a("label", { children: i }),
|
|
889
|
+
/* @__PURE__ */ y("div", { className: `status-badge ${t}`, style: d, children: [
|
|
890
|
+
s.icon && /* @__PURE__ */ a("i", { className: s.icon }),
|
|
891
|
+
/* @__PURE__ */ a("span", { children: s.label })
|
|
892
892
|
] })
|
|
893
893
|
] });
|
|
894
894
|
}
|
|
895
895
|
const ct = F(Je);
|
|
896
896
|
function Ue({
|
|
897
897
|
name: e,
|
|
898
|
-
control:
|
|
898
|
+
control: r,
|
|
899
899
|
defaultRowValue: t,
|
|
900
|
-
isView:
|
|
901
|
-
isReadOnly:
|
|
900
|
+
isView: l,
|
|
901
|
+
isReadOnly: i,
|
|
902
|
+
filters: c = []
|
|
902
903
|
}) {
|
|
903
|
-
const { field: s } = H({ name: e, control:
|
|
904
|
+
const { field: s } = H({ name: e, control: r }), [d, k] = B([]), [m, w] = B([]), N = () => Date.now() + Math.random(), x = (n) => {
|
|
904
905
|
try {
|
|
905
|
-
const
|
|
906
|
-
return Array.isArray(
|
|
907
|
-
...
|
|
908
|
-
_uid:
|
|
906
|
+
const o = JSON.parse(n);
|
|
907
|
+
return Array.isArray(o) ? o.map((u) => ({
|
|
908
|
+
...u,
|
|
909
|
+
_uid: u._uid || N()
|
|
909
910
|
})) : [];
|
|
910
|
-
} catch (
|
|
911
|
-
return console.error(`Erro ao ler dados da tabela "${e}":`,
|
|
911
|
+
} catch (o) {
|
|
912
|
+
return console.error(`Erro ao ler dados da tabela "${e}":`, o), [];
|
|
912
913
|
}
|
|
913
914
|
};
|
|
914
915
|
D(() => {
|
|
915
|
-
if (!(
|
|
916
|
-
const
|
|
917
|
-
if (s.value ===
|
|
918
|
-
const
|
|
919
|
-
|
|
916
|
+
if (!(d.length > 0 && !l) && s.value && typeof s.value == "string") {
|
|
917
|
+
const n = JSON.stringify(d);
|
|
918
|
+
if (s.value === n) return;
|
|
919
|
+
const o = x(s.value);
|
|
920
|
+
k(o);
|
|
920
921
|
}
|
|
921
|
-
}, [s.value,
|
|
922
|
-
if (
|
|
923
|
-
const
|
|
924
|
-
s.value !==
|
|
925
|
-
}, [
|
|
926
|
-
const
|
|
927
|
-
const
|
|
928
|
-
|
|
929
|
-
}, [t]),
|
|
930
|
-
|
|
931
|
-
(
|
|
932
|
-
),
|
|
933
|
-
}, [
|
|
934
|
-
(
|
|
935
|
-
|
|
936
|
-
(
|
|
937
|
-
(
|
|
922
|
+
}, [s.value, l]), D(() => {
|
|
923
|
+
if (i) return;
|
|
924
|
+
const n = JSON.stringify(d);
|
|
925
|
+
s.value !== n && s.onChange(n);
|
|
926
|
+
}, [d, s, i]);
|
|
927
|
+
const P = V(() => {
|
|
928
|
+
const n = { _uid: N(), ...t };
|
|
929
|
+
k((o) => [...o, n]);
|
|
930
|
+
}, [t]), g = V(() => {
|
|
931
|
+
k(
|
|
932
|
+
(n) => n.filter((o) => !m.includes(o._uid))
|
|
933
|
+
), w([]);
|
|
934
|
+
}, [m]), v = V(
|
|
935
|
+
(n, o, u) => {
|
|
936
|
+
k(
|
|
937
|
+
(O) => O.map(
|
|
938
|
+
(f) => f._uid === n ? { ...f, [o]: u } : f
|
|
938
939
|
)
|
|
939
940
|
);
|
|
940
941
|
},
|
|
941
942
|
[]
|
|
942
|
-
),
|
|
943
|
-
|
|
944
|
-
(
|
|
943
|
+
), b = V((n) => {
|
|
944
|
+
w(
|
|
945
|
+
(o) => o.includes(n) ? o.filter((u) => u !== n) : [...o, n]
|
|
945
946
|
);
|
|
946
|
-
}, []),
|
|
947
|
-
(
|
|
948
|
-
|
|
947
|
+
}, []), C = V(
|
|
948
|
+
(n) => {
|
|
949
|
+
w(n ? d.map((o) => o._uid) : []);
|
|
949
950
|
},
|
|
950
|
-
[
|
|
951
|
-
),
|
|
951
|
+
[d]
|
|
952
|
+
), S = d.length > 0 && m.length === d.length, h = j(() => !c || c.length === 0 ? d : d.filter(
|
|
953
|
+
(n) => c.every((o) => {
|
|
954
|
+
if ("custom" in o)
|
|
955
|
+
return o.custom(n);
|
|
956
|
+
const u = n[o.field];
|
|
957
|
+
switch (o.operator) {
|
|
958
|
+
case "===":
|
|
959
|
+
return u === o.value;
|
|
960
|
+
case "!==":
|
|
961
|
+
return u !== o.value;
|
|
962
|
+
case ">":
|
|
963
|
+
return u > o.value;
|
|
964
|
+
case "<":
|
|
965
|
+
return u < o.value;
|
|
966
|
+
case ">=":
|
|
967
|
+
return u >= o.value;
|
|
968
|
+
case "<=":
|
|
969
|
+
return u <= o.value;
|
|
970
|
+
default:
|
|
971
|
+
return !0;
|
|
972
|
+
}
|
|
973
|
+
})
|
|
974
|
+
), [d, c]);
|
|
952
975
|
return {
|
|
953
976
|
field: s,
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
updateCellValue: b,
|
|
965
|
-
toggleSelection: p,
|
|
966
|
-
toggleSelectAll: g
|
|
977
|
+
tableRows: d,
|
|
978
|
+
visibleRows: h,
|
|
979
|
+
selectedRowIds: m,
|
|
980
|
+
isAllSelected: S,
|
|
981
|
+
handle: {
|
|
982
|
+
addRow: P,
|
|
983
|
+
removeRows: g,
|
|
984
|
+
updateCellValue: v,
|
|
985
|
+
toggleSelection: b,
|
|
986
|
+
toggleSelectAll: C
|
|
967
987
|
}
|
|
968
988
|
};
|
|
969
989
|
}
|
|
970
990
|
const ut = ({
|
|
971
991
|
name: e,
|
|
972
|
-
title:
|
|
992
|
+
title: r = "Tabela Dinâmica",
|
|
973
993
|
columns: t,
|
|
974
|
-
defaultRowValue:
|
|
975
|
-
forceReadOnly:
|
|
976
|
-
layout:
|
|
977
|
-
|
|
994
|
+
defaultRowValue: l = {},
|
|
995
|
+
forceReadOnly: i = !1,
|
|
996
|
+
layout: c = "fluid",
|
|
997
|
+
actions: s = !0,
|
|
998
|
+
filters: d = []
|
|
978
999
|
}) => {
|
|
979
|
-
const { control:
|
|
1000
|
+
const { control: k } = T(), { isView: m, isReadOnly: w } = W(), { isReadOnly: N } = A(), x = i || m || w || N && N(e), {
|
|
1001
|
+
field: P,
|
|
1002
|
+
// tableRows,
|
|
1003
|
+
visibleRows: g,
|
|
1004
|
+
selectedRowIds: v,
|
|
1005
|
+
isAllSelected: b,
|
|
1006
|
+
handle: C
|
|
1007
|
+
} = Ue({
|
|
980
1008
|
name: e,
|
|
981
|
-
control:
|
|
982
|
-
defaultRowValue:
|
|
983
|
-
isView:
|
|
984
|
-
isReadOnly: !!
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
/* @__PURE__ */
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
1009
|
+
control: k,
|
|
1010
|
+
defaultRowValue: l,
|
|
1011
|
+
isView: m,
|
|
1012
|
+
isReadOnly: !!x,
|
|
1013
|
+
filters: d
|
|
1014
|
+
}), S = c === "fixed";
|
|
1015
|
+
return /* @__PURE__ */ y("div", { className: `table-wrapper ${S ? "table-fixed" : "table-fluid"}`, children: [
|
|
1016
|
+
/* @__PURE__ */ a("input", { type: "hidden", ...P }),
|
|
1017
|
+
s && /* @__PURE__ */ y("div", { className: "header-handle", children: [
|
|
1018
|
+
/* @__PURE__ */ a("h3", { children: r }),
|
|
1019
|
+
!x && /* @__PURE__ */ y("div", { children: [
|
|
1020
|
+
/* @__PURE__ */ y(
|
|
992
1021
|
"button",
|
|
993
1022
|
{
|
|
994
1023
|
type: "button",
|
|
995
|
-
className: `btn ${
|
|
996
|
-
disabled:
|
|
997
|
-
onClick:
|
|
1024
|
+
className: `btn ${v.length > 0 ? "btn-danger" : ""}`,
|
|
1025
|
+
disabled: v.length === 0,
|
|
1026
|
+
onClick: C.removeRows,
|
|
998
1027
|
children: [
|
|
999
1028
|
"Remover (",
|
|
1000
|
-
|
|
1029
|
+
v.length,
|
|
1001
1030
|
")"
|
|
1002
1031
|
]
|
|
1003
1032
|
}
|
|
1004
1033
|
),
|
|
1005
|
-
/* @__PURE__ */
|
|
1034
|
+
/* @__PURE__ */ a("button", { type: "button", className: "btn-add", onClick: C.addRow, children: "Adicionar" })
|
|
1006
1035
|
] })
|
|
1007
1036
|
] }),
|
|
1008
|
-
/* @__PURE__ */
|
|
1037
|
+
/* @__PURE__ */ a("div", { className: "table-scroll", children: /* @__PURE__ */ y(
|
|
1009
1038
|
"table",
|
|
1010
1039
|
{
|
|
1011
1040
|
className: "table-custom",
|
|
1012
1041
|
style: {
|
|
1013
1042
|
tableLayout: "fixed",
|
|
1014
|
-
width:
|
|
1043
|
+
width: S ? "max-content" : "100%"
|
|
1015
1044
|
},
|
|
1016
1045
|
children: [
|
|
1017
|
-
/* @__PURE__ */
|
|
1018
|
-
!
|
|
1046
|
+
/* @__PURE__ */ a("thead", { children: /* @__PURE__ */ y("tr", { children: [
|
|
1047
|
+
!x && /* @__PURE__ */ a("th", { style: { width: "50px" }, children: /* @__PURE__ */ a(
|
|
1019
1048
|
"input",
|
|
1020
1049
|
{
|
|
1021
1050
|
type: "checkbox",
|
|
1022
1051
|
checked: b,
|
|
1023
|
-
onChange: (
|
|
1052
|
+
onChange: (h) => C.toggleSelectAll(h.target.checked)
|
|
1024
1053
|
}
|
|
1025
1054
|
) }),
|
|
1026
|
-
t.map((
|
|
1055
|
+
t.map((h) => /* @__PURE__ */ a(
|
|
1027
1056
|
"th",
|
|
1028
1057
|
{
|
|
1029
|
-
style:
|
|
1030
|
-
children:
|
|
1058
|
+
style: h.width ? { width: h.width } : { width: "100%" },
|
|
1059
|
+
children: h.label
|
|
1031
1060
|
},
|
|
1032
|
-
|
|
1061
|
+
h.key
|
|
1033
1062
|
))
|
|
1034
1063
|
] }) }),
|
|
1035
|
-
/* @__PURE__ */
|
|
1036
|
-
/* @__PURE__ */
|
|
1037
|
-
|
|
1038
|
-
!
|
|
1064
|
+
/* @__PURE__ */ a("div", {}),
|
|
1065
|
+
/* @__PURE__ */ y("tbody", { children: [
|
|
1066
|
+
g.map((h, n) => /* @__PURE__ */ y("tr", { children: [
|
|
1067
|
+
!x && /* @__PURE__ */ a("td", { children: /* @__PURE__ */ a(
|
|
1039
1068
|
"input",
|
|
1040
1069
|
{
|
|
1041
1070
|
type: "checkbox",
|
|
1042
|
-
checked:
|
|
1043
|
-
onChange: () =>
|
|
1071
|
+
checked: v.includes(h._uid),
|
|
1072
|
+
onChange: () => C.toggleSelection(h._uid)
|
|
1044
1073
|
}
|
|
1045
1074
|
) }),
|
|
1046
|
-
t.map((
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
(
|
|
1050
|
-
!!
|
|
1051
|
-
!!
|
|
1052
|
-
) :
|
|
1053
|
-
] },
|
|
1054
|
-
|
|
1075
|
+
t.map((o) => /* @__PURE__ */ a("td", { children: o.render ? o.render(
|
|
1076
|
+
h,
|
|
1077
|
+
n,
|
|
1078
|
+
(u, O) => C.updateCellValue(h._uid, u, O),
|
|
1079
|
+
!!x,
|
|
1080
|
+
!!m
|
|
1081
|
+
) : h[o.key] }, `${h._uid}-${o.key}`))
|
|
1082
|
+
] }, h._uid)),
|
|
1083
|
+
g.length === 0 && /* @__PURE__ */ a("tr", { className: "empty-row", children: /* @__PURE__ */ a("td", { colSpan: 100, className: "text-center", children: x ? "Nenhum registro encontrado." : "Nenhum registro." }) })
|
|
1055
1084
|
] })
|
|
1056
1085
|
]
|
|
1057
1086
|
}
|
|
@@ -1059,11 +1088,11 @@ const ut = ({
|
|
|
1059
1088
|
] });
|
|
1060
1089
|
};
|
|
1061
1090
|
export {
|
|
1062
|
-
|
|
1091
|
+
it as Checkbox,
|
|
1063
1092
|
lt as DatePicker,
|
|
1064
1093
|
rt as Input,
|
|
1065
1094
|
st as RadioBtn,
|
|
1066
|
-
|
|
1095
|
+
ot as Select,
|
|
1067
1096
|
ut as SimpleTable,
|
|
1068
1097
|
ct as StatusBadge,
|
|
1069
1098
|
dt as TextArea
|