@harpercollins/harpercollins-design-system 1.37.0 → 1.38.1
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/.DS_Store +0 -0
- package/dist/cjs/components/data-display/DataGrid/TableToolbar.cjs +26 -3
- package/dist/cjs/components/data-display/DataGrid/filters/FilterComponents.cjs +8 -4
- package/dist/cjs/components/data-display/DataGrid/filters/filterFunctions.cjs +1 -1
- package/dist/cjs/components/data-display/DataGrid/hooks/useDataGrid.cjs +1 -1
- package/dist/cjs/components/data-display/Table/Table.styles.cjs +1 -2
- package/dist/cjs/components/data-display/Table/hooks/useStickyHeader.cjs +1 -1
- package/dist/esm/components/data-display/DataGrid/TableToolbar.js +51 -28
- package/dist/esm/components/data-display/DataGrid/filters/FilterComponents.js +201 -158
- package/dist/esm/components/data-display/DataGrid/filters/filterFunctions.js +29 -21
- package/dist/esm/components/data-display/DataGrid/hooks/useDataGrid.js +27 -26
- package/dist/esm/components/data-display/Table/Table.styles.js +1 -2
- package/dist/esm/components/data-display/Table/hooks/useStickyHeader.js +41 -32
- package/dist/index.d.ts +6 -2
- package/package.json +4 -4
|
@@ -1,153 +1,194 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { faFilter as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { jsx as r, jsxs as m } from "react/jsx-runtime";
|
|
2
|
+
import { faFilter as D } from "../../../../node_modules/.pnpm/@fortawesome_free-solid-svg-icons@6.7.2/node_modules/@fortawesome/free-solid-svg-icons/index.js";
|
|
3
|
+
import i from "react";
|
|
4
|
+
import y from "styled-components";
|
|
5
5
|
import z from "../../../inputs/RadioButton/RadioButton.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import R from "
|
|
6
|
+
import A from "../../../inputs/Textarea/Textarea.js";
|
|
7
|
+
import I from "../../../navigation/Dropdown/Dropdown.js";
|
|
8
|
+
import R from "../../../navigation/Menu/Menu.js";
|
|
9
|
+
import E from "../../Icon/Icon.js";
|
|
9
10
|
import g from "../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Box/Box.js";
|
|
10
11
|
import b from "../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/List/List.js";
|
|
11
|
-
import
|
|
12
|
-
import
|
|
12
|
+
import C from "../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/ListItem/ListItem.js";
|
|
13
|
+
import k from "../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Checkbox/Checkbox.js";
|
|
13
14
|
import x from "../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Input/Input.js";
|
|
14
15
|
import S from "../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Button/Button.js";
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
16
|
+
import T from "../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/Badge/Badge.js";
|
|
17
|
+
import H from "../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/MenuButton/MenuButton.js";
|
|
18
|
+
import M from "../../../../node_modules/.pnpm/@mui_joy@5.0.0-beta.52_@emotion_react@11.14.0_@types_react@18.3.28_react@18.3.1__@emoti_58201694b486b0db36cbf79098c4edaa/node_modules/@mui/joy/IconButton/IconButton.js";
|
|
18
19
|
function V(e) {
|
|
19
|
-
const {
|
|
20
|
-
|
|
20
|
+
const { meta: o } = e.columnDef;
|
|
21
|
+
if (o?.filterLabel) return o.filterLabel;
|
|
22
|
+
const { header: t } = e.columnDef;
|
|
23
|
+
if (typeof t == "string") return t;
|
|
24
|
+
if (typeof t == "function") {
|
|
25
|
+
const l = t({ column: e });
|
|
26
|
+
return typeof l == "string" ? l : e.id;
|
|
27
|
+
}
|
|
28
|
+
return e.id;
|
|
21
29
|
}
|
|
22
|
-
const
|
|
30
|
+
const L = y(g)`
|
|
23
31
|
padding: 12px;
|
|
24
32
|
min-width: 250px;
|
|
25
33
|
display: flex;
|
|
26
34
|
flex-direction: column;
|
|
27
35
|
gap: 12px;
|
|
28
|
-
`,
|
|
36
|
+
`, K = y(g)`
|
|
29
37
|
display: flex;
|
|
30
38
|
justify-content: space-between;
|
|
31
39
|
align-items: center;
|
|
32
40
|
font-weight: 600;
|
|
33
41
|
font-size: 14px;
|
|
34
42
|
margin-bottom: 4px;
|
|
35
|
-
`,
|
|
43
|
+
`, B = y(g)`
|
|
36
44
|
display: flex;
|
|
37
45
|
gap: 8px;
|
|
38
46
|
justify-content: flex-end;
|
|
39
47
|
margin-top: 8px;
|
|
40
48
|
padding-top: 8px;
|
|
41
49
|
border-top: 1px solid var(--palette-divider);
|
|
50
|
+
`, O = y(g)`
|
|
51
|
+
font-size: 12px;
|
|
52
|
+
color: var(--palette-text-tertiary);
|
|
53
|
+
margin-top: -6px;
|
|
42
54
|
`;
|
|
43
55
|
function v({
|
|
44
56
|
column: e,
|
|
45
|
-
onApply:
|
|
46
|
-
onClear:
|
|
47
|
-
children:
|
|
57
|
+
onApply: o,
|
|
58
|
+
onClear: t,
|
|
59
|
+
children: a
|
|
48
60
|
}) {
|
|
49
|
-
|
|
50
|
-
|
|
61
|
+
const l = e.columnDef.meta?.filterHelpText;
|
|
62
|
+
return /* @__PURE__ */ m(L, { children: [
|
|
63
|
+
/* @__PURE__ */ m(K, { children: [
|
|
51
64
|
"Filter by ",
|
|
52
65
|
V(e)
|
|
53
66
|
] }),
|
|
54
|
-
|
|
55
|
-
/* @__PURE__ */
|
|
56
|
-
|
|
67
|
+
a,
|
|
68
|
+
l && /* @__PURE__ */ r(O, { children: l }),
|
|
69
|
+
/* @__PURE__ */ m(B, { children: [
|
|
70
|
+
/* @__PURE__ */ r(
|
|
57
71
|
S,
|
|
58
72
|
{
|
|
59
73
|
"aria-label": "Clear filter",
|
|
60
74
|
size: "sm",
|
|
61
75
|
variant: "plain",
|
|
62
|
-
onClick:
|
|
76
|
+
onClick: t,
|
|
63
77
|
children: "Clear"
|
|
64
78
|
}
|
|
65
79
|
),
|
|
66
|
-
/* @__PURE__ */
|
|
80
|
+
/* @__PURE__ */ r(
|
|
67
81
|
S,
|
|
68
82
|
{
|
|
69
83
|
"aria-label": "Apply filter",
|
|
70
84
|
size: "sm",
|
|
71
85
|
variant: "solid",
|
|
72
86
|
color: "primary",
|
|
73
|
-
onClick:
|
|
87
|
+
onClick: o,
|
|
74
88
|
children: "Apply"
|
|
75
89
|
}
|
|
76
90
|
)
|
|
77
91
|
] })
|
|
78
92
|
] });
|
|
79
93
|
}
|
|
80
|
-
function
|
|
94
|
+
function P({
|
|
81
95
|
column: e,
|
|
82
|
-
onClose:
|
|
96
|
+
onClose: o
|
|
83
97
|
}) {
|
|
84
|
-
const [
|
|
98
|
+
const [t, a] = i.useState(
|
|
85
99
|
e.getFilterValue() ?? ""
|
|
86
|
-
),
|
|
87
|
-
e.setFilterValue(
|
|
100
|
+
), l = () => {
|
|
101
|
+
e.setFilterValue(t || void 0), o?.();
|
|
88
102
|
};
|
|
89
|
-
return /* @__PURE__ */
|
|
90
|
-
|
|
91
|
-
}, children: /* @__PURE__ */
|
|
103
|
+
return /* @__PURE__ */ r(v, { column: e, onApply: l, onClear: () => {
|
|
104
|
+
a(""), e.setFilterValue(void 0);
|
|
105
|
+
}, children: /* @__PURE__ */ r(
|
|
92
106
|
x,
|
|
93
107
|
{
|
|
94
108
|
placeholder: "Search...",
|
|
95
|
-
value:
|
|
96
|
-
onChange: (
|
|
97
|
-
onKeyDown: (
|
|
98
|
-
|
|
109
|
+
value: t,
|
|
110
|
+
onChange: (n) => a(n.target.value),
|
|
111
|
+
onKeyDown: (n) => {
|
|
112
|
+
n.key === "Enter" && l();
|
|
99
113
|
},
|
|
100
114
|
size: "sm",
|
|
101
115
|
autoFocus: !0
|
|
102
116
|
}
|
|
103
117
|
) });
|
|
104
118
|
}
|
|
105
|
-
function
|
|
119
|
+
function j({
|
|
106
120
|
column: e,
|
|
107
|
-
onClose:
|
|
121
|
+
onClose: o
|
|
108
122
|
}) {
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
),
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
r
|
|
123
|
+
const [t, a] = i.useState(
|
|
124
|
+
e.getFilterValue() ?? ""
|
|
125
|
+
), l = () => {
|
|
126
|
+
e.setFilterValue(t.trim() || void 0), o?.();
|
|
127
|
+
};
|
|
128
|
+
return /* @__PURE__ */ r(v, { column: e, onApply: l, onClear: () => {
|
|
129
|
+
a(""), e.setFilterValue(void 0);
|
|
130
|
+
}, children: /* @__PURE__ */ r(
|
|
131
|
+
A,
|
|
132
|
+
{
|
|
133
|
+
placeholder: "One term per line or comma-separated...",
|
|
134
|
+
value: t,
|
|
135
|
+
onChange: (n) => a(n.target.value),
|
|
136
|
+
onKeyDown: (n) => {
|
|
137
|
+
n.key === "Enter" && (n.metaKey || n.ctrlKey) && (n.preventDefault(), l());
|
|
138
|
+
},
|
|
139
|
+
minRows: 3,
|
|
140
|
+
maxRows: 6,
|
|
141
|
+
size: "sm",
|
|
142
|
+
autoFocus: !0
|
|
143
|
+
}
|
|
144
|
+
) });
|
|
145
|
+
}
|
|
146
|
+
function N({
|
|
147
|
+
column: e,
|
|
148
|
+
onClose: o
|
|
149
|
+
}) {
|
|
150
|
+
const t = e.getFilterValue(), [a, l] = i.useState(
|
|
151
|
+
t?.min?.toString() ?? ""
|
|
152
|
+
), [d, n] = i.useState(
|
|
153
|
+
t?.max?.toString() ?? ""
|
|
154
|
+
), f = i.useRef(null);
|
|
155
|
+
i.useEffect(() => {
|
|
115
156
|
f.current?.focus({
|
|
116
157
|
preventScroll: !0
|
|
117
158
|
});
|
|
118
159
|
}, []);
|
|
119
160
|
const c = () => {
|
|
120
|
-
const
|
|
121
|
-
|
|
161
|
+
const p = a ? parseFloat(a) : void 0, u = d ? parseFloat(d) : void 0;
|
|
162
|
+
p !== void 0 || u !== void 0 ? e.setFilterValue({ min: p, max: u }) : e.setFilterValue(void 0), o?.();
|
|
122
163
|
};
|
|
123
|
-
return /* @__PURE__ */
|
|
124
|
-
|
|
164
|
+
return /* @__PURE__ */ r(v, { column: e, onApply: c, onClear: () => {
|
|
165
|
+
l(""), n(""), e.setFilterValue(void 0);
|
|
125
166
|
}, children: /* @__PURE__ */ m(g, { sx: { display: "flex", gap: 1, alignItems: "center" }, children: [
|
|
126
|
-
/* @__PURE__ */
|
|
167
|
+
/* @__PURE__ */ r(
|
|
127
168
|
x,
|
|
128
169
|
{
|
|
129
170
|
slotProps: { input: { ref: f } },
|
|
130
171
|
placeholder: "Min",
|
|
131
172
|
type: "number",
|
|
132
|
-
value:
|
|
133
|
-
onChange: (
|
|
134
|
-
onKeyDown: (
|
|
135
|
-
|
|
173
|
+
value: a,
|
|
174
|
+
onChange: (p) => l(p.target.value),
|
|
175
|
+
onKeyDown: (p) => {
|
|
176
|
+
p.key === "Enter" && c();
|
|
136
177
|
},
|
|
137
178
|
size: "sm",
|
|
138
179
|
sx: { flex: 1 }
|
|
139
180
|
}
|
|
140
181
|
),
|
|
141
|
-
/* @__PURE__ */
|
|
142
|
-
/* @__PURE__ */
|
|
182
|
+
/* @__PURE__ */ r("span", { children: "-" }),
|
|
183
|
+
/* @__PURE__ */ r(
|
|
143
184
|
x,
|
|
144
185
|
{
|
|
145
186
|
placeholder: "Max",
|
|
146
187
|
type: "number",
|
|
147
188
|
value: d,
|
|
148
|
-
onChange: (
|
|
149
|
-
onKeyDown: (
|
|
150
|
-
|
|
189
|
+
onChange: (p) => n(p.target.value),
|
|
190
|
+
onKeyDown: (p) => {
|
|
191
|
+
p.key === "Enter" && c();
|
|
151
192
|
},
|
|
152
193
|
size: "sm",
|
|
153
194
|
sx: { flex: 1 }
|
|
@@ -155,26 +196,26 @@ function O({
|
|
|
155
196
|
)
|
|
156
197
|
] }) });
|
|
157
198
|
}
|
|
158
|
-
function
|
|
199
|
+
function W({
|
|
159
200
|
column: e,
|
|
160
|
-
onClose:
|
|
201
|
+
onClose: o
|
|
161
202
|
}) {
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
), [d,
|
|
165
|
-
|
|
166
|
-
), f =
|
|
167
|
-
|
|
203
|
+
const t = e.getFilterValue(), [a, l] = i.useState(
|
|
204
|
+
t?.start ? t.start.toISOString().split("T")[0] : ""
|
|
205
|
+
), [d, n] = i.useState(
|
|
206
|
+
t?.end ? t.end.toISOString().split("T")[0] : ""
|
|
207
|
+
), f = i.useRef(null), c = i.useRef(null);
|
|
208
|
+
i.useEffect(() => {
|
|
168
209
|
c.current?.focus({
|
|
169
210
|
preventScroll: !0
|
|
170
211
|
});
|
|
171
212
|
}, []);
|
|
172
|
-
const
|
|
173
|
-
const u =
|
|
174
|
-
u !== void 0 ||
|
|
213
|
+
const s = () => {
|
|
214
|
+
const u = a ? new Date(a) : void 0, F = d ? new Date(d) : void 0;
|
|
215
|
+
u !== void 0 || F !== void 0 ? e.setFilterValue({ start: u, end: F }) : e.setFilterValue(void 0), o?.();
|
|
175
216
|
};
|
|
176
|
-
return /* @__PURE__ */
|
|
177
|
-
|
|
217
|
+
return /* @__PURE__ */ r(v, { column: e, onApply: s, onClear: () => {
|
|
218
|
+
l(""), n(""), e.setFilterValue(void 0);
|
|
178
219
|
}, children: /* @__PURE__ */ m(
|
|
179
220
|
g,
|
|
180
221
|
{
|
|
@@ -190,15 +231,15 @@ function P({
|
|
|
190
231
|
}
|
|
191
232
|
},
|
|
192
233
|
children: [
|
|
193
|
-
/* @__PURE__ */
|
|
234
|
+
/* @__PURE__ */ r(
|
|
194
235
|
x,
|
|
195
236
|
{
|
|
196
237
|
type: "date",
|
|
197
|
-
value:
|
|
238
|
+
value: a,
|
|
198
239
|
ref: c,
|
|
199
|
-
onChange: (u) =>
|
|
240
|
+
onChange: (u) => l(u.target.value),
|
|
200
241
|
onKeyDown: (u) => {
|
|
201
|
-
u.key === "Enter" &&
|
|
242
|
+
u.key === "Enter" && s();
|
|
202
243
|
},
|
|
203
244
|
size: "sm",
|
|
204
245
|
slotProps: {
|
|
@@ -209,14 +250,14 @@ function P({
|
|
|
209
250
|
autoFocus: !0
|
|
210
251
|
}
|
|
211
252
|
),
|
|
212
|
-
/* @__PURE__ */
|
|
253
|
+
/* @__PURE__ */ r(
|
|
213
254
|
x,
|
|
214
255
|
{
|
|
215
256
|
type: "date",
|
|
216
257
|
value: d,
|
|
217
|
-
onChange: (u) =>
|
|
258
|
+
onChange: (u) => n(u.target.value),
|
|
218
259
|
onKeyDown: (u) => {
|
|
219
|
-
u.key === "Enter" &&
|
|
260
|
+
u.key === "Enter" && s();
|
|
220
261
|
},
|
|
221
262
|
size: "sm",
|
|
222
263
|
slotProps: {
|
|
@@ -230,35 +271,35 @@ function P({
|
|
|
230
271
|
}
|
|
231
272
|
) });
|
|
232
273
|
}
|
|
233
|
-
function
|
|
274
|
+
function _({
|
|
234
275
|
column: e,
|
|
235
|
-
options:
|
|
236
|
-
searchable:
|
|
237
|
-
onClose:
|
|
276
|
+
options: o,
|
|
277
|
+
searchable: t = !1,
|
|
278
|
+
onClose: a
|
|
238
279
|
}) {
|
|
239
|
-
const [
|
|
280
|
+
const [l, d] = i.useState(
|
|
240
281
|
e.getFilterValue() ?? ""
|
|
241
|
-
), [
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
}, [
|
|
245
|
-
const
|
|
246
|
-
() =>
|
|
247
|
-
(h) => h.label.toLowerCase().includes(
|
|
248
|
-
) :
|
|
249
|
-
[
|
|
282
|
+
), [n, f] = i.useState(""), c = i.useRef(null), s = i.useRef(null);
|
|
283
|
+
i.useEffect(() => {
|
|
284
|
+
t ? c.current?.focus({ preventScroll: !0 }) : s.current?.focus({ preventScroll: !0 });
|
|
285
|
+
}, [t]);
|
|
286
|
+
const p = i.useMemo(
|
|
287
|
+
() => n ? o.filter(
|
|
288
|
+
(h) => h.label.toLowerCase().includes(n.toLowerCase())
|
|
289
|
+
) : o,
|
|
290
|
+
[o, n]
|
|
250
291
|
);
|
|
251
292
|
return /* @__PURE__ */ m(v, { column: e, onApply: () => {
|
|
252
|
-
e.setFilterValue(
|
|
293
|
+
e.setFilterValue(l || void 0), a?.();
|
|
253
294
|
}, onClear: () => {
|
|
254
295
|
d(""), f(""), e.setFilterValue(void 0);
|
|
255
296
|
}, children: [
|
|
256
|
-
|
|
297
|
+
t && /* @__PURE__ */ r(
|
|
257
298
|
x,
|
|
258
299
|
{
|
|
259
300
|
slotProps: { input: { ref: c } },
|
|
260
301
|
placeholder: "Search...",
|
|
261
|
-
value:
|
|
302
|
+
value: n,
|
|
262
303
|
onChange: (h) => f(h.target.value),
|
|
263
304
|
size: "sm"
|
|
264
305
|
}
|
|
@@ -266,30 +307,30 @@ function j({
|
|
|
266
307
|
/* @__PURE__ */ m(
|
|
267
308
|
b,
|
|
268
309
|
{
|
|
269
|
-
ref:
|
|
310
|
+
ref: s,
|
|
270
311
|
component: "ul",
|
|
271
312
|
size: "sm",
|
|
272
313
|
role: "group",
|
|
273
314
|
tabIndex: 0,
|
|
274
315
|
sx: {
|
|
275
|
-
maxHeight:
|
|
316
|
+
maxHeight: t ? "200px" : "240px",
|
|
276
317
|
overflowY: "auto",
|
|
277
318
|
outline: "none",
|
|
278
319
|
"&:focus": { outline: "none" }
|
|
279
320
|
},
|
|
280
321
|
children: [
|
|
281
|
-
|
|
282
|
-
|
|
322
|
+
p.map((h) => /* @__PURE__ */ r(
|
|
323
|
+
C,
|
|
283
324
|
{
|
|
284
325
|
component: "li",
|
|
285
326
|
sx: { paddingLeft: 0, paddingTop: 0 },
|
|
286
|
-
children: /* @__PURE__ */
|
|
327
|
+
children: /* @__PURE__ */ r(
|
|
287
328
|
z,
|
|
288
329
|
{
|
|
289
330
|
value: h.value,
|
|
290
331
|
label: h.label,
|
|
291
332
|
size: "sm",
|
|
292
|
-
checked:
|
|
333
|
+
checked: l === h.value,
|
|
293
334
|
onChange: (w) => d(w.target.value),
|
|
294
335
|
sx: {
|
|
295
336
|
width: "100%"
|
|
@@ -299,33 +340,33 @@ function j({
|
|
|
299
340
|
},
|
|
300
341
|
h.value
|
|
301
342
|
)),
|
|
302
|
-
|
|
343
|
+
p.length === 0 && /* @__PURE__ */ r(C, { component: "li", sx: { color: "text.tertiary" }, children: "No options match" })
|
|
303
344
|
]
|
|
304
345
|
}
|
|
305
346
|
)
|
|
306
347
|
] });
|
|
307
348
|
}
|
|
308
|
-
function
|
|
349
|
+
function Y({
|
|
309
350
|
column: e,
|
|
310
|
-
options:
|
|
311
|
-
onClose:
|
|
351
|
+
options: o,
|
|
352
|
+
onClose: t
|
|
312
353
|
}) {
|
|
313
|
-
const [
|
|
354
|
+
const [a, l] = i.useState(
|
|
314
355
|
e.getFilterValue() ?? []
|
|
315
|
-
), d =
|
|
316
|
-
|
|
356
|
+
), d = i.useRef(null);
|
|
357
|
+
i.useEffect(() => {
|
|
317
358
|
d.current?.focus();
|
|
318
359
|
}, []);
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
(
|
|
360
|
+
const n = (s) => {
|
|
361
|
+
l(
|
|
362
|
+
(p) => p.includes(s) ? p.filter((u) => u !== s) : [...p, s]
|
|
322
363
|
);
|
|
323
364
|
};
|
|
324
|
-
return /* @__PURE__ */
|
|
325
|
-
e.setFilterValue(
|
|
365
|
+
return /* @__PURE__ */ r(v, { column: e, onApply: () => {
|
|
366
|
+
e.setFilterValue(a.length > 0 ? a : void 0), t?.();
|
|
326
367
|
}, onClear: () => {
|
|
327
|
-
|
|
328
|
-
}, children: /* @__PURE__ */
|
|
368
|
+
l([]), e.setFilterValue(void 0);
|
|
369
|
+
}, children: /* @__PURE__ */ r(
|
|
329
370
|
b,
|
|
330
371
|
{
|
|
331
372
|
ref: d,
|
|
@@ -341,49 +382,50 @@ function N({
|
|
|
341
382
|
outline: "none"
|
|
342
383
|
}
|
|
343
384
|
},
|
|
344
|
-
children:
|
|
345
|
-
|
|
385
|
+
children: o.map((s) => /* @__PURE__ */ r(
|
|
386
|
+
C,
|
|
346
387
|
{
|
|
347
388
|
component: "li",
|
|
348
389
|
sx: { paddingLeft: 0, paddingTop: 0 },
|
|
349
|
-
children: /* @__PURE__ */
|
|
350
|
-
|
|
390
|
+
children: /* @__PURE__ */ r(
|
|
391
|
+
k,
|
|
351
392
|
{
|
|
352
|
-
label:
|
|
353
|
-
checked:
|
|
354
|
-
onChange: () =>
|
|
393
|
+
label: s.label,
|
|
394
|
+
checked: a.includes(s.value),
|
|
395
|
+
onChange: () => n(s.value),
|
|
355
396
|
size: "sm",
|
|
356
397
|
sx: {
|
|
357
398
|
width: "100%"
|
|
358
399
|
}
|
|
359
400
|
},
|
|
360
|
-
|
|
401
|
+
s.value
|
|
361
402
|
)
|
|
362
403
|
},
|
|
363
|
-
|
|
404
|
+
s.value
|
|
364
405
|
))
|
|
365
406
|
}
|
|
366
407
|
) });
|
|
367
408
|
}
|
|
368
|
-
const
|
|
369
|
-
text:
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
409
|
+
const $ = {
|
|
410
|
+
text: P,
|
|
411
|
+
textarea: j,
|
|
412
|
+
number: N,
|
|
413
|
+
date: W,
|
|
414
|
+
select: _,
|
|
415
|
+
multiselect: Y
|
|
374
416
|
};
|
|
375
|
-
function
|
|
417
|
+
function ue({
|
|
376
418
|
column: e,
|
|
377
|
-
filterType:
|
|
378
|
-
filterOptions:
|
|
379
|
-
filterSearchable:
|
|
419
|
+
filterType: o = "text",
|
|
420
|
+
filterOptions: t = [],
|
|
421
|
+
filterSearchable: a
|
|
380
422
|
}) {
|
|
381
|
-
const [
|
|
423
|
+
const [l, d] = i.useState(!1), n = () => {
|
|
382
424
|
d(!1);
|
|
383
|
-
}, f =
|
|
384
|
-
return /* @__PURE__ */ m(
|
|
385
|
-
/* @__PURE__ */
|
|
386
|
-
|
|
425
|
+
}, f = $[o];
|
|
426
|
+
return /* @__PURE__ */ m(I, { open: l, onOpenChange: (c, s) => d(s), children: [
|
|
427
|
+
/* @__PURE__ */ r(
|
|
428
|
+
T,
|
|
387
429
|
{
|
|
388
430
|
badgeContent: "",
|
|
389
431
|
invisible: !e.getIsFiltered(),
|
|
@@ -398,13 +440,13 @@ function ae({
|
|
|
398
440
|
borderRadius: "50%"
|
|
399
441
|
}
|
|
400
442
|
},
|
|
401
|
-
children: /* @__PURE__ */
|
|
402
|
-
|
|
443
|
+
children: /* @__PURE__ */ r(
|
|
444
|
+
H,
|
|
403
445
|
{
|
|
404
446
|
"aria-label": `${e.getIsFiltered() ? "Filtered" : "Filter"} by ${V(
|
|
405
447
|
e
|
|
406
448
|
)}`,
|
|
407
|
-
slots: { root:
|
|
449
|
+
slots: { root: M },
|
|
408
450
|
slotProps: {
|
|
409
451
|
root: {
|
|
410
452
|
size: "sm",
|
|
@@ -425,28 +467,29 @@ function ae({
|
|
|
425
467
|
}
|
|
426
468
|
}
|
|
427
469
|
},
|
|
428
|
-
children: /* @__PURE__ */
|
|
470
|
+
children: /* @__PURE__ */ r(E, { icon: D, size: "xs" })
|
|
429
471
|
}
|
|
430
472
|
)
|
|
431
473
|
}
|
|
432
474
|
),
|
|
433
|
-
/* @__PURE__ */
|
|
475
|
+
/* @__PURE__ */ r(R, { placement: "bottom-start", children: /* @__PURE__ */ r(
|
|
434
476
|
f,
|
|
435
477
|
{
|
|
436
478
|
column: e,
|
|
437
|
-
onClose:
|
|
438
|
-
options:
|
|
439
|
-
searchable:
|
|
479
|
+
onClose: n,
|
|
480
|
+
options: t,
|
|
481
|
+
searchable: a
|
|
440
482
|
}
|
|
441
483
|
) })
|
|
442
484
|
] });
|
|
443
485
|
}
|
|
444
486
|
export {
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
487
|
+
ue as ColumnFilter,
|
|
488
|
+
W as DateFilter,
|
|
489
|
+
Y as MultiSelectFilter,
|
|
490
|
+
N as NumericFilter,
|
|
491
|
+
_ as SelectFilter,
|
|
492
|
+
j as TextAreaFilter,
|
|
493
|
+
P as TextFilter,
|
|
494
|
+
$ as filterComponentMap
|
|
452
495
|
};
|
|
@@ -1,36 +1,44 @@
|
|
|
1
|
-
const l = (
|
|
2
|
-
const e =
|
|
1
|
+
const l = (s, i, r) => {
|
|
2
|
+
const e = s.getValue(i);
|
|
3
3
|
if (e == null) return !1;
|
|
4
|
-
const t = String(e).toLowerCase(),
|
|
5
|
-
return t.includes(
|
|
6
|
-
}, a = (
|
|
7
|
-
const e =
|
|
4
|
+
const t = String(e).toLowerCase(), u = String(r).toLowerCase();
|
|
5
|
+
return t.includes(u);
|
|
6
|
+
}, a = (s, i, r) => {
|
|
7
|
+
const e = s.getValue(i);
|
|
8
|
+
if (e == null) return !1;
|
|
9
|
+
const t = String(r).split(/[\n,]/).map((n) => n.trim().toLowerCase()).filter((n) => n.length > 0);
|
|
10
|
+
if (t.length === 0) return !0;
|
|
11
|
+
const u = String(e).toLowerCase();
|
|
12
|
+
return t.some((n) => u.includes(n));
|
|
13
|
+
}, o = (s, i, r) => {
|
|
14
|
+
const e = s.getValue(i);
|
|
8
15
|
if (e == null) return !1;
|
|
9
16
|
const t = Number(e);
|
|
10
17
|
if (Number.isNaN(t)) return !1;
|
|
11
|
-
const { min:
|
|
12
|
-
return
|
|
13
|
-
},
|
|
14
|
-
const e =
|
|
18
|
+
const { min: u, max: n } = r;
|
|
19
|
+
return u !== void 0 && n !== void 0 ? t >= u && t <= n : u !== void 0 ? t >= u : n !== void 0 ? t <= n : !0;
|
|
20
|
+
}, c = (s, i, r) => {
|
|
21
|
+
const e = s.getValue(i);
|
|
15
22
|
if (e == null) return !1;
|
|
16
23
|
const t = e instanceof Date ? e : new Date(e);
|
|
17
24
|
if (Number.isNaN(t.getTime())) return !1;
|
|
18
|
-
const { start:
|
|
19
|
-
return
|
|
20
|
-
},
|
|
21
|
-
const e =
|
|
25
|
+
const { start: u, end: n } = r;
|
|
26
|
+
return u && n ? t >= u && t <= n : u ? t >= u : n ? t <= n : !0;
|
|
27
|
+
}, f = (s, i, r) => {
|
|
28
|
+
const e = s.getValue(i);
|
|
22
29
|
if (e == null) return !1;
|
|
23
30
|
const t = String(e);
|
|
24
31
|
return Array.isArray(r) ? r.length === 0 || r.includes(t) : r ? t === r : !0;
|
|
25
|
-
},
|
|
32
|
+
}, g = (s, i, r) => {
|
|
26
33
|
if (!Array.isArray(r) || r.length === 0) return !0;
|
|
27
|
-
const e =
|
|
34
|
+
const e = s.getValue(i);
|
|
28
35
|
return e == null ? !1 : r.includes(String(e));
|
|
29
36
|
};
|
|
30
37
|
export {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
l as textFilter
|
|
38
|
+
c as dateFilter,
|
|
39
|
+
g as multiSelectFilter,
|
|
40
|
+
o as numericFilter,
|
|
41
|
+
f as selectFilter,
|
|
42
|
+
l as textFilter,
|
|
43
|
+
a as textareaFilter
|
|
36
44
|
};
|