@iclips/ui 4.1.4 → 4.3.0
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/ui/data/filter-builder.cjs +1 -1
- package/dist/components/ui/data/filter-builder.cjs.map +1 -1
- package/dist/components/ui/data/filter-builder.js +251 -219
- package/dist/components/ui/data/filter-builder.js.map +1 -1
- package/dist/components/ui/forms/month-range-picker.cjs +1 -1
- package/dist/components/ui/forms/month-range-picker.cjs.map +1 -1
- package/dist/components/ui/forms/month-range-picker.js +180 -155
- package/dist/components/ui/forms/month-range-picker.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.cts +21 -1
- package/dist/index.d.ts +21 -1
- package/docs/formularios.md +1 -1
- package/package.json +1 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { cn as
|
|
4
|
-
import { Button as
|
|
5
|
-
import { Plus as
|
|
6
|
-
import { Popover as
|
|
7
|
-
import { Badge as
|
|
8
|
-
import { Input as
|
|
9
|
-
import { Checkbox as
|
|
10
|
-
import { Label as
|
|
11
|
-
import { DatePicker as
|
|
12
|
-
import { DateRangePicker as
|
|
13
|
-
import { MonthRangePicker as
|
|
14
|
-
const
|
|
1
|
+
import { jsxs as c, jsx as r, Fragment as L } from "react/jsx-runtime";
|
|
2
|
+
import w from "react";
|
|
3
|
+
import { cn as S } from "../utils.js";
|
|
4
|
+
import { Button as f } from "../primitives/button.js";
|
|
5
|
+
import { Plus as W, Search as Z, X as j } from "lucide-react";
|
|
6
|
+
import { Popover as A, PopoverTrigger as P, PopoverContent as k, PopoverAnchor as U } from "../overlays/popover.js";
|
|
7
|
+
import { Badge as F } from "../primitives/badge.js";
|
|
8
|
+
import { Input as E } from "../forms/input.js";
|
|
9
|
+
import { Checkbox as ee } from "../forms/checkbox.js";
|
|
10
|
+
import { Label as X } from "../primitives/label.js";
|
|
11
|
+
import { DatePicker as ae } from "../forms/date-picker.js";
|
|
12
|
+
import { DateRangePicker as le } from "../forms/date-range-picker.js";
|
|
13
|
+
import { MonthRangePicker as re } from "../forms/month-range-picker.js";
|
|
14
|
+
const C = [
|
|
15
15
|
{ value: "is", label: "é", multiSelect: !1 },
|
|
16
16
|
{ value: "is_not", label: "não é", multiSelect: !1 },
|
|
17
17
|
{ value: "is_any_of", label: "é qualquer um de", multiSelect: !0 },
|
|
@@ -25,76 +25,91 @@ const $ = [
|
|
|
25
25
|
{ value: "between", label: "está entre", multiSelect: !1 },
|
|
26
26
|
{ value: "is_empty", label: "está vazio", multiSelect: !1 },
|
|
27
27
|
{ value: "is_not_empty", label: "não está vazio", multiSelect: !1 }
|
|
28
|
-
],
|
|
29
|
-
function
|
|
28
|
+
], Y = "between";
|
|
29
|
+
function G(a) {
|
|
30
|
+
var o;
|
|
31
|
+
return $(a) ? C.filter((s) => s.value === Y) : (o = a == null ? void 0 : a.operators) != null && o.length ? a.operators.map((s) => C.find((u) => u.value === s)).filter((s) => !!s) : C.filter((s) => s.value !== Y);
|
|
32
|
+
}
|
|
33
|
+
function M(a) {
|
|
34
|
+
var o;
|
|
35
|
+
return ((o = G(a)[0]) == null ? void 0 : o.value) ?? "is";
|
|
36
|
+
}
|
|
37
|
+
function H(a, o, s) {
|
|
38
|
+
const u = new Set(o.filter((i) => i.id !== s).map((i) => i.field));
|
|
39
|
+
return a.filter((i) => !(i.unique && u.has(i.value)));
|
|
40
|
+
}
|
|
41
|
+
function $(a) {
|
|
30
42
|
return (a == null ? void 0 : a.type) === "dateRange" || (a == null ? void 0 : a.type) === "monthRange";
|
|
31
43
|
}
|
|
32
|
-
function
|
|
33
|
-
const
|
|
34
|
-
return `${a.getFullYear()}-${
|
|
44
|
+
function D(a) {
|
|
45
|
+
const o = String(a.getMonth() + 1).padStart(2, "0"), s = String(a.getDate()).padStart(2, "0");
|
|
46
|
+
return `${a.getFullYear()}-${o}-${s}`;
|
|
35
47
|
}
|
|
36
|
-
function
|
|
48
|
+
function z(a) {
|
|
37
49
|
return /* @__PURE__ */ new Date(`${a}T00:00:00`);
|
|
38
50
|
}
|
|
39
|
-
function
|
|
51
|
+
function be({
|
|
40
52
|
conditions: a,
|
|
41
|
-
onConditionsChange:
|
|
42
|
-
fields:
|
|
43
|
-
className:
|
|
53
|
+
onConditionsChange: o,
|
|
54
|
+
fields: s,
|
|
55
|
+
className: u
|
|
44
56
|
}) {
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
57
|
+
const i = H(s, a).find(
|
|
58
|
+
(m) => !a.some((h) => h.field === m.value)
|
|
59
|
+
) ?? H(s, a)[0], l = () => {
|
|
60
|
+
if (!i) return;
|
|
61
|
+
const m = {
|
|
48
62
|
id: Math.random().toString(36).substr(2, 9),
|
|
49
|
-
field:
|
|
50
|
-
operator:
|
|
51
|
-
value: ""
|
|
63
|
+
field: i.value,
|
|
64
|
+
operator: M(i),
|
|
65
|
+
value: i.multiSelect || $(i) ? [] : ""
|
|
52
66
|
};
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
a.map((
|
|
67
|
+
o([...a, m]);
|
|
68
|
+
}, d = (m) => {
|
|
69
|
+
o(a.filter((h) => h.id !== m));
|
|
70
|
+
}, v = (m, h) => {
|
|
71
|
+
o(
|
|
72
|
+
a.map((g) => g.id === m ? { ...g, ...h } : g)
|
|
59
73
|
);
|
|
60
74
|
};
|
|
61
|
-
return /* @__PURE__ */
|
|
62
|
-
a.length === 0 ? /* @__PURE__ */ r("div", { className: "text-center py-8 text-muted-foreground text-sm", children: 'Nenhuma condição de filtro. Clique em "Adicionar condição" para começar.' }) : a.map((
|
|
63
|
-
|
|
75
|
+
return /* @__PURE__ */ c("div", { className: S("space-y-3", u), children: [
|
|
76
|
+
a.length === 0 ? /* @__PURE__ */ r("div", { className: "text-center py-8 text-muted-foreground text-sm", children: 'Nenhuma condição de filtro. Clique em "Adicionar condição" para começar.' }) : a.map((m, h) => /* @__PURE__ */ r(
|
|
77
|
+
te,
|
|
64
78
|
{
|
|
65
|
-
condition:
|
|
66
|
-
fields:
|
|
67
|
-
index:
|
|
68
|
-
onUpdate: (
|
|
69
|
-
onRemove: () =>
|
|
79
|
+
condition: m,
|
|
80
|
+
fields: H(s, a, m.id),
|
|
81
|
+
index: h,
|
|
82
|
+
onUpdate: (g) => v(m.id, g),
|
|
83
|
+
onRemove: () => d(m.id)
|
|
70
84
|
},
|
|
71
|
-
|
|
85
|
+
m.id
|
|
72
86
|
)),
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
|
|
87
|
+
/* @__PURE__ */ c(
|
|
88
|
+
f,
|
|
75
89
|
{
|
|
76
90
|
type: "button",
|
|
77
91
|
variant: "outline",
|
|
78
92
|
size: "sm",
|
|
79
|
-
onClick:
|
|
93
|
+
onClick: l,
|
|
94
|
+
disabled: !i,
|
|
80
95
|
className: "gap-2",
|
|
81
96
|
children: [
|
|
82
|
-
/* @__PURE__ */ r(
|
|
97
|
+
/* @__PURE__ */ r(W, { className: "h-4 w-4" }),
|
|
83
98
|
"Adicionar condição"
|
|
84
99
|
]
|
|
85
100
|
}
|
|
86
101
|
)
|
|
87
102
|
] });
|
|
88
103
|
}
|
|
89
|
-
function
|
|
104
|
+
function te({
|
|
90
105
|
condition: a,
|
|
91
|
-
fields:
|
|
92
|
-
index:
|
|
93
|
-
onUpdate:
|
|
94
|
-
onRemove:
|
|
106
|
+
fields: o,
|
|
107
|
+
index: s,
|
|
108
|
+
onUpdate: u,
|
|
109
|
+
onRemove: i
|
|
95
110
|
}) {
|
|
96
|
-
var
|
|
97
|
-
const l =
|
|
111
|
+
var B;
|
|
112
|
+
const l = o.find((e) => e.value === a.field), d = C.find((e) => e.value === a.operator), v = (l == null ? void 0 : l.multiSelect) || (d == null ? void 0 : d.multiSelect) || !1, m = !["is_empty", "is_not_empty"].includes(a.operator), h = $(l), g = G(l), x = Array.isArray(a.value) ? a.value : [], [_, O] = w.useState(""), T = w.useRef(null), [I, J] = w.useState(null), N = w.useMemo(() => l != null && l.groups ? l.groups.flatMap((e) => [
|
|
98
113
|
{
|
|
99
114
|
value: e.value ?? `__label__${e.label}`,
|
|
100
115
|
label: e.label,
|
|
@@ -113,38 +128,38 @@ function Z({
|
|
|
113
128
|
label: e.label,
|
|
114
129
|
isHeader: !1,
|
|
115
130
|
selecionavel: !0
|
|
116
|
-
})), [l == null ? void 0 : l.options, l == null ? void 0 : l.groups]),
|
|
117
|
-
if (!
|
|
118
|
-
const e =
|
|
119
|
-
if (!(l != null && l.groups)) return
|
|
131
|
+
})), [l == null ? void 0 : l.options, l == null ? void 0 : l.groups]), V = w.useMemo(() => {
|
|
132
|
+
if (!_) return N;
|
|
133
|
+
const e = _.toLowerCase(), t = (p) => p.label.toLowerCase().includes(e) || p.value.toLowerCase().includes(e);
|
|
134
|
+
if (!(l != null && l.groups)) return N.filter(t);
|
|
120
135
|
const n = [];
|
|
121
|
-
let
|
|
122
|
-
for (const
|
|
123
|
-
if (
|
|
124
|
-
|
|
136
|
+
let b = null, q = !1, R = !1;
|
|
137
|
+
for (const p of N) {
|
|
138
|
+
if (p.isHeader) {
|
|
139
|
+
b = p, q = t(p), R = !1, q && (n.push(p), R = !0);
|
|
125
140
|
continue;
|
|
126
141
|
}
|
|
127
|
-
(
|
|
142
|
+
(q || t(p)) && (!R && b && (n.push(b), R = !0), n.push(p));
|
|
128
143
|
}
|
|
129
144
|
return n;
|
|
130
|
-
}, [
|
|
131
|
-
if (!
|
|
132
|
-
|
|
145
|
+
}, [N, _, l == null ? void 0 : l.groups]), y = Array.isArray(a.value) ? a.value : a.value ? [a.value] : [], K = (e) => {
|
|
146
|
+
if (!v) {
|
|
147
|
+
u({ value: e });
|
|
133
148
|
return;
|
|
134
149
|
}
|
|
135
|
-
const t = Array.isArray(a.value) ? a.value : [], n = t.includes(e) ? t.filter((
|
|
136
|
-
|
|
137
|
-
},
|
|
138
|
-
if (!
|
|
150
|
+
const t = Array.isArray(a.value) ? a.value : [], n = t.includes(e) ? t.filter((b) => b !== e) : [...t, e];
|
|
151
|
+
u({ value: n });
|
|
152
|
+
}, Q = (e) => {
|
|
153
|
+
if (!v) return;
|
|
139
154
|
const t = Array.isArray(a.value) ? a.value : [];
|
|
140
|
-
|
|
155
|
+
u({ value: t.filter((n) => n !== e) });
|
|
141
156
|
};
|
|
142
|
-
return /* @__PURE__ */
|
|
143
|
-
/* @__PURE__ */ r("div", { className: "flex items-center h-9 px-2 text-sm text-muted-foreground", children:
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
-
/* @__PURE__ */
|
|
146
|
-
/* @__PURE__ */ r(
|
|
147
|
-
|
|
157
|
+
return /* @__PURE__ */ c("div", { className: "flex items-start gap-2 group", children: [
|
|
158
|
+
/* @__PURE__ */ r("div", { className: "flex items-center h-9 px-2 text-sm text-muted-foreground", children: s === 0 ? "Onde" : "E" }),
|
|
159
|
+
/* @__PURE__ */ c("div", { className: "flex-1 flex items-center gap-2 flex-wrap p-2 border rounded-lg bg-background", children: [
|
|
160
|
+
/* @__PURE__ */ c(A, { children: [
|
|
161
|
+
/* @__PURE__ */ r(P, { asChild: !0, children: /* @__PURE__ */ r(
|
|
162
|
+
f,
|
|
148
163
|
{
|
|
149
164
|
variant: "ghost",
|
|
150
165
|
size: "sm",
|
|
@@ -152,46 +167,49 @@ function Z({
|
|
|
152
167
|
children: (l == null ? void 0 : l.label) || "Selecionar campo"
|
|
153
168
|
}
|
|
154
169
|
) }),
|
|
155
|
-
/* @__PURE__ */ r(
|
|
156
|
-
|
|
170
|
+
/* @__PURE__ */ r(k, { className: "w-[200px] p-2", align: "start", children: /* @__PURE__ */ r("div", { className: "space-y-1", children: o.map((e) => /* @__PURE__ */ r(
|
|
171
|
+
f,
|
|
157
172
|
{
|
|
158
173
|
variant: "ghost",
|
|
159
174
|
size: "sm",
|
|
160
|
-
className:
|
|
175
|
+
className: S(
|
|
161
176
|
"w-full justify-start",
|
|
162
177
|
a.field === e.value && "bg-muted"
|
|
163
178
|
),
|
|
164
|
-
onClick: () =>
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
179
|
+
onClick: () => {
|
|
180
|
+
var t;
|
|
181
|
+
return u({
|
|
182
|
+
field: e.value,
|
|
183
|
+
// O operador volta ao inicial do novo campo (restrito por `operators` ou período)
|
|
184
|
+
operator: M(e),
|
|
185
|
+
value: e.multiSelect || $(e) || (t = C.find((n) => n.value === M(e))) != null && t.multiSelect ? [] : ""
|
|
186
|
+
});
|
|
187
|
+
},
|
|
170
188
|
children: e.label
|
|
171
189
|
},
|
|
172
190
|
e.value
|
|
173
191
|
)) }) })
|
|
174
192
|
] }),
|
|
175
|
-
/* @__PURE__ */
|
|
176
|
-
/* @__PURE__ */ r(
|
|
177
|
-
|
|
193
|
+
/* @__PURE__ */ c(A, { children: [
|
|
194
|
+
/* @__PURE__ */ r(P, { asChild: !0, children: /* @__PURE__ */ r(
|
|
195
|
+
f,
|
|
178
196
|
{
|
|
179
197
|
variant: "ghost",
|
|
180
198
|
size: "sm",
|
|
181
199
|
className: "h-7 px-2 font-normal hover:bg-muted text-muted-foreground",
|
|
182
|
-
children: (
|
|
200
|
+
children: (d == null ? void 0 : d.label) || "is"
|
|
183
201
|
}
|
|
184
202
|
) }),
|
|
185
|
-
/* @__PURE__ */ r(
|
|
186
|
-
|
|
203
|
+
/* @__PURE__ */ r(k, { className: "w-[200px] p-2", align: "start", children: /* @__PURE__ */ r("div", { className: "space-y-1", children: g.map((e) => /* @__PURE__ */ r(
|
|
204
|
+
f,
|
|
187
205
|
{
|
|
188
206
|
variant: "ghost",
|
|
189
207
|
size: "sm",
|
|
190
|
-
className:
|
|
208
|
+
className: S(
|
|
191
209
|
"w-full justify-start",
|
|
192
210
|
a.operator === e.value && "bg-muted"
|
|
193
211
|
),
|
|
194
|
-
onClick: () =>
|
|
212
|
+
onClick: () => u({
|
|
195
213
|
operator: e.value,
|
|
196
214
|
value: e.multiSelect ? [] : ""
|
|
197
215
|
}),
|
|
@@ -200,136 +218,150 @@ function Z({
|
|
|
200
218
|
e.value
|
|
201
219
|
)) }) })
|
|
202
220
|
] }),
|
|
203
|
-
m && /* @__PURE__ */
|
|
204
|
-
|
|
205
|
-
|
|
221
|
+
m && /* @__PURE__ */ c(L, { children: [
|
|
222
|
+
h ? (l == null ? void 0 : l.type) === "monthRange" ? /* @__PURE__ */ r(
|
|
223
|
+
re,
|
|
206
224
|
{
|
|
207
|
-
value:
|
|
208
|
-
onChange: (e) =>
|
|
225
|
+
value: x.length === 2 ? { from: z(x[0]), to: z(x[1]) } : void 0,
|
|
226
|
+
onChange: (e) => u({ value: e ? [D(e.from), D(e.to)] : [] }),
|
|
209
227
|
className: "h-7 text-sm"
|
|
210
228
|
}
|
|
211
229
|
) : /* @__PURE__ */ r(
|
|
212
|
-
|
|
230
|
+
le,
|
|
213
231
|
{
|
|
214
|
-
value:
|
|
215
|
-
onChange: (e) =>
|
|
216
|
-
value: e != null && e.from && (e != null && e.to) ? [
|
|
232
|
+
value: x.length === 2 ? { from: z(x[0]), to: z(x[1]) } : void 0,
|
|
233
|
+
onChange: (e) => u({
|
|
234
|
+
value: e != null && e.from && (e != null && e.to) ? [D(e.from), D(e.to)] : []
|
|
217
235
|
}),
|
|
218
236
|
className: "h-7 text-sm"
|
|
219
237
|
}
|
|
220
238
|
) : l != null && l.options || l != null && l.groups ? (
|
|
221
239
|
// Select field with options
|
|
222
|
-
/* @__PURE__ */
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
{
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
"flex min-w-0 items-center space-x-2",
|
|
275
|
-
e.isFilho && "pl-4"
|
|
276
|
-
),
|
|
277
|
-
children: s ? /* @__PURE__ */ u(T, { children: [
|
|
278
|
-
/* @__PURE__ */ r(
|
|
279
|
-
J,
|
|
280
|
-
{
|
|
281
|
-
id: `${a.id}-${e.value}`,
|
|
282
|
-
checked: t,
|
|
283
|
-
onCheckedChange: () => B(e.value)
|
|
284
|
-
}
|
|
285
|
-
),
|
|
286
|
-
/* @__PURE__ */ r(
|
|
287
|
-
"label",
|
|
240
|
+
/* @__PURE__ */ c(
|
|
241
|
+
A,
|
|
242
|
+
{
|
|
243
|
+
onOpenChange: (e) => {
|
|
244
|
+
var n;
|
|
245
|
+
e || O("");
|
|
246
|
+
const t = (n = T.current) == null ? void 0 : n.closest('[data-slot="popover-content"]');
|
|
247
|
+
e && J(t ? { current: t } : null);
|
|
248
|
+
},
|
|
249
|
+
children: [
|
|
250
|
+
I && /* @__PURE__ */ r(U, { virtualRef: I }),
|
|
251
|
+
/* @__PURE__ */ r(P, { asChild: !0, children: /* @__PURE__ */ r(
|
|
252
|
+
f,
|
|
253
|
+
{
|
|
254
|
+
ref: T,
|
|
255
|
+
variant: "ghost",
|
|
256
|
+
size: "sm",
|
|
257
|
+
className: "h-7 px-2 font-normal hover:bg-muted",
|
|
258
|
+
children: v && y.length > 0 ? /* @__PURE__ */ c("span", { className: "flex items-center gap-1", children: [
|
|
259
|
+
y.length,
|
|
260
|
+
" selecionado",
|
|
261
|
+
y.length > 1 ? "s" : ""
|
|
262
|
+
] }) : !v && a.value && ((B = N.find((e) => e.value === a.value)) == null ? void 0 : B.label) || "Selecionar valor"
|
|
263
|
+
}
|
|
264
|
+
) }),
|
|
265
|
+
/* @__PURE__ */ r(
|
|
266
|
+
k,
|
|
267
|
+
{
|
|
268
|
+
className: "w-80 max-w-[calc(100vw-2rem)] p-3 data-[state=closed]:pointer-events-none",
|
|
269
|
+
align: "start",
|
|
270
|
+
collisionPadding: 8,
|
|
271
|
+
...I ? { side: "right", sideOffset: 8 } : {},
|
|
272
|
+
children: /* @__PURE__ */ c("div", { className: "space-y-2", children: [
|
|
273
|
+
/* @__PURE__ */ r(X, { className: "text-xs text-muted-foreground", children: v ? "Selecionar valores" : "Selecionar valor" }),
|
|
274
|
+
/* @__PURE__ */ c("div", { className: "relative", children: [
|
|
275
|
+
/* @__PURE__ */ r(Z, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
|
|
276
|
+
/* @__PURE__ */ r(
|
|
277
|
+
E,
|
|
278
|
+
{
|
|
279
|
+
type: "text",
|
|
280
|
+
placeholder: "Buscar...",
|
|
281
|
+
value: _,
|
|
282
|
+
onChange: (e) => O(e.target.value),
|
|
283
|
+
className: "h-9 pl-8",
|
|
284
|
+
autoFocus: !0
|
|
285
|
+
}
|
|
286
|
+
)
|
|
287
|
+
] }),
|
|
288
|
+
/* @__PURE__ */ r("div", { className: "space-y-2 max-h-[320px] overflow-y-auto overflow-x-hidden", children: V.length === 0 ? /* @__PURE__ */ r("div", { className: "text-sm text-muted-foreground text-center py-4", children: "Nenhum resultado encontrado" }) : V.map((e) => {
|
|
289
|
+
if (e.isHeader && !e.selecionavel)
|
|
290
|
+
return /* @__PURE__ */ r(
|
|
291
|
+
"div",
|
|
288
292
|
{
|
|
289
|
-
htmlFor: `${a.id}-${e.value}`,
|
|
290
293
|
title: e.label,
|
|
291
|
-
className:
|
|
292
|
-
"min-w-0 flex-1 cursor-pointer truncate text-sm",
|
|
293
|
-
e.isHeader && "font-semibold uppercase tracking-wide"
|
|
294
|
-
),
|
|
294
|
+
className: "truncate pt-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground",
|
|
295
295
|
children: e.label
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
296
|
+
},
|
|
297
|
+
e.value
|
|
298
|
+
);
|
|
299
|
+
const t = v ? y.includes(e.value) : a.value === e.value;
|
|
300
|
+
return /* @__PURE__ */ r(
|
|
301
|
+
"div",
|
|
300
302
|
{
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
className: N(
|
|
305
|
-
"w-full min-w-0 justify-start",
|
|
306
|
-
e.isHeader && "font-semibold uppercase tracking-wide",
|
|
307
|
-
t && "bg-muted"
|
|
303
|
+
className: S(
|
|
304
|
+
"flex min-w-0 items-center space-x-2",
|
|
305
|
+
e.isFilho && "pl-4"
|
|
308
306
|
),
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
307
|
+
children: v ? /* @__PURE__ */ c(L, { children: [
|
|
308
|
+
/* @__PURE__ */ r(
|
|
309
|
+
ee,
|
|
310
|
+
{
|
|
311
|
+
id: `${a.id}-${e.value}`,
|
|
312
|
+
checked: t,
|
|
313
|
+
onCheckedChange: () => K(e.value)
|
|
314
|
+
}
|
|
315
|
+
),
|
|
316
|
+
/* @__PURE__ */ r(
|
|
317
|
+
"label",
|
|
318
|
+
{
|
|
319
|
+
htmlFor: `${a.id}-${e.value}`,
|
|
320
|
+
title: e.label,
|
|
321
|
+
className: S(
|
|
322
|
+
"min-w-0 flex-1 cursor-pointer truncate text-sm",
|
|
323
|
+
e.isHeader && "font-semibold uppercase tracking-wide"
|
|
324
|
+
),
|
|
325
|
+
children: e.label
|
|
326
|
+
}
|
|
327
|
+
)
|
|
328
|
+
] }) : /* @__PURE__ */ r(
|
|
329
|
+
f,
|
|
330
|
+
{
|
|
331
|
+
variant: "ghost",
|
|
332
|
+
size: "sm",
|
|
333
|
+
title: e.label,
|
|
334
|
+
className: S(
|
|
335
|
+
"w-full min-w-0 justify-start",
|
|
336
|
+
e.isHeader && "font-semibold uppercase tracking-wide",
|
|
337
|
+
t && "bg-muted"
|
|
338
|
+
),
|
|
339
|
+
onClick: () => u({ value: e.value }),
|
|
340
|
+
children: /* @__PURE__ */ r("span", { className: "truncate", children: e.label })
|
|
341
|
+
}
|
|
342
|
+
)
|
|
343
|
+
},
|
|
344
|
+
e.value
|
|
345
|
+
);
|
|
346
|
+
}) })
|
|
347
|
+
] })
|
|
348
|
+
}
|
|
349
|
+
)
|
|
350
|
+
]
|
|
351
|
+
}
|
|
352
|
+
)
|
|
321
353
|
) : (l == null ? void 0 : l.type) === "date" ? (
|
|
322
354
|
// Date picker
|
|
323
355
|
/* @__PURE__ */ r(
|
|
324
|
-
|
|
356
|
+
ae,
|
|
325
357
|
{
|
|
326
358
|
value: a.value ? /* @__PURE__ */ new Date(a.value + "T00:00:00") : void 0,
|
|
327
359
|
onChange: (e) => {
|
|
328
360
|
if (e) {
|
|
329
361
|
const t = e.toISOString().split("T")[0];
|
|
330
|
-
|
|
362
|
+
u({ value: t });
|
|
331
363
|
} else
|
|
332
|
-
|
|
364
|
+
u({ value: "" });
|
|
333
365
|
},
|
|
334
366
|
placeholder: "Selecionar data",
|
|
335
367
|
className: "h-7 text-sm"
|
|
@@ -337,9 +369,9 @@ function Z({
|
|
|
337
369
|
)
|
|
338
370
|
) : (
|
|
339
371
|
// Text/Number input
|
|
340
|
-
/* @__PURE__ */
|
|
341
|
-
/* @__PURE__ */ r(
|
|
342
|
-
|
|
372
|
+
/* @__PURE__ */ c(A, { children: [
|
|
373
|
+
/* @__PURE__ */ r(P, { asChild: !0, children: /* @__PURE__ */ r(
|
|
374
|
+
f,
|
|
343
375
|
{
|
|
344
376
|
variant: "ghost",
|
|
345
377
|
size: "sm",
|
|
@@ -347,14 +379,14 @@ function Z({
|
|
|
347
379
|
children: a.value || "Inserir valor"
|
|
348
380
|
}
|
|
349
381
|
) }),
|
|
350
|
-
/* @__PURE__ */ r(
|
|
351
|
-
/* @__PURE__ */ r(
|
|
382
|
+
/* @__PURE__ */ r(k, { className: "w-[240px] p-3", align: "start", children: /* @__PURE__ */ c("div", { className: "space-y-2", children: [
|
|
383
|
+
/* @__PURE__ */ r(X, { className: "text-xs text-muted-foreground", children: "Inserir valor" }),
|
|
352
384
|
/* @__PURE__ */ r(
|
|
353
|
-
|
|
385
|
+
E,
|
|
354
386
|
{
|
|
355
387
|
type: (l == null ? void 0 : l.type) === "number" ? "number" : "text",
|
|
356
388
|
value: Array.isArray(a.value) ? "" : a.value,
|
|
357
|
-
onChange: (e) =>
|
|
389
|
+
onChange: (e) => u({ value: e.target.value }),
|
|
358
390
|
placeholder: "Digite o valor...",
|
|
359
391
|
autoFocus: !0
|
|
360
392
|
}
|
|
@@ -362,11 +394,11 @@ function Z({
|
|
|
362
394
|
] }) })
|
|
363
395
|
] })
|
|
364
396
|
),
|
|
365
|
-
|
|
397
|
+
v && y.length > 0 && /* @__PURE__ */ r("div", { className: "flex items-center gap-1 flex-wrap", children: y.map((e) => {
|
|
366
398
|
var n;
|
|
367
|
-
const t = ((n =
|
|
368
|
-
return /* @__PURE__ */
|
|
369
|
-
|
|
399
|
+
const t = ((n = N.find((b) => b.value === e)) == null ? void 0 : n.label) || e;
|
|
400
|
+
return /* @__PURE__ */ c(
|
|
401
|
+
F,
|
|
370
402
|
{
|
|
371
403
|
variant: "secondary",
|
|
372
404
|
className: "gap-1 h-6 text-xs",
|
|
@@ -376,10 +408,10 @@ function Z({
|
|
|
376
408
|
"button",
|
|
377
409
|
{
|
|
378
410
|
type: "button",
|
|
379
|
-
onClick: () =>
|
|
411
|
+
onClick: () => Q(e),
|
|
380
412
|
className: "ml-1 rounded-sm hover:bg-muted p-0.5 transition-colors",
|
|
381
413
|
"aria-label": `Remover ${t}`,
|
|
382
|
-
children: /* @__PURE__ */ r(
|
|
414
|
+
children: /* @__PURE__ */ r(j, { className: "h-3 w-3" })
|
|
383
415
|
}
|
|
384
416
|
)
|
|
385
417
|
]
|
|
@@ -390,20 +422,20 @@ function Z({
|
|
|
390
422
|
] })
|
|
391
423
|
] }),
|
|
392
424
|
/* @__PURE__ */ r(
|
|
393
|
-
|
|
425
|
+
f,
|
|
394
426
|
{
|
|
395
427
|
type: "button",
|
|
396
428
|
variant: "ghost",
|
|
397
429
|
size: "sm",
|
|
398
|
-
onClick:
|
|
430
|
+
onClick: i,
|
|
399
431
|
className: "h-9 w-9 p-0 opacity-100 md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100 transition-opacity",
|
|
400
432
|
"aria-label": "Remover condição",
|
|
401
|
-
children: /* @__PURE__ */ r(
|
|
433
|
+
children: /* @__PURE__ */ r(j, { className: "h-4 w-4" })
|
|
402
434
|
}
|
|
403
435
|
)
|
|
404
436
|
] });
|
|
405
437
|
}
|
|
406
438
|
export {
|
|
407
|
-
|
|
439
|
+
be as FilterBuilder
|
|
408
440
|
};
|
|
409
441
|
//# sourceMappingURL=filter-builder.js.map
|