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