@marimo-team/frontend 0.23.9-dev3 → 0.23.9-dev4
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/assets/{ConnectedDataExplorerComponent-D-boDGAP.js → ConnectedDataExplorerComponent-B-cElX-s.js} +1 -1
- package/dist/assets/{ImperativeModal-DEC1mXgV.js → ImperativeModal-BeQmePpG.js} +1 -1
- package/dist/assets/JsonOutput-BbkJ4c02.js +53 -0
- package/dist/assets/{MarimoErrorOutput-XWqnhvJ6.js → MarimoErrorOutput-ciRhjJM2.js} +1 -1
- package/dist/assets/{RSPContexts-Bk1r00gJ.js → RSPContexts-Clr6RnG2.js} +1 -1
- package/dist/assets/{RunButton-Dbak5hfa.js → RunButton-DySeQPd2.js} +1 -1
- package/dist/assets/{add-cell-with-ai-BbZkMqv2.js → add-cell-with-ai-DKUeTe86.js} +1 -1
- package/dist/assets/{add-connection-dialog-CzxRpS5F.js → add-connection-dialog-DwDtRq10.js} +1 -1
- package/dist/assets/{agent-panel-zPhlhkYL.js → agent-panel-C8Oqvdr5.js} +1 -1
- package/dist/assets/{ai-model-dropdown-CjhUqXgj.js → ai-model-dropdown-Cv4r0gqY.js} +1 -1
- package/dist/assets/{app-config-button-CCs8Jepz.js → app-config-button-rS9K4BOr.js} +1 -1
- package/dist/assets/{cache-panel-VL13fWgF.js → cache-panel-BSlEbX4w.js} +1 -1
- package/dist/assets/{cell-editor-ODyJXDT8.js → cell-editor-DnLtTvEM.js} +3 -3
- package/dist/assets/{cell-link-PQYiMZw1.js → cell-link-f3ZU0MzW.js} +1 -1
- package/dist/assets/{chat-display-DetTBnqK.js → chat-display-B7QE6C2q.js} +1 -1
- package/dist/assets/{chat-panel-CEgw_vg0.js → chat-panel-D11B2Q4F.js} +1 -1
- package/dist/assets/{chat-ui-D-Y7p_cT.js → chat-ui-BwVhfsq2.js} +1 -1
- package/dist/assets/{chunk-5FQGJX7Z-BSzccEgu.js → chunk-5FQGJX7Z-CbuGydc8.js} +3 -3
- package/dist/assets/{code-block-37QAKDTI-U2R1jyOo.js → code-block-37QAKDTI-BwYRrSJW.js} +1 -1
- package/dist/assets/{column-preview-BLIWbdOX.js → column-preview-8cXBINr1.js} +1 -1
- package/dist/assets/command-DUeag2QH.js +1 -0
- package/dist/assets/{command-palette-CeDe63_W.js → command-palette-BlX5QV4R.js} +1 -1
- package/dist/assets/{common-BaBE_ygg.js → common-DAjN54-N.js} +1 -1
- package/dist/assets/dates-DS_7IZoI.js +1 -0
- package/dist/assets/{dependency-graph-panel-ClI5byUa.js → dependency-graph-panel-C7UdKk5P.js} +1 -1
- package/dist/assets/{dist-CW3rweKM.js → dist-DFHp_ZJR.js} +1 -1
- package/dist/assets/{download-B1QFVDP-.js → download-eMMt69Hd.js} +1 -1
- package/dist/assets/{edit-page-ZFpn8-WM.js → edit-page-DoGaZtlD.js} +6 -6
- package/dist/assets/{error-panel-iXznkJZ1.js → error-panel-CkKXrRna.js} +1 -1
- package/dist/assets/{field-DNlzfMKW.js → field-B4CdIHa9.js} +1 -1
- package/dist/assets/{file-explorer-panel-BVBKF1SH.js → file-explorer-panel-BA0aI_q7.js} +3 -3
- package/dist/assets/{file-name-input-g2H2sY2h.js → file-name-input-BpDnZMOs.js} +1 -1
- package/dist/assets/{form-BjUJP6PJ.js → form-z4S7B_rP.js} +1 -1
- package/dist/assets/{gallery-page-MrZHjySE.js → gallery-page-BXZHpNqZ.js} +1 -1
- package/dist/assets/{glide-data-editor-4Wql6uq7.js → glide-data-editor-C5d_9QYv.js} +1 -1
- package/dist/assets/{home-page-De1W6q6f.js → home-page-Cv2KTtQj.js} +1 -1
- package/dist/assets/{hooks-jWLD3t7P.js → hooks-DeuLZEyD.js} +1 -1
- package/dist/assets/{index-ZA7t2ThT.js → index-B5z1LmJ1.js} +19 -19
- package/dist/assets/index-Cn0RBoFD.css +2 -0
- package/dist/assets/{input-CVE-gIjt.js → input-TSilD7AA.js} +1 -1
- package/dist/assets/{layout-DEU6lX-9.js → layout-Dpf6l72t.js} +3 -3
- package/dist/assets/{logs-panel-BMAfoMJg.js → logs-panel-D6VqVLlw.js} +1 -1
- package/dist/assets/{markdown-renderer-BQ-BQLiJ.js → markdown-renderer-l3qZKrTC.js} +3 -3
- package/dist/assets/mermaid-4DMBBIKO-BlSTFoRU.js +1 -0
- package/dist/assets/{mermaid-CZhfODkT.js → mermaid-BpEU2haB.js} +1 -1
- package/dist/assets/{name-cell-input-bwfAyC0i.js → name-cell-input-BmJb1jcI.js} +1 -1
- package/dist/assets/{packages-panel-B3dRYuRM.js → packages-panel-BQJiodre.js} +1 -1
- package/dist/assets/{panels-DWhhEgv4.js → panels-EIGgrBT7.js} +1 -1
- package/dist/assets/{radio-group-rsi1ibXY.js → radio-group-BE0Xe9G9.js} +1 -1
- package/dist/assets/{readonly-python-code-BKYj8PNf.js → readonly-python-code-D3NHaVFs.js} +1 -1
- package/dist/assets/{reveal-component-DNpBzX6F.js → reveal-component-Cy-Nz7JR.js} +1 -1
- package/dist/assets/{run-page-CO2X6wso.js → run-page-IrSzOAx3.js} +1 -1
- package/dist/assets/{scratchpad-panel-CWfddArs.js → scratchpad-panel-DVSB-2ZU.js} +1 -1
- package/dist/assets/{secrets-panel-DqHGq3V8.js → secrets-panel-EMyfZ0xi.js} +1 -1
- package/dist/assets/{session-panel-BP0QxaoM.js → session-panel-BSP3VdpL.js} +1 -1
- package/dist/assets/{snippets-panel-DFJd1ui5.js → snippets-panel-WZ7ZOs2t.js} +1 -1
- package/dist/assets/{state-dx303w7J.js → state-CcAGAozT.js} +1 -1
- package/dist/assets/{state-BXNNuw9g.js → state-KI8ENp1g.js} +1 -1
- package/dist/assets/{tracing-BQU8fBDM.js → tracing-CXaM8i7_.js} +1 -1
- package/dist/assets/{tracing-panel-DEVpyGX3.js → tracing-panel-DcR9ni3B.js} +2 -2
- package/dist/assets/{useCellActionButton-QaDO24oW.js → useCellActionButton-p6Ij9yyu.js} +1 -1
- package/dist/assets/{useDependencyPanelTab-BB_XeSAg.js → useDependencyPanelTab-KDzMTAUI.js} +1 -1
- package/dist/assets/{useNotebookActions-CJEicFed.js → useNotebookActions-COhd0Ld9.js} +1 -1
- package/dist/assets/{vega-component-C9fDGx86.js → vega-component-BGC-ewWV.js} +1 -1
- package/dist/assets/{write-secret-modal-Liv_9MXS.js → write-secret-modal-DcmyNRRr.js} +1 -1
- package/dist/index.html +27 -27
- package/package.json +1 -1
- package/src/components/data-table/__tests__/column-header.test.tsx +110 -277
- package/src/components/data-table/__tests__/date-filter-inputs.test.tsx +33 -0
- package/src/components/data-table/__tests__/filter-pill-editor.test.tsx +75 -38
- package/src/components/data-table/__tests__/filter-pills.test.tsx +287 -0
- package/src/components/data-table/__tests__/filter-test-utils.ts +47 -0
- package/src/components/data-table/__tests__/filters.test.ts +5 -5
- package/src/components/data-table/add-filter-button.tsx +85 -0
- package/src/components/data-table/column-header.tsx +92 -691
- package/src/components/data-table/context-menu.tsx +26 -12
- package/src/components/data-table/data-table.tsx +89 -57
- package/src/components/data-table/date-filter-inputs.tsx +13 -10
- package/src/components/data-table/filter-by-values-picker.tsx +13 -19
- package/src/components/data-table/filter-editor-context.tsx +34 -0
- package/src/components/data-table/filter-pill-editor.tsx +152 -175
- package/src/components/data-table/filter-pills.tsx +190 -153
- package/src/components/data-table/filters/builders.ts +102 -0
- package/src/components/data-table/filters/defaults.ts +31 -0
- package/src/components/data-table/filters/format.ts +131 -0
- package/src/components/data-table/filters/guards.ts +51 -0
- package/src/components/data-table/filters/index.ts +7 -0
- package/src/components/data-table/filters/operators.ts +76 -0
- package/src/components/data-table/filters/serialize.ts +186 -0
- package/src/components/data-table/filters/types.ts +33 -0
- package/src/components/data-table/header-items.tsx +6 -83
- package/src/components/data-table/value-chips.tsx +52 -0
- package/src/components/ui/number-field.tsx +13 -1
- package/src/utils/dates.ts +39 -0
- package/dist/assets/JsonOutput-05-R3eil.js +0 -53
- package/dist/assets/command-2NPJCYDa.js +0 -1
- package/dist/assets/dates-DI1TvEEK.js +0 -1
- package/dist/assets/index-B30qjBZM.css +0 -2
- package/dist/assets/mermaid-4DMBBIKO-C0OyyVdo.js +0 -1
- package/src/components/data-table/__tests__/column-header.test.ts +0 -65
- package/src/components/data-table/filters.ts +0 -386
- /package/dist/assets/{focus-BaOnnMs-.js → focus-BLb-92ed.js} +0 -0
- /package/dist/assets/{formats-BRq458WH.js → formats-DP_z0P-n.js} +0 -0
- /package/dist/assets/{html-to-image-D6SgvARi.js → html-to-image-Ctd6Wpty.js} +0 -0
- /package/dist/assets/{micromark-factory-space-BUQpMdx2.js → micromark-factory-space-bqhKsQDn.js} +0 -0
- /package/dist/assets/{react-resizable-panels.browser.esm-Ce2ksurd.js → react-resizable-panels.browser.esm-BdtIs0E-.js} +0 -0
- /package/dist/assets/{table-DQE9hQzM.js → table-Bgc-inJs.js} +0 -0
- /package/dist/assets/{useAsyncData-C5i0IRVM.js → useAsyncData-Dg8E_bPh.js} +0 -0
|
@@ -2,71 +2,27 @@
|
|
|
2
2
|
"use no memo";
|
|
3
3
|
|
|
4
4
|
import type { Column, Table } from "@tanstack/react-table";
|
|
5
|
-
import {
|
|
6
|
-
EllipsisIcon,
|
|
7
|
-
FilterIcon,
|
|
8
|
-
MinusIcon,
|
|
9
|
-
TextIcon,
|
|
10
|
-
XIcon,
|
|
11
|
-
} from "lucide-react";
|
|
12
|
-
import { useState } from "react";
|
|
5
|
+
import { EllipsisIcon, FilterIcon, ListFilterIcon } from "lucide-react";
|
|
13
6
|
import { useLocale } from "react-aria";
|
|
14
7
|
import {
|
|
15
8
|
DropdownMenu,
|
|
16
9
|
DropdownMenuContent,
|
|
17
10
|
DropdownMenuItem,
|
|
18
|
-
DropdownMenuPortal,
|
|
19
11
|
DropdownMenuSeparator,
|
|
20
|
-
DropdownMenuSub,
|
|
21
|
-
DropdownMenuSubContent,
|
|
22
|
-
DropdownMenuSubTrigger,
|
|
23
12
|
DropdownMenuTrigger,
|
|
24
13
|
} from "@/components/ui/dropdown-menu";
|
|
25
14
|
import type { CalculateTopKRows } from "@/plugins/impl/DataTablePlugin";
|
|
26
|
-
import type { OperatorType } from "@/plugins/impl/data-frames/utils/operators";
|
|
27
|
-
import { logNever } from "@/utils/assertNever";
|
|
28
15
|
import { cn } from "@/utils/cn";
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import { Input } from "../ui/input";
|
|
32
|
-
import { RegexInput } from "./regex-input";
|
|
33
|
-
import { NumberField } from "../ui/number-field";
|
|
34
|
-
import { PopoverClose } from "../ui/popover";
|
|
35
|
-
import {
|
|
36
|
-
Select,
|
|
37
|
-
SelectContent,
|
|
38
|
-
SelectItem,
|
|
39
|
-
SelectTrigger,
|
|
40
|
-
SelectValue,
|
|
41
|
-
} from "../ui/select";
|
|
42
|
-
import { FilterByValuesList } from "./filter-by-values-picker";
|
|
43
|
-
import { OPERATOR_LABELS } from "./operator-labels";
|
|
44
|
-
import {
|
|
45
|
-
type ColumnFilterForType,
|
|
46
|
-
type ColumnFilterValue,
|
|
47
|
-
DATETIME_OPS,
|
|
48
|
-
Filter,
|
|
49
|
-
isDatetimeComparisonOp,
|
|
50
|
-
isNumberComparisonOp,
|
|
51
|
-
isTextScalarOp,
|
|
52
|
-
NUMBER_OPS,
|
|
53
|
-
TEXT_OPS,
|
|
54
|
-
} from "./filters";
|
|
55
|
-
import {
|
|
56
|
-
type DateLikeFilterType,
|
|
57
|
-
DateLikeInput,
|
|
58
|
-
DateLikeRangeInput,
|
|
59
|
-
} from "./date-filter-inputs";
|
|
16
|
+
import { useFilterEditor } from "./filter-editor-context";
|
|
17
|
+
import { EDITABLE_FILTER_TYPES, isMembershipFilterType } from "./filters";
|
|
60
18
|
import {
|
|
61
19
|
ClearFilterMenuItem,
|
|
62
|
-
FilterButtons,
|
|
63
20
|
renderColumnPinning,
|
|
64
21
|
renderColumnWrapping,
|
|
65
22
|
renderCopyColumn,
|
|
66
23
|
renderDataType,
|
|
67
|
-
renderFilterByValues,
|
|
68
24
|
renderFormatOptions,
|
|
69
|
-
|
|
25
|
+
renderSortIcon,
|
|
70
26
|
renderSorts,
|
|
71
27
|
} from "./header-items";
|
|
72
28
|
|
|
@@ -88,11 +44,10 @@ export const DataTableColumnHeader = <TData, TValue>({
|
|
|
88
44
|
subheader,
|
|
89
45
|
justify,
|
|
90
46
|
className,
|
|
91
|
-
calculateTopKRows,
|
|
92
47
|
table,
|
|
93
48
|
}: DataTableColumnHeaderProps<TData, TValue>) => {
|
|
94
|
-
const [isFilterValueOpen, setIsFilterValueOpen] = useState(false);
|
|
95
49
|
const { locale } = useLocale();
|
|
50
|
+
const editor = useFilterEditor();
|
|
96
51
|
|
|
97
52
|
// No header
|
|
98
53
|
if (!header) {
|
|
@@ -116,68 +71,101 @@ export const DataTableColumnHeader = <TData, TValue>({
|
|
|
116
71
|
}
|
|
117
72
|
|
|
118
73
|
const hasFilter = column.getFilterValue() !== undefined;
|
|
74
|
+
const filterType = column.columnDef.meta?.filterType;
|
|
75
|
+
const canEditFilter =
|
|
76
|
+
editor !== null &&
|
|
77
|
+
column.getCanFilter() &&
|
|
78
|
+
filterType !== undefined &&
|
|
79
|
+
EDITABLE_FILTER_TYPES.has(filterType);
|
|
80
|
+
const canFilterByValues =
|
|
81
|
+
canEditFilter &&
|
|
82
|
+
filterType !== undefined &&
|
|
83
|
+
isMembershipFilterType(filterType);
|
|
119
84
|
|
|
120
85
|
return (
|
|
121
|
-
|
|
86
|
+
<div
|
|
87
|
+
className={cn("group flex flex-col my-1 w-full select-none", className)}
|
|
88
|
+
>
|
|
122
89
|
<div
|
|
123
|
-
className={cn(
|
|
90
|
+
className={cn(
|
|
91
|
+
"flex items-center gap-1",
|
|
92
|
+
justify === "right" && "flex-row-reverse",
|
|
93
|
+
justify === "center" && "mx-auto",
|
|
94
|
+
)}
|
|
124
95
|
>
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
96
|
+
{justify === "center" ? (
|
|
97
|
+
<>
|
|
98
|
+
{column.getCanSort() && <SortButton column={column} />}
|
|
99
|
+
{hasFilter && <FilterIndicator />}
|
|
100
|
+
<span>{header}</span>
|
|
101
|
+
</>
|
|
102
|
+
) : (
|
|
103
|
+
<>
|
|
104
|
+
<span>{header}</span>
|
|
105
|
+
{hasFilter && <FilterIndicator />}
|
|
106
|
+
{column.getCanSort() && <SortButton column={column} />}
|
|
107
|
+
</>
|
|
108
|
+
)}
|
|
109
|
+
<DropdownMenu modal={false}>
|
|
110
|
+
<DropdownMenuTrigger asChild={true}>
|
|
111
|
+
<button
|
|
112
|
+
type="button"
|
|
113
|
+
className="inline-flex items-center justify-center h-5 w-5 rounded hover:bg-(--slate-4) text-muted-foreground opacity-0 group-hover:opacity-100 focus:opacity-100 group-focus-within:opacity-100 data-[state=open]:opacity-100 data-[state=open]:text-accent-foreground"
|
|
114
|
+
aria-label="Column options"
|
|
115
|
+
data-testid="data-table-column-menu-button"
|
|
116
|
+
>
|
|
117
|
+
<EllipsisIcon className="h-3.5 w-3.5" />
|
|
118
|
+
</button>
|
|
119
|
+
</DropdownMenuTrigger>
|
|
120
|
+
<DropdownMenuContent align="start">
|
|
121
|
+
{renderDataType(column)}
|
|
122
|
+
{renderSorts(column, table)}
|
|
123
|
+
{renderCopyColumn(column)}
|
|
124
|
+
{renderColumnPinning(column)}
|
|
125
|
+
{renderColumnWrapping(column)}
|
|
126
|
+
{renderFormatOptions(column, locale)}
|
|
127
|
+
{canEditFilter && <DropdownMenuSeparator />}
|
|
128
|
+
{canEditFilter && (
|
|
129
|
+
<DropdownMenuItem
|
|
130
|
+
onSelect={() =>
|
|
131
|
+
editor.requestAddFilter({ columnId: column.id })
|
|
132
|
+
}
|
|
150
133
|
>
|
|
151
|
-
<
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
134
|
+
<FilterIcon className="mo-dropdown-icon" />
|
|
135
|
+
Filter
|
|
136
|
+
</DropdownMenuItem>
|
|
137
|
+
)}
|
|
138
|
+
{canFilterByValues && (
|
|
139
|
+
<DropdownMenuItem
|
|
140
|
+
onSelect={() =>
|
|
141
|
+
editor.requestAddFilter({
|
|
142
|
+
columnId: column.id,
|
|
143
|
+
operator: "in",
|
|
144
|
+
})
|
|
145
|
+
}
|
|
146
|
+
>
|
|
147
|
+
<ListFilterIcon className="mo-dropdown-icon" />
|
|
148
|
+
Filter by values
|
|
149
|
+
</DropdownMenuItem>
|
|
150
|
+
)}
|
|
151
|
+
{hasFilter && <ClearFilterMenuItem column={column} />}
|
|
152
|
+
</DropdownMenuContent>
|
|
153
|
+
</DropdownMenu>
|
|
169
154
|
</div>
|
|
170
|
-
{
|
|
171
|
-
|
|
172
|
-
setIsFilterValueOpen={setIsFilterValueOpen}
|
|
173
|
-
calculateTopKRows={calculateTopKRows}
|
|
174
|
-
column={column}
|
|
175
|
-
/>
|
|
176
|
-
)}
|
|
177
|
-
</>
|
|
155
|
+
{subheader}
|
|
156
|
+
</div>
|
|
178
157
|
);
|
|
179
158
|
};
|
|
180
159
|
|
|
160
|
+
const FilterIndicator = () => (
|
|
161
|
+
<span
|
|
162
|
+
className="inline-flex items-center justify-center h-5 w-5 text-primary"
|
|
163
|
+
aria-label="Column is filtered"
|
|
164
|
+
>
|
|
165
|
+
<FilterIcon className="h-3 w-3" aria-hidden={true} />
|
|
166
|
+
</span>
|
|
167
|
+
);
|
|
168
|
+
|
|
181
169
|
const SortButton = <TData, TValue>({
|
|
182
170
|
column,
|
|
183
171
|
}: {
|
|
@@ -215,594 +203,7 @@ const SortButton = <TData, TValue>({
|
|
|
215
203
|
}
|
|
216
204
|
data-testid="data-table-sort-button"
|
|
217
205
|
>
|
|
218
|
-
{
|
|
206
|
+
{renderSortIcon(column)}
|
|
219
207
|
</button>
|
|
220
208
|
);
|
|
221
209
|
};
|
|
222
|
-
|
|
223
|
-
export function renderMenuItemFilter<TData, TValue>(
|
|
224
|
-
column: Column<TData, TValue>,
|
|
225
|
-
calculateTopKRows?: CalculateTopKRows,
|
|
226
|
-
) {
|
|
227
|
-
const canFilter = column.getCanFilter();
|
|
228
|
-
if (!canFilter) {
|
|
229
|
-
return null;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
const filterType = column.columnDef.meta?.filterType;
|
|
233
|
-
if (!filterType) {
|
|
234
|
-
return null;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
const filterMenuItem = (
|
|
238
|
-
<DropdownMenuSubTrigger>
|
|
239
|
-
<FilterIcon className="mo-dropdown-icon" />
|
|
240
|
-
Filter
|
|
241
|
-
</DropdownMenuSubTrigger>
|
|
242
|
-
);
|
|
243
|
-
|
|
244
|
-
if (filterType === "boolean") {
|
|
245
|
-
return (
|
|
246
|
-
<DropdownMenuSub>
|
|
247
|
-
{filterMenuItem}
|
|
248
|
-
<DropdownMenuPortal>
|
|
249
|
-
<DropdownMenuSubContent>
|
|
250
|
-
<BooleanFilter column={column} />
|
|
251
|
-
</DropdownMenuSubContent>
|
|
252
|
-
</DropdownMenuPortal>
|
|
253
|
-
</DropdownMenuSub>
|
|
254
|
-
);
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
if (filterType === "text") {
|
|
258
|
-
return (
|
|
259
|
-
<DropdownMenuSub>
|
|
260
|
-
{filterMenuItem}
|
|
261
|
-
<DropdownMenuPortal>
|
|
262
|
-
<DropdownMenuSubContent>
|
|
263
|
-
<TextFilterMenu
|
|
264
|
-
column={column}
|
|
265
|
-
calculateTopKRows={calculateTopKRows}
|
|
266
|
-
/>
|
|
267
|
-
</DropdownMenuSubContent>
|
|
268
|
-
</DropdownMenuPortal>
|
|
269
|
-
</DropdownMenuSub>
|
|
270
|
-
);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
if (filterType === "number") {
|
|
274
|
-
return (
|
|
275
|
-
<DropdownMenuSub>
|
|
276
|
-
{filterMenuItem}
|
|
277
|
-
<DropdownMenuPortal>
|
|
278
|
-
<DropdownMenuSubContent>
|
|
279
|
-
<NumberFilterMenu column={column} />
|
|
280
|
-
</DropdownMenuSubContent>
|
|
281
|
-
</DropdownMenuPortal>
|
|
282
|
-
</DropdownMenuSub>
|
|
283
|
-
);
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
if (filterType === "select") {
|
|
287
|
-
// Not implemented
|
|
288
|
-
return null;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
if (
|
|
292
|
-
filterType === "date" ||
|
|
293
|
-
filterType === "datetime" ||
|
|
294
|
-
filterType === "time"
|
|
295
|
-
) {
|
|
296
|
-
return (
|
|
297
|
-
<DropdownMenuSub>
|
|
298
|
-
{filterMenuItem}
|
|
299
|
-
<DropdownMenuPortal>
|
|
300
|
-
<DropdownMenuSubContent>
|
|
301
|
-
<DateFilterMenu column={column} filterType={filterType} />
|
|
302
|
-
</DropdownMenuSubContent>
|
|
303
|
-
</DropdownMenuPortal>
|
|
304
|
-
</DropdownMenuSub>
|
|
305
|
-
);
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
logNever(filterType);
|
|
309
|
-
return null;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
const OperatorSelect = ({
|
|
313
|
-
operator,
|
|
314
|
-
options,
|
|
315
|
-
onChange,
|
|
316
|
-
}: {
|
|
317
|
-
operator: OperatorType;
|
|
318
|
-
options: readonly OperatorType[];
|
|
319
|
-
onChange: (next: OperatorType) => void;
|
|
320
|
-
}) => (
|
|
321
|
-
<Select value={operator} onValueChange={(v) => onChange(v as OperatorType)}>
|
|
322
|
-
<SelectTrigger className="border-border shadow-none! ring-0! w-full mb-0.5">
|
|
323
|
-
<SelectValue />
|
|
324
|
-
</SelectTrigger>
|
|
325
|
-
<SelectContent>
|
|
326
|
-
{options.map((op) => (
|
|
327
|
-
<SelectItem key={op} value={op}>
|
|
328
|
-
{OPERATOR_LABELS[op]}
|
|
329
|
-
</SelectItem>
|
|
330
|
-
))}
|
|
331
|
-
</SelectContent>
|
|
332
|
-
</Select>
|
|
333
|
-
);
|
|
334
|
-
|
|
335
|
-
const BooleanFilter = <TData, TValue>({
|
|
336
|
-
column,
|
|
337
|
-
}: {
|
|
338
|
-
column: Column<TData, TValue>;
|
|
339
|
-
}) => {
|
|
340
|
-
return (
|
|
341
|
-
<>
|
|
342
|
-
<DropdownMenuItem
|
|
343
|
-
onClick={() =>
|
|
344
|
-
column.setFilterValue(
|
|
345
|
-
Filter.boolean({ value: true, operator: "is_true" }),
|
|
346
|
-
)
|
|
347
|
-
}
|
|
348
|
-
>
|
|
349
|
-
True
|
|
350
|
-
</DropdownMenuItem>
|
|
351
|
-
<DropdownMenuItem
|
|
352
|
-
onClick={() =>
|
|
353
|
-
column.setFilterValue(
|
|
354
|
-
Filter.boolean({ value: false, operator: "is_false" }),
|
|
355
|
-
)
|
|
356
|
-
}
|
|
357
|
-
>
|
|
358
|
-
False
|
|
359
|
-
</DropdownMenuItem>
|
|
360
|
-
<DropdownMenuSeparator />
|
|
361
|
-
<DropdownMenuItem
|
|
362
|
-
onClick={() =>
|
|
363
|
-
column.setFilterValue(Filter.boolean({ operator: "is_null" }))
|
|
364
|
-
}
|
|
365
|
-
>
|
|
366
|
-
Is null
|
|
367
|
-
</DropdownMenuItem>
|
|
368
|
-
<DropdownMenuItem
|
|
369
|
-
onClick={() =>
|
|
370
|
-
column.setFilterValue(Filter.boolean({ operator: "is_not_null" }))
|
|
371
|
-
}
|
|
372
|
-
>
|
|
373
|
-
Is not null
|
|
374
|
-
</DropdownMenuItem>
|
|
375
|
-
</>
|
|
376
|
-
);
|
|
377
|
-
};
|
|
378
|
-
|
|
379
|
-
type NumberComparisonFilter = Extract<
|
|
380
|
-
ColumnFilterForType<"number">,
|
|
381
|
-
{ value: number }
|
|
382
|
-
>;
|
|
383
|
-
const isNumberComparisonFilter = (
|
|
384
|
-
filter: ColumnFilterForType<"number">,
|
|
385
|
-
): filter is NumberComparisonFilter => isNumberComparisonOp(filter.operator);
|
|
386
|
-
|
|
387
|
-
export const NumberFilterMenu = <TData, TValue>({
|
|
388
|
-
column,
|
|
389
|
-
}: {
|
|
390
|
-
column: Column<TData, TValue>;
|
|
391
|
-
}) => {
|
|
392
|
-
const currentFilter = column.getFilterValue() as
|
|
393
|
-
| ColumnFilterForType<"number">
|
|
394
|
-
| undefined;
|
|
395
|
-
const hasFilter = currentFilter !== undefined;
|
|
396
|
-
|
|
397
|
-
const [operator, setOperator] = useState<OperatorType>(
|
|
398
|
-
currentFilter?.operator ?? "between",
|
|
399
|
-
);
|
|
400
|
-
const [min, setMin] = useState<number | undefined>(
|
|
401
|
-
currentFilter?.operator === "between" ? currentFilter.min : undefined,
|
|
402
|
-
);
|
|
403
|
-
const [max, setMax] = useState<number | undefined>(
|
|
404
|
-
currentFilter?.operator === "between" ? currentFilter.max : undefined,
|
|
405
|
-
);
|
|
406
|
-
const [value, setValue] = useState<number | undefined>(
|
|
407
|
-
currentFilter !== undefined && isNumberComparisonFilter(currentFilter)
|
|
408
|
-
? currentFilter.value
|
|
409
|
-
: undefined,
|
|
410
|
-
);
|
|
411
|
-
|
|
412
|
-
const isComparison = isNumberComparisonOp(operator);
|
|
413
|
-
const isNullish = operator === "is_null" || operator === "is_not_null";
|
|
414
|
-
|
|
415
|
-
const applyDisabled =
|
|
416
|
-
(operator === "between" && (min === undefined || max === undefined)) ||
|
|
417
|
-
(isComparison && value === undefined);
|
|
418
|
-
|
|
419
|
-
const handleApply = () => {
|
|
420
|
-
if (isNullish) {
|
|
421
|
-
column.setFilterValue(Filter.number({ operator }));
|
|
422
|
-
return;
|
|
423
|
-
}
|
|
424
|
-
if (operator === "between" && min !== undefined && max !== undefined) {
|
|
425
|
-
column.setFilterValue(Filter.number({ operator: "between", min, max }));
|
|
426
|
-
return;
|
|
427
|
-
}
|
|
428
|
-
if (isComparison && value !== undefined) {
|
|
429
|
-
column.setFilterValue(Filter.number({ operator, value }));
|
|
430
|
-
}
|
|
431
|
-
};
|
|
432
|
-
|
|
433
|
-
const handleClear = () => {
|
|
434
|
-
setMin(undefined);
|
|
435
|
-
setMax(undefined);
|
|
436
|
-
setValue(undefined);
|
|
437
|
-
column.setFilterValue(undefined);
|
|
438
|
-
};
|
|
439
|
-
|
|
440
|
-
const handleOperatorChange = (next: OperatorType) => {
|
|
441
|
-
setOperator(next);
|
|
442
|
-
};
|
|
443
|
-
|
|
444
|
-
return (
|
|
445
|
-
<div className="flex flex-col gap-1 pt-3 px-2">
|
|
446
|
-
<OperatorSelect
|
|
447
|
-
operator={operator}
|
|
448
|
-
options={NUMBER_OPS}
|
|
449
|
-
onChange={handleOperatorChange}
|
|
450
|
-
/>
|
|
451
|
-
{operator === "between" && (
|
|
452
|
-
<div className="flex gap-1 items-center">
|
|
453
|
-
<NumberField
|
|
454
|
-
value={min}
|
|
455
|
-
onChange={setMin}
|
|
456
|
-
aria-label="min"
|
|
457
|
-
placeholder="min"
|
|
458
|
-
className="shadow-none! border-border hover:shadow-none!"
|
|
459
|
-
/>
|
|
460
|
-
<MinusIcon className="h-5 w-5 text-muted-foreground" />
|
|
461
|
-
<NumberField
|
|
462
|
-
value={max}
|
|
463
|
-
onChange={setMax}
|
|
464
|
-
aria-label="max"
|
|
465
|
-
placeholder="max"
|
|
466
|
-
className="shadow-none! border-border hover:shadow-none!"
|
|
467
|
-
/>
|
|
468
|
-
</div>
|
|
469
|
-
)}
|
|
470
|
-
{isComparison && (
|
|
471
|
-
<NumberField
|
|
472
|
-
value={value}
|
|
473
|
-
onChange={setValue}
|
|
474
|
-
aria-label="value"
|
|
475
|
-
placeholder="value"
|
|
476
|
-
className="shadow-none! border-border hover:shadow-none!"
|
|
477
|
-
/>
|
|
478
|
-
)}
|
|
479
|
-
<FilterButtons
|
|
480
|
-
onApply={handleApply}
|
|
481
|
-
onClear={handleClear}
|
|
482
|
-
clearButtonDisabled={!hasFilter}
|
|
483
|
-
applyButtonDisabled={applyDisabled}
|
|
484
|
-
/>
|
|
485
|
-
</div>
|
|
486
|
-
);
|
|
487
|
-
};
|
|
488
|
-
|
|
489
|
-
type DateComparisonFilter = Extract<
|
|
490
|
-
ColumnFilterForType<DateLikeFilterType>,
|
|
491
|
-
{ value: Date }
|
|
492
|
-
>;
|
|
493
|
-
const isDateComparisonFilter = (
|
|
494
|
-
filter: ColumnFilterForType<DateLikeFilterType>,
|
|
495
|
-
): filter is DateComparisonFilter => isDatetimeComparisonOp(filter.operator);
|
|
496
|
-
|
|
497
|
-
export const DateFilterMenu = <TData, TValue>({
|
|
498
|
-
column,
|
|
499
|
-
filterType,
|
|
500
|
-
}: {
|
|
501
|
-
column: Column<TData, TValue>;
|
|
502
|
-
filterType: DateLikeFilterType;
|
|
503
|
-
}) => {
|
|
504
|
-
const currentFilter = column.getFilterValue() as
|
|
505
|
-
| ColumnFilterForType<DateLikeFilterType>
|
|
506
|
-
| undefined;
|
|
507
|
-
const hasFilter = currentFilter !== undefined;
|
|
508
|
-
|
|
509
|
-
const [operator, setOperator] = useState<OperatorType>(
|
|
510
|
-
currentFilter?.operator ?? "between",
|
|
511
|
-
);
|
|
512
|
-
const [min, setMin] = useState<Date | undefined>(
|
|
513
|
-
currentFilter?.operator === "between" ? currentFilter.min : undefined,
|
|
514
|
-
);
|
|
515
|
-
const [max, setMax] = useState<Date | undefined>(
|
|
516
|
-
currentFilter?.operator === "between" ? currentFilter.max : undefined,
|
|
517
|
-
);
|
|
518
|
-
const [value, setValue] = useState<Date | undefined>(
|
|
519
|
-
currentFilter !== undefined && isDateComparisonFilter(currentFilter)
|
|
520
|
-
? currentFilter.value
|
|
521
|
-
: undefined,
|
|
522
|
-
);
|
|
523
|
-
|
|
524
|
-
const isComparison = isDatetimeComparisonOp(operator);
|
|
525
|
-
const isNullish = operator === "is_null" || operator === "is_not_null";
|
|
526
|
-
|
|
527
|
-
const applyDisabled =
|
|
528
|
-
(operator === "between" && (min === undefined || max === undefined)) ||
|
|
529
|
-
(isComparison && value === undefined);
|
|
530
|
-
|
|
531
|
-
const buildFilter = (
|
|
532
|
-
opts: Parameters<typeof Filter.date>[0],
|
|
533
|
-
): ColumnFilterForType<DateLikeFilterType> => {
|
|
534
|
-
switch (filterType) {
|
|
535
|
-
case "date":
|
|
536
|
-
return Filter.date(opts);
|
|
537
|
-
case "datetime":
|
|
538
|
-
return Filter.datetime(opts);
|
|
539
|
-
case "time":
|
|
540
|
-
return Filter.time(opts);
|
|
541
|
-
}
|
|
542
|
-
};
|
|
543
|
-
|
|
544
|
-
const handleApply = () => {
|
|
545
|
-
if (isNullish) {
|
|
546
|
-
column.setFilterValue(buildFilter({ operator }));
|
|
547
|
-
return;
|
|
548
|
-
}
|
|
549
|
-
if (operator === "between" && min !== undefined && max !== undefined) {
|
|
550
|
-
column.setFilterValue(buildFilter({ operator: "between", min, max }));
|
|
551
|
-
return;
|
|
552
|
-
}
|
|
553
|
-
if (isComparison && value !== undefined) {
|
|
554
|
-
column.setFilterValue(buildFilter({ operator, value }));
|
|
555
|
-
}
|
|
556
|
-
};
|
|
557
|
-
|
|
558
|
-
const [resetKey, setResetKey] = useState(0);
|
|
559
|
-
const handleClear = () => {
|
|
560
|
-
setMin(undefined);
|
|
561
|
-
setMax(undefined);
|
|
562
|
-
setValue(undefined);
|
|
563
|
-
setResetKey((k) => k + 1);
|
|
564
|
-
column.setFilterValue(undefined);
|
|
565
|
-
};
|
|
566
|
-
|
|
567
|
-
const handleOperatorChange = (next: OperatorType) => {
|
|
568
|
-
setOperator(next);
|
|
569
|
-
};
|
|
570
|
-
|
|
571
|
-
return (
|
|
572
|
-
<div
|
|
573
|
-
className="flex flex-col gap-1 pt-3 px-2"
|
|
574
|
-
onKeyDownCapture={(e) => {
|
|
575
|
-
if (e.key === "Tab") {
|
|
576
|
-
e.stopPropagation();
|
|
577
|
-
}
|
|
578
|
-
}}
|
|
579
|
-
>
|
|
580
|
-
<OperatorSelect
|
|
581
|
-
operator={operator}
|
|
582
|
-
options={DATETIME_OPS}
|
|
583
|
-
onChange={handleOperatorChange}
|
|
584
|
-
/>
|
|
585
|
-
{operator === "between" && (
|
|
586
|
-
<DateLikeRangeInput
|
|
587
|
-
key={`${filterType}-${resetKey}`}
|
|
588
|
-
filterType={filterType}
|
|
589
|
-
min={min}
|
|
590
|
-
max={max}
|
|
591
|
-
onRangeChange={(nextMin, nextMax) => {
|
|
592
|
-
setMin(nextMin);
|
|
593
|
-
setMax(nextMax);
|
|
594
|
-
}}
|
|
595
|
-
className="shadow-none! border-border hover:shadow-none!"
|
|
596
|
-
/>
|
|
597
|
-
)}
|
|
598
|
-
{isComparison && (
|
|
599
|
-
<DateLikeInput
|
|
600
|
-
key={`${filterType}-${resetKey}`}
|
|
601
|
-
filterType={filterType}
|
|
602
|
-
value={value}
|
|
603
|
-
onChange={setValue}
|
|
604
|
-
aria-label="value"
|
|
605
|
-
className="shadow-none! border-border hover:shadow-none!"
|
|
606
|
-
/>
|
|
607
|
-
)}
|
|
608
|
-
<FilterButtons
|
|
609
|
-
onApply={handleApply}
|
|
610
|
-
onClear={handleClear}
|
|
611
|
-
clearButtonDisabled={!hasFilter}
|
|
612
|
-
applyButtonDisabled={applyDisabled}
|
|
613
|
-
/>
|
|
614
|
-
</div>
|
|
615
|
-
);
|
|
616
|
-
};
|
|
617
|
-
|
|
618
|
-
export const TextFilterMenu = <TData, TValue>({
|
|
619
|
-
column,
|
|
620
|
-
calculateTopKRows,
|
|
621
|
-
}: {
|
|
622
|
-
column: Column<TData, TValue>;
|
|
623
|
-
calculateTopKRows?: CalculateTopKRows;
|
|
624
|
-
}) => {
|
|
625
|
-
const currentFilter = column.getFilterValue() as
|
|
626
|
-
| ColumnFilterForType<"text">
|
|
627
|
-
| undefined;
|
|
628
|
-
const hasFilter = currentFilter !== undefined;
|
|
629
|
-
|
|
630
|
-
const [operator, setOperator] = useState<OperatorType>(
|
|
631
|
-
currentFilter?.operator ?? "contains",
|
|
632
|
-
);
|
|
633
|
-
const [text, setText] = useState<string>(
|
|
634
|
-
currentFilter && "text" in currentFilter ? currentFilter.text : "",
|
|
635
|
-
);
|
|
636
|
-
const [values, setValues] = useState<string[]>(
|
|
637
|
-
currentFilter && "values" in currentFilter ? [...currentFilter.values] : [],
|
|
638
|
-
);
|
|
639
|
-
|
|
640
|
-
const isScalar = isTextScalarOp(operator);
|
|
641
|
-
const isMulti = operator === "in" || operator === "not_in";
|
|
642
|
-
const isNullish =
|
|
643
|
-
operator === "is_null" ||
|
|
644
|
-
operator === "is_not_null" ||
|
|
645
|
-
operator === "is_empty";
|
|
646
|
-
|
|
647
|
-
const applyDisabled =
|
|
648
|
-
(isScalar && text === "") || (isMulti && values.length === 0);
|
|
649
|
-
|
|
650
|
-
const handleApply = () => {
|
|
651
|
-
if (isNullish) {
|
|
652
|
-
column.setFilterValue(Filter.text({ operator }));
|
|
653
|
-
return;
|
|
654
|
-
}
|
|
655
|
-
if (isScalar && text !== "") {
|
|
656
|
-
column.setFilterValue(Filter.text({ operator, text }));
|
|
657
|
-
return;
|
|
658
|
-
}
|
|
659
|
-
if (isMulti && values.length > 0) {
|
|
660
|
-
column.setFilterValue(Filter.text({ operator, values }));
|
|
661
|
-
}
|
|
662
|
-
};
|
|
663
|
-
|
|
664
|
-
const handleClear = () => {
|
|
665
|
-
setText("");
|
|
666
|
-
setValues([]);
|
|
667
|
-
column.setFilterValue(undefined);
|
|
668
|
-
};
|
|
669
|
-
|
|
670
|
-
const handleOperatorChange = (next: OperatorType) => {
|
|
671
|
-
setOperator(next);
|
|
672
|
-
};
|
|
673
|
-
|
|
674
|
-
return (
|
|
675
|
-
<div className="flex flex-col gap-1 pt-3 px-2">
|
|
676
|
-
<OperatorSelect
|
|
677
|
-
operator={operator}
|
|
678
|
-
options={TEXT_OPS}
|
|
679
|
-
onChange={handleOperatorChange}
|
|
680
|
-
/>
|
|
681
|
-
{isScalar && operator === "regex" && (
|
|
682
|
-
<RegexInput
|
|
683
|
-
value={text}
|
|
684
|
-
onChange={setText}
|
|
685
|
-
onKeyDown={(e) => {
|
|
686
|
-
e.stopPropagation();
|
|
687
|
-
if (e.key === "Enter") {
|
|
688
|
-
handleApply();
|
|
689
|
-
}
|
|
690
|
-
}}
|
|
691
|
-
/>
|
|
692
|
-
)}
|
|
693
|
-
{isScalar && operator !== "regex" && (
|
|
694
|
-
<Input
|
|
695
|
-
type="text"
|
|
696
|
-
icon={<TextIcon className="h-3 w-3 text-muted-foreground mb-1" />}
|
|
697
|
-
value={text}
|
|
698
|
-
onChange={(e) => setText(e.target.value)}
|
|
699
|
-
placeholder="Text..."
|
|
700
|
-
onKeyDown={(e) => {
|
|
701
|
-
e.stopPropagation();
|
|
702
|
-
if (e.key === "Enter") {
|
|
703
|
-
handleApply();
|
|
704
|
-
}
|
|
705
|
-
}}
|
|
706
|
-
className="shadow-none! border-border hover:shadow-none!"
|
|
707
|
-
/>
|
|
708
|
-
)}
|
|
709
|
-
{isMulti && (
|
|
710
|
-
<FilterByValuesList
|
|
711
|
-
column={column}
|
|
712
|
-
calculateTopKRows={calculateTopKRows}
|
|
713
|
-
chosenValues={new Set(values)}
|
|
714
|
-
onChange={(next) => setValues(next.map(String))}
|
|
715
|
-
creatable={true}
|
|
716
|
-
/>
|
|
717
|
-
)}
|
|
718
|
-
<FilterButtons
|
|
719
|
-
onApply={handleApply}
|
|
720
|
-
onClear={handleClear}
|
|
721
|
-
clearButtonDisabled={!hasFilter}
|
|
722
|
-
applyButtonDisabled={applyDisabled}
|
|
723
|
-
/>
|
|
724
|
-
</div>
|
|
725
|
-
);
|
|
726
|
-
};
|
|
727
|
-
|
|
728
|
-
/**
|
|
729
|
-
* Seed the filter-by-values picker from a column's existing filter value.
|
|
730
|
-
*
|
|
731
|
-
* Reopening the picker should reflect what's already applied. Only `select`
|
|
732
|
-
* filters carry checkbox-style values; other filter shapes (number, text,
|
|
733
|
-
* etc.) seed an empty list.
|
|
734
|
-
*/
|
|
735
|
-
export function seedFromFilter(value: ColumnFilterValue | undefined): {
|
|
736
|
-
values: unknown[];
|
|
737
|
-
operator: Extract<OperatorType, "in" | "not_in">;
|
|
738
|
-
} {
|
|
739
|
-
if (value && "type" in value && value.type === "select") {
|
|
740
|
-
return {
|
|
741
|
-
values: [...value.options],
|
|
742
|
-
operator: value.operator === "not_in" ? "not_in" : "in",
|
|
743
|
-
};
|
|
744
|
-
}
|
|
745
|
-
return { values: [], operator: "in" };
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
const PopoverFilterByValues = <TData, TValue>({
|
|
749
|
-
setIsFilterValueOpen,
|
|
750
|
-
calculateTopKRows,
|
|
751
|
-
column,
|
|
752
|
-
}: {
|
|
753
|
-
setIsFilterValueOpen: (open: boolean) => void;
|
|
754
|
-
calculateTopKRows?: CalculateTopKRows;
|
|
755
|
-
column: Column<TData, TValue>;
|
|
756
|
-
}) => {
|
|
757
|
-
const seed = seedFromFilter(
|
|
758
|
-
column.getFilterValue() as ColumnFilterValue | undefined,
|
|
759
|
-
);
|
|
760
|
-
|
|
761
|
-
const [chosenValues, setChosenValues] = useState<Set<unknown>>(
|
|
762
|
-
() => new Set(seed.values),
|
|
763
|
-
);
|
|
764
|
-
|
|
765
|
-
const handleApply = () => {
|
|
766
|
-
if (chosenValues.size === 0) {
|
|
767
|
-
column.setFilterValue(undefined);
|
|
768
|
-
return;
|
|
769
|
-
}
|
|
770
|
-
column.setFilterValue(
|
|
771
|
-
Filter.select({
|
|
772
|
-
options: [...chosenValues],
|
|
773
|
-
operator: seed.operator,
|
|
774
|
-
}),
|
|
775
|
-
);
|
|
776
|
-
};
|
|
777
|
-
|
|
778
|
-
return (
|
|
779
|
-
<DraggablePopover
|
|
780
|
-
open={true}
|
|
781
|
-
onOpenChange={(open) => !open && setIsFilterValueOpen(false)}
|
|
782
|
-
className="w-80 p-0"
|
|
783
|
-
>
|
|
784
|
-
<PopoverClose className="absolute top-2 right-2">
|
|
785
|
-
<Button
|
|
786
|
-
variant="link"
|
|
787
|
-
size="sm"
|
|
788
|
-
onClick={() => setIsFilterValueOpen(false)}
|
|
789
|
-
>
|
|
790
|
-
<XIcon className="h-4 w-4" />
|
|
791
|
-
</Button>
|
|
792
|
-
</PopoverClose>
|
|
793
|
-
<div className="flex flex-col gap-1.5 py-2">
|
|
794
|
-
<FilterByValuesList
|
|
795
|
-
column={column}
|
|
796
|
-
calculateTopKRows={calculateTopKRows}
|
|
797
|
-
chosenValues={chosenValues}
|
|
798
|
-
onChange={(values) => setChosenValues(new Set(values))}
|
|
799
|
-
/>
|
|
800
|
-
<FilterButtons
|
|
801
|
-
onApply={handleApply}
|
|
802
|
-
onClear={() => setChosenValues(new Set())}
|
|
803
|
-
clearButtonDisabled={chosenValues.size === 0}
|
|
804
|
-
/>
|
|
805
|
-
</div>
|
|
806
|
-
</DraggablePopover>
|
|
807
|
-
);
|
|
808
|
-
};
|