@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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./react-Bj1aDYRI.js";import"./jsx-runtime-BqBOg78p.js";import"./cjs-BRGiG41H.js";import{a as r}from"./chunk-5FQGJX7Z-BSzccEgu.js";export{r as Mermaid};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
-
|
|
3
|
-
import { describe, expect, it } from "vitest";
|
|
4
|
-
import { seedFromFilter } from "../column-header";
|
|
5
|
-
import { Filter } from "../filters";
|
|
6
|
-
|
|
7
|
-
describe("seedFromFilter", () => {
|
|
8
|
-
it("returns empty defaults when there is no filter", () => {
|
|
9
|
-
expect(seedFromFilter(undefined)).toEqual({
|
|
10
|
-
values: [],
|
|
11
|
-
operator: "in",
|
|
12
|
-
});
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it("seeds values from an `in` select filter", () => {
|
|
16
|
-
const filter = Filter.select({
|
|
17
|
-
options: ["Flying", "Ground"],
|
|
18
|
-
operator: "in",
|
|
19
|
-
});
|
|
20
|
-
expect(seedFromFilter(filter)).toEqual({
|
|
21
|
-
values: ["Flying", "Ground"],
|
|
22
|
-
operator: "in",
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it("preserves `not_in` so reapplying does not silently flip to `in`", () => {
|
|
27
|
-
const filter = Filter.select({
|
|
28
|
-
options: ["Fire"],
|
|
29
|
-
operator: "not_in",
|
|
30
|
-
});
|
|
31
|
-
expect(seedFromFilter(filter)).toEqual({
|
|
32
|
-
values: ["Fire"],
|
|
33
|
-
operator: "not_in",
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it("returns a fresh array (callers may mutate without affecting the filter)", () => {
|
|
38
|
-
const options = ["a", "b"];
|
|
39
|
-
const filter = Filter.select({ options, operator: "in" });
|
|
40
|
-
const seeded = seedFromFilter(filter);
|
|
41
|
-
seeded.values.push("c");
|
|
42
|
-
expect(options).toEqual(["a", "b"]);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it("ignores non-select filters and falls back to defaults", () => {
|
|
46
|
-
expect(
|
|
47
|
-
seedFromFilter(Filter.text({ text: "abc", operator: "equals" })),
|
|
48
|
-
).toEqual({
|
|
49
|
-
values: [],
|
|
50
|
-
operator: "in",
|
|
51
|
-
});
|
|
52
|
-
expect(
|
|
53
|
-
seedFromFilter(Filter.number({ operator: "between", min: 0, max: 10 })),
|
|
54
|
-
).toEqual({
|
|
55
|
-
values: [],
|
|
56
|
-
operator: "in",
|
|
57
|
-
});
|
|
58
|
-
expect(
|
|
59
|
-
seedFromFilter(Filter.boolean({ value: true, operator: "is_true" })),
|
|
60
|
-
).toEqual({
|
|
61
|
-
values: [],
|
|
62
|
-
operator: "in",
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
});
|
|
@@ -1,386 +0,0 @@
|
|
|
1
|
-
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
-
"use no memo";
|
|
3
|
-
|
|
4
|
-
import type { ColumnFiltersState, RowData } from "@tanstack/react-table";
|
|
5
|
-
import type { DataType } from "@/core/kernel/messages";
|
|
6
|
-
import type {
|
|
7
|
-
FilterConditionType,
|
|
8
|
-
FilterGroupType,
|
|
9
|
-
} from "@/plugins/impl/data-frames/schema";
|
|
10
|
-
import type { ColumnId } from "@/plugins/impl/data-frames/types";
|
|
11
|
-
import type { OperatorType } from "@/plugins/impl/data-frames/utils/operators";
|
|
12
|
-
import { assertNever } from "@/utils/assertNever";
|
|
13
|
-
import { Logger } from "@/utils/Logger";
|
|
14
|
-
|
|
15
|
-
declare module "@tanstack/react-table" {
|
|
16
|
-
//allows us to define custom properties for our columns
|
|
17
|
-
interface ColumnMeta<TData extends RowData, TValue> {
|
|
18
|
-
rowHeader?: boolean;
|
|
19
|
-
dtype?: string;
|
|
20
|
-
dataType?: DataType;
|
|
21
|
-
filterType?: FilterType;
|
|
22
|
-
minFractionDigits?: number;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export type FilterType =
|
|
27
|
-
| "text"
|
|
28
|
-
| "number"
|
|
29
|
-
| "date"
|
|
30
|
-
| "datetime"
|
|
31
|
-
| "time"
|
|
32
|
-
| "select"
|
|
33
|
-
| "boolean";
|
|
34
|
-
|
|
35
|
-
export const NULLISH_OPS = ["is_null", "is_not_null"] as const;
|
|
36
|
-
export const MEMBERSHIP_OPS = ["in", "not_in"] as const;
|
|
37
|
-
export const NUMBER_COMPARISON_OPS = [
|
|
38
|
-
"==",
|
|
39
|
-
"!=",
|
|
40
|
-
">",
|
|
41
|
-
">=",
|
|
42
|
-
"<",
|
|
43
|
-
"<=",
|
|
44
|
-
] as const;
|
|
45
|
-
export const TEXT_SCALAR_OPS = [
|
|
46
|
-
"contains",
|
|
47
|
-
"equals",
|
|
48
|
-
"does_not_equal",
|
|
49
|
-
"regex",
|
|
50
|
-
"starts_with",
|
|
51
|
-
"ends_with",
|
|
52
|
-
] as const;
|
|
53
|
-
|
|
54
|
-
export const DATETIME_COMPARISON_OPS = [
|
|
55
|
-
"==",
|
|
56
|
-
"!=",
|
|
57
|
-
">",
|
|
58
|
-
">=",
|
|
59
|
-
"<",
|
|
60
|
-
"<=",
|
|
61
|
-
] as const;
|
|
62
|
-
|
|
63
|
-
export const NUMBER_OPS = [
|
|
64
|
-
"between",
|
|
65
|
-
...NUMBER_COMPARISON_OPS,
|
|
66
|
-
...NULLISH_OPS,
|
|
67
|
-
] as const;
|
|
68
|
-
export const TEXT_OPS = [
|
|
69
|
-
...TEXT_SCALAR_OPS,
|
|
70
|
-
...MEMBERSHIP_OPS,
|
|
71
|
-
"is_empty",
|
|
72
|
-
...NULLISH_OPS,
|
|
73
|
-
] as const;
|
|
74
|
-
export const DATETIME_OPS = [
|
|
75
|
-
"between",
|
|
76
|
-
...DATETIME_COMPARISON_OPS,
|
|
77
|
-
...NULLISH_OPS,
|
|
78
|
-
] as const;
|
|
79
|
-
|
|
80
|
-
export type NullishOp = (typeof NULLISH_OPS)[number];
|
|
81
|
-
export type MembershipOp = (typeof MEMBERSHIP_OPS)[number];
|
|
82
|
-
export type NumberComparisonOp = (typeof NUMBER_COMPARISON_OPS)[number];
|
|
83
|
-
export type TextScalarOp = (typeof TEXT_SCALAR_OPS)[number];
|
|
84
|
-
export type DatetimeComparisonOp = (typeof DATETIME_COMPARISON_OPS)[number];
|
|
85
|
-
|
|
86
|
-
const makeOpGuard = <T extends OperatorType>(ops: readonly T[]) => {
|
|
87
|
-
const set = new Set<OperatorType>(ops);
|
|
88
|
-
return (op: OperatorType): op is T => set.has(op);
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
export const isNumberComparisonOp = makeOpGuard(NUMBER_COMPARISON_OPS);
|
|
92
|
-
export const isTextScalarOp = makeOpGuard(TEXT_SCALAR_OPS);
|
|
93
|
-
export const isDatetimeComparisonOp = makeOpGuard(DATETIME_COMPARISON_OPS);
|
|
94
|
-
|
|
95
|
-
interface NullishOpts {
|
|
96
|
-
operator: NullishOp;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
type NumberFilterOpts =
|
|
100
|
-
| { operator: "between"; min: number; max: number }
|
|
101
|
-
| { operator: NumberComparisonOp; value: number }
|
|
102
|
-
| NullishOpts;
|
|
103
|
-
|
|
104
|
-
type TextFilterOpts =
|
|
105
|
-
| { operator: TextScalarOp; text: string }
|
|
106
|
-
| { operator: MembershipOp; values: string[] }
|
|
107
|
-
| { operator: "is_empty" }
|
|
108
|
-
| NullishOpts;
|
|
109
|
-
|
|
110
|
-
type DateLikeFilterOpts =
|
|
111
|
-
| { operator: "between"; min: Date; max: Date }
|
|
112
|
-
| { operator: DatetimeComparisonOp; value: Date }
|
|
113
|
-
| NullishOpts;
|
|
114
|
-
|
|
115
|
-
// Filter is a factory function that creates a filter object
|
|
116
|
-
export const Filter = {
|
|
117
|
-
number(opts: NumberFilterOpts) {
|
|
118
|
-
return {
|
|
119
|
-
type: "number",
|
|
120
|
-
...opts,
|
|
121
|
-
} as const;
|
|
122
|
-
},
|
|
123
|
-
text(opts: TextFilterOpts) {
|
|
124
|
-
return {
|
|
125
|
-
type: "text",
|
|
126
|
-
...opts,
|
|
127
|
-
} as const;
|
|
128
|
-
},
|
|
129
|
-
date(opts: DateLikeFilterOpts) {
|
|
130
|
-
return {
|
|
131
|
-
type: "date",
|
|
132
|
-
...opts,
|
|
133
|
-
} as const;
|
|
134
|
-
},
|
|
135
|
-
datetime(opts: DateLikeFilterOpts) {
|
|
136
|
-
return {
|
|
137
|
-
type: "datetime",
|
|
138
|
-
...opts,
|
|
139
|
-
} as const;
|
|
140
|
-
},
|
|
141
|
-
time(opts: DateLikeFilterOpts) {
|
|
142
|
-
return {
|
|
143
|
-
type: "time",
|
|
144
|
-
...opts,
|
|
145
|
-
} as const;
|
|
146
|
-
},
|
|
147
|
-
boolean(opts: { value?: boolean; operator?: OperatorType }) {
|
|
148
|
-
return {
|
|
149
|
-
type: "boolean",
|
|
150
|
-
...opts,
|
|
151
|
-
} as const;
|
|
152
|
-
},
|
|
153
|
-
select(opts: { options: unknown[]; operator: OperatorType }) {
|
|
154
|
-
return {
|
|
155
|
-
type: "select",
|
|
156
|
-
...opts,
|
|
157
|
-
} as const;
|
|
158
|
-
},
|
|
159
|
-
};
|
|
160
|
-
export type ColumnFilterValue = ReturnType<
|
|
161
|
-
(typeof Filter)[keyof typeof Filter]
|
|
162
|
-
>;
|
|
163
|
-
export type ColumnFilterForType<T extends FilterType> = T extends FilterType
|
|
164
|
-
? Extract<ColumnFilterValue, { type: T }>
|
|
165
|
-
: never;
|
|
166
|
-
|
|
167
|
-
function pad2(n: number): string {
|
|
168
|
-
return n.toString().padStart(2, "0");
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
function pad4(n: number): string {
|
|
172
|
-
return n.toString().padStart(4, "0");
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
export function dateToISODate(d: Date): string {
|
|
176
|
-
return `${pad4(d.getFullYear())}-${pad2(d.getMonth() + 1)}-${pad2(d.getDate())}`;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
export function dateToISOTime(d: Date): string {
|
|
180
|
-
return `${pad2(d.getHours())}:${pad2(d.getMinutes())}:${pad2(d.getSeconds())}`;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
export function dateToISODateTime(d: Date): string {
|
|
184
|
-
return `${dateToISODate(d)}T${dateToISOTime(d)}`;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
function isNullishFilter(
|
|
188
|
-
filter: ColumnFilterValue,
|
|
189
|
-
): filter is Extract<
|
|
190
|
-
ColumnFilterValue,
|
|
191
|
-
{ operator: "is_null" | "is_not_null" }
|
|
192
|
-
> {
|
|
193
|
-
return filter.operator === "is_null" || filter.operator === "is_not_null";
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
export function filterToFilterCondition(
|
|
197
|
-
columnIdString: string,
|
|
198
|
-
filter: ColumnFilterValue | undefined,
|
|
199
|
-
): FilterConditionType[] {
|
|
200
|
-
if (!filter) {
|
|
201
|
-
return [];
|
|
202
|
-
}
|
|
203
|
-
const columnId = columnIdString as ColumnId;
|
|
204
|
-
|
|
205
|
-
if (isNullishFilter(filter)) {
|
|
206
|
-
return [
|
|
207
|
-
{
|
|
208
|
-
column_id: columnId,
|
|
209
|
-
operator: filter.operator,
|
|
210
|
-
type: "condition",
|
|
211
|
-
negate: false,
|
|
212
|
-
},
|
|
213
|
-
];
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
switch (filter.type) {
|
|
217
|
-
case "number":
|
|
218
|
-
switch (filter.operator) {
|
|
219
|
-
case "between":
|
|
220
|
-
return [
|
|
221
|
-
{
|
|
222
|
-
column_id: columnId,
|
|
223
|
-
operator: "between",
|
|
224
|
-
value: { min: filter.min, max: filter.max },
|
|
225
|
-
type: "condition",
|
|
226
|
-
negate: false,
|
|
227
|
-
},
|
|
228
|
-
];
|
|
229
|
-
case "==":
|
|
230
|
-
case "!=":
|
|
231
|
-
case ">":
|
|
232
|
-
case ">=":
|
|
233
|
-
case "<":
|
|
234
|
-
case "<=":
|
|
235
|
-
return [
|
|
236
|
-
{
|
|
237
|
-
column_id: columnId,
|
|
238
|
-
operator: filter.operator,
|
|
239
|
-
value: filter.value,
|
|
240
|
-
type: "condition",
|
|
241
|
-
negate: false,
|
|
242
|
-
},
|
|
243
|
-
];
|
|
244
|
-
default:
|
|
245
|
-
assertNever(filter);
|
|
246
|
-
}
|
|
247
|
-
case "text":
|
|
248
|
-
switch (filter.operator) {
|
|
249
|
-
case "contains":
|
|
250
|
-
case "equals":
|
|
251
|
-
case "does_not_equal":
|
|
252
|
-
case "regex":
|
|
253
|
-
case "starts_with":
|
|
254
|
-
case "ends_with":
|
|
255
|
-
return [
|
|
256
|
-
{
|
|
257
|
-
column_id: columnId,
|
|
258
|
-
operator: filter.operator,
|
|
259
|
-
value: filter.text,
|
|
260
|
-
type: "condition",
|
|
261
|
-
negate: false,
|
|
262
|
-
},
|
|
263
|
-
];
|
|
264
|
-
case "in":
|
|
265
|
-
case "not_in":
|
|
266
|
-
return [
|
|
267
|
-
{
|
|
268
|
-
column_id: columnId,
|
|
269
|
-
operator: filter.operator,
|
|
270
|
-
value: filter.values,
|
|
271
|
-
type: "condition",
|
|
272
|
-
negate: false,
|
|
273
|
-
},
|
|
274
|
-
];
|
|
275
|
-
case "is_empty":
|
|
276
|
-
return [
|
|
277
|
-
{
|
|
278
|
-
column_id: columnId,
|
|
279
|
-
operator: "is_empty",
|
|
280
|
-
type: "condition",
|
|
281
|
-
negate: false,
|
|
282
|
-
},
|
|
283
|
-
];
|
|
284
|
-
default:
|
|
285
|
-
assertNever(filter);
|
|
286
|
-
}
|
|
287
|
-
case "date":
|
|
288
|
-
case "datetime":
|
|
289
|
-
case "time": {
|
|
290
|
-
const encode =
|
|
291
|
-
filter.type === "date"
|
|
292
|
-
? dateToISODate
|
|
293
|
-
: filter.type === "time"
|
|
294
|
-
? dateToISOTime
|
|
295
|
-
: dateToISODateTime;
|
|
296
|
-
switch (filter.operator) {
|
|
297
|
-
case "between":
|
|
298
|
-
return [
|
|
299
|
-
{
|
|
300
|
-
column_id: columnId,
|
|
301
|
-
operator: "between",
|
|
302
|
-
value: { min: encode(filter.min), max: encode(filter.max) },
|
|
303
|
-
type: "condition",
|
|
304
|
-
negate: false,
|
|
305
|
-
},
|
|
306
|
-
];
|
|
307
|
-
case "==":
|
|
308
|
-
case "!=":
|
|
309
|
-
case ">":
|
|
310
|
-
case ">=":
|
|
311
|
-
case "<":
|
|
312
|
-
case "<=":
|
|
313
|
-
return [
|
|
314
|
-
{
|
|
315
|
-
column_id: columnId,
|
|
316
|
-
operator: filter.operator,
|
|
317
|
-
value: encode(filter.value),
|
|
318
|
-
type: "condition",
|
|
319
|
-
negate: false,
|
|
320
|
-
},
|
|
321
|
-
];
|
|
322
|
-
default:
|
|
323
|
-
assertNever(filter);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
case "boolean":
|
|
327
|
-
if (filter.value) {
|
|
328
|
-
return [
|
|
329
|
-
{
|
|
330
|
-
column_id: columnId,
|
|
331
|
-
operator: "is_true",
|
|
332
|
-
type: "condition",
|
|
333
|
-
negate: false,
|
|
334
|
-
},
|
|
335
|
-
];
|
|
336
|
-
}
|
|
337
|
-
if (!filter.value) {
|
|
338
|
-
return [
|
|
339
|
-
{
|
|
340
|
-
column_id: columnId,
|
|
341
|
-
operator: "is_false",
|
|
342
|
-
type: "condition",
|
|
343
|
-
negate: false,
|
|
344
|
-
},
|
|
345
|
-
];
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
return [];
|
|
349
|
-
case "select": {
|
|
350
|
-
let operator = filter.operator;
|
|
351
|
-
if (filter.operator !== "in" && filter.operator !== "not_in") {
|
|
352
|
-
Logger.warn("Invalid operator for select filter", {
|
|
353
|
-
operator: filter.operator,
|
|
354
|
-
});
|
|
355
|
-
operator = "in";
|
|
356
|
-
}
|
|
357
|
-
return [
|
|
358
|
-
{
|
|
359
|
-
column_id: columnId,
|
|
360
|
-
operator,
|
|
361
|
-
value: filter.options,
|
|
362
|
-
type: "condition",
|
|
363
|
-
negate: false,
|
|
364
|
-
},
|
|
365
|
-
];
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
default:
|
|
369
|
-
assertNever(filter);
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
export function filtersToFilterGroup(
|
|
374
|
-
columnFilters: ColumnFiltersState,
|
|
375
|
-
): FilterGroupType {
|
|
376
|
-
const conditions = columnFilters.flatMap((filter) =>
|
|
377
|
-
filterToFilterCondition(filter.id, filter.value as ColumnFilterValue),
|
|
378
|
-
);
|
|
379
|
-
// To maintain existing behavior "and" all the conditions
|
|
380
|
-
return {
|
|
381
|
-
type: "group",
|
|
382
|
-
operator: "and",
|
|
383
|
-
children: conditions,
|
|
384
|
-
negate: false,
|
|
385
|
-
};
|
|
386
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/assets/{micromark-factory-space-BUQpMdx2.js → micromark-factory-space-bqhKsQDn.js}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|