@macrostrat/data-sheet 4.0.0-dev3 → 4.0.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/CHANGELOG.md +56 -0
- package/README.md +44 -0
- package/dist/actions/builtin.cjs +36 -5
- package/dist/actions/builtin.cjs.map +1 -1
- package/dist/actions/builtin.d.ts +3 -2
- package/dist/actions/builtin.js +36 -5
- package/dist/actions/builtin.js.map +1 -1
- package/dist/actions/column-controls.cjs +149 -0
- package/dist/actions/column-controls.cjs.map +1 -0
- package/dist/actions/column-controls.d.ts +11 -0
- package/dist/actions/column-controls.js +147 -0
- package/dist/actions/column-controls.js.map +1 -0
- package/dist/actions/column-filter.cjs +68 -0
- package/dist/actions/column-filter.cjs.map +1 -0
- package/dist/actions/column-filter.d.ts +11 -0
- package/dist/actions/column-filter.js +66 -0
- package/dist/actions/column-filter.js.map +1 -0
- package/dist/actions/edit-actions.cjs +42 -0
- package/dist/actions/edit-actions.cjs.map +1 -0
- package/dist/actions/edit-actions.d.ts +14 -0
- package/dist/actions/edit-actions.js +42 -0
- package/dist/actions/edit-actions.js.map +1 -0
- package/dist/actions/filters.cjs +39 -23
- package/dist/actions/filters.cjs.map +1 -1
- package/dist/actions/filters.d.ts +6 -3
- package/dist/actions/filters.js +41 -25
- package/dist/actions/filters.js.map +1 -1
- package/dist/actions/index.d.ts +4 -0
- package/dist/actions/selection.cjs +51 -32
- package/dist/actions/selection.cjs.map +1 -1
- package/dist/actions/selection.d.ts +3 -7
- package/dist/actions/selection.js +51 -32
- package/dist/actions/selection.js.map +1 -1
- package/dist/actions/table-controls.cjs +41 -0
- package/dist/actions/table-controls.cjs.map +1 -0
- package/dist/actions/table-controls.d.ts +4 -0
- package/dist/actions/table-controls.js +39 -0
- package/dist/actions/table-controls.js.map +1 -0
- package/dist/actions/toolbar.cjs +69 -10
- package/dist/actions/toolbar.cjs.map +1 -1
- package/dist/actions/toolbar.d.ts +9 -6
- package/dist/actions/toolbar.js +69 -10
- package/dist/actions/toolbar.js.map +1 -1
- package/dist/actions/toolbar.module.sass.cjs +12 -7
- package/dist/actions/toolbar.module.sass.cjs.map +1 -1
- package/dist/actions/toolbar.module.sass.js +12 -7
- package/dist/actions/toolbar.module.sass.js.map +1 -1
- package/dist/actions/types.d.ts +49 -4
- package/dist/cell-renderer.cjs +150 -14
- package/dist/cell-renderer.cjs.map +1 -1
- package/dist/cell-renderer.d.ts +1 -1
- package/dist/cell-renderer.js +151 -15
- package/dist/cell-renderer.js.map +1 -1
- package/dist/components/cell-detail.cjs +24 -0
- package/dist/components/cell-detail.cjs.map +1 -0
- package/dist/components/cell-detail.d.ts +12 -0
- package/dist/components/cell-detail.js +24 -0
- package/dist/components/cell-detail.js.map +1 -0
- package/dist/components/editor-popup.cjs +28 -24
- package/dist/components/editor-popup.cjs.map +1 -1
- package/dist/components/editor-popup.js +29 -25
- package/dist/components/editor-popup.js.map +1 -1
- package/dist/components/index.d.ts +2 -2
- package/dist/components/text-areas.cjs +51 -7
- package/dist/components/text-areas.cjs.map +1 -1
- package/dist/components/text-areas.d.ts +4 -1
- package/dist/components/text-areas.js +51 -7
- package/dist/components/text-areas.js.map +1 -1
- package/dist/components/view-info.cjs +46 -9
- package/dist/components/view-info.cjs.map +1 -1
- package/dist/components/view-info.d.ts +5 -1
- package/dist/components/view-info.js +47 -10
- package/dist/components/view-info.js.map +1 -1
- package/dist/core.cjs +167 -73
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.ts +53 -6
- package/dist/core.js +169 -75
- package/dist/core.js.map +1 -1
- package/dist/data-sheet.css +72 -123
- package/dist/filters/operators.cjs +91 -0
- package/dist/filters/operators.cjs.map +1 -0
- package/dist/filters/operators.d.ts +17 -0
- package/dist/filters/operators.js +91 -0
- package/dist/filters/operators.js.map +1 -0
- package/dist/index.cjs +38 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +44 -16
- package/dist/index.js.map +1 -1
- package/dist/main.module.sass.cjs +13 -12
- package/dist/main.module.sass.cjs.map +1 -1
- package/dist/main.module.sass.js +13 -12
- package/dist/main.module.sass.js.map +1 -1
- package/dist/postgrest-table/data-loaders.cjs +255 -146
- package/dist/postgrest-table/data-loaders.cjs.map +1 -1
- package/dist/postgrest-table/data-loaders.d.ts +144 -46
- package/dist/postgrest-table/data-loaders.js +259 -150
- package/dist/postgrest-table/data-loaders.js.map +1 -1
- package/dist/postgrest-table/index.cjs +58 -169
- package/dist/postgrest-table/index.cjs.map +1 -1
- package/dist/postgrest-table/index.d.ts +5 -2
- package/dist/postgrest-table/index.js +63 -174
- package/dist/postgrest-table/index.js.map +1 -1
- package/dist/postgrest-table/loading-utils.cjs +0 -4
- package/dist/postgrest-table/loading-utils.cjs.map +1 -1
- package/dist/postgrest-table/loading-utils.js +1 -5
- package/dist/postgrest-table/loading-utils.js.map +1 -1
- package/dist/postgrest-table/main.module.sass.cjs +14 -13
- package/dist/postgrest-table/main.module.sass.cjs.map +1 -1
- package/dist/postgrest-table/main.module.sass.js +14 -13
- package/dist/postgrest-table/main.module.sass.js.map +1 -1
- package/dist/provider.cjs +68 -11
- package/dist/provider.cjs.map +1 -1
- package/dist/provider.d.ts +25 -0
- package/dist/provider.js +68 -11
- package/dist/provider.js.map +1 -1
- package/dist/renderers/column-header-cell.cjs +95 -75
- package/dist/renderers/column-header-cell.cjs.map +1 -1
- package/dist/renderers/column-header-cell.d.ts +3 -18
- package/dist/renderers/column-header-cell.js +98 -78
- package/dist/renderers/column-header-cell.js.map +1 -1
- package/dist/renderers/index.d.ts +0 -1
- package/dist/types.cjs +2 -0
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.ts +84 -1
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -1
- package/dist/utils/column-spec.cjs.map +1 -1
- package/dist/utils/column-spec.d.ts +101 -1
- package/dist/utils/column-spec.js.map +1 -1
- package/dist/utils/debug-overlay.cjs +24 -0
- package/dist/utils/debug-overlay.cjs.map +1 -0
- package/dist/utils/debug-overlay.d.ts +4 -0
- package/dist/utils/debug-overlay.js +24 -0
- package/dist/utils/debug-overlay.js.map +1 -0
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/key-handling.cjs +52 -6
- package/dist/utils/key-handling.cjs.map +1 -1
- package/dist/utils/key-handling.js +52 -6
- package/dist/utils/key-handling.js.map +1 -1
- package/dist/utils/validation.cjs +41 -0
- package/dist/utils/validation.cjs.map +1 -0
- package/dist/utils/validation.d.ts +26 -0
- package/dist/utils/validation.js +41 -0
- package/dist/utils/validation.js.map +1 -0
- package/dist/zustand-store.cjs +119 -61
- package/dist/zustand-store.cjs.map +1 -1
- package/dist/zustand-store.js +121 -63
- package/dist/zustand-store.js.map +1 -1
- package/package.json +3 -3
- package/src/actions/builtin.ts +62 -7
- package/src/actions/column-controls.ts +185 -0
- package/src/actions/column-filter.ts +104 -0
- package/src/actions/edit-actions.ts +67 -0
- package/src/actions/filters.ts +54 -28
- package/src/actions/index.ts +4 -0
- package/src/actions/selection.ts +73 -54
- package/src/actions/table-controls.ts +46 -0
- package/src/actions/toolbar.module.sass +22 -2
- package/src/actions/toolbar.ts +113 -16
- package/src/actions/types.ts +49 -4
- package/src/cell-renderer.ts +211 -16
- package/src/components/cell-detail.ts +30 -0
- package/src/components/editor-popup.ts +39 -25
- package/src/components/index.ts +2 -2
- package/src/components/text-areas.ts +80 -16
- package/src/components/view-info.ts +63 -4
- package/src/core.ts +321 -103
- package/src/filters/operators.ts +127 -0
- package/src/index.ts +2 -0
- package/src/main.module.sass +6 -0
- package/src/postgrest-table/data-loaders.ts +459 -209
- package/src/postgrest-table/index.ts +81 -254
- package/src/postgrest-table/main.module.sass +11 -0
- package/src/provider.ts +109 -12
- package/src/renderers/column-header-cell.ts +60 -272
- package/src/renderers/index.ts +0 -1
- package/src/types.ts +76 -2
- package/src/utils/column-spec.ts +112 -1
- package/src/utils/debug-overlay.ts +22 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/key-handling.ts +70 -6
- package/src/utils/validation.ts +72 -0
- package/src/zustand-store.ts +167 -60
- package/dist/components/actions.cjs +0 -12
- package/dist/components/actions.cjs.map +0 -1
- package/dist/components/actions.d.ts +0 -2
- package/dist/components/actions.js +0 -12
- package/dist/components/actions.js.map +0 -1
- package/dist/components/actions.module.sass.cjs +0 -12
- package/dist/components/actions.module.sass.cjs.map +0 -1
- package/dist/components/actions.module.sass.js +0 -11
- package/dist/components/actions.module.sass.js.map +0 -1
- package/dist/postgrest-table/lazy-loader-table.cjs +0 -27
- package/dist/postgrest-table/lazy-loader-table.cjs.map +0 -1
- package/dist/postgrest-table/lazy-loader-table.d.ts +0 -3
- package/dist/postgrest-table/lazy-loader-table.js +0 -27
- package/dist/postgrest-table/lazy-loader-table.js.map +0 -1
- package/dist/renderers/column-header-cell-postgrest.cjs +0 -216
- package/dist/renderers/column-header-cell-postgrest.cjs.map +0 -1
- package/dist/renderers/column-header-cell-postgrest.d.ts +0 -13
- package/dist/renderers/column-header-cell-postgrest.js +0 -216
- package/dist/renderers/column-header-cell-postgrest.js.map +0 -1
- package/dist/renderers/column-header-cell-postgrest.module.sass.cjs +0 -23
- package/dist/renderers/column-header-cell-postgrest.module.sass.cjs.map +0 -1
- package/dist/renderers/column-header-cell-postgrest.module.sass.js +0 -22
- package/dist/renderers/column-header-cell-postgrest.module.sass.js.map +0 -1
- package/src/components/actions.ts +0 -9
- package/src/postgrest-table/lazy-loader-table.ts +0 -25
- package/src/renderers/column-header-cell-postgrest.ts +0 -282
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import h from "./main.module.sass";
|
|
2
|
-
import { DataSheet } from "../core";
|
|
3
|
-
import { useTestLazyLoader } from "./data-loaders";
|
|
4
|
-
|
|
5
|
-
export function TestLazyLoaderTableView<T>({ ...rest }) {
|
|
6
|
-
return h("div.data-sheet-outer", [
|
|
7
|
-
h(
|
|
8
|
-
DataSheet,
|
|
9
|
-
{
|
|
10
|
-
...rest,
|
|
11
|
-
editable: false,
|
|
12
|
-
},
|
|
13
|
-
[
|
|
14
|
-
h(TestLazyLoaderManager, {
|
|
15
|
-
key: "test-lazy-loader-manager",
|
|
16
|
-
}),
|
|
17
|
-
],
|
|
18
|
-
),
|
|
19
|
-
]);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function TestLazyLoaderManager() {
|
|
23
|
-
useTestLazyLoader();
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Column header with server-side sort and filter controls.
|
|
3
|
-
*
|
|
4
|
-
* Uses Blueprint's ColumnHeaderCell `menuRenderer` prop to provide a
|
|
5
|
-
* dropdown menu with sort direction toggles and a filter input.
|
|
6
|
-
* The `nameRenderer` prop shows the column name plus visual indicators
|
|
7
|
-
* for any active sort or filter.
|
|
8
|
-
*/
|
|
9
|
-
import { ColumnHeaderCell, ColumnHeaderCellProps } from "@blueprintjs/table";
|
|
10
|
-
import {
|
|
11
|
-
Button,
|
|
12
|
-
ButtonGroup,
|
|
13
|
-
HTMLSelect,
|
|
14
|
-
Icon,
|
|
15
|
-
InputGroup,
|
|
16
|
-
Menu,
|
|
17
|
-
} from "@blueprintjs/core";
|
|
18
|
-
import { useCallback, useRef, useState } from "react";
|
|
19
|
-
import h from "./column-header-cell-postgrest.module.sass";
|
|
20
|
-
import type { ColumnSpec, ColumnDataType } from "../utils/column-spec";
|
|
21
|
-
import type {
|
|
22
|
-
ColumnSortEntry,
|
|
23
|
-
PostgrestColumnFilter,
|
|
24
|
-
PostgrestFilterOperator,
|
|
25
|
-
} from "../postgrest-table/data-loaders";
|
|
26
|
-
import { ColumnHeaderRendererProps } from "./column-header-cell";
|
|
27
|
-
|
|
28
|
-
/** Operators appropriate for string columns. */
|
|
29
|
-
const STRING_FILTER_OPERATORS: PostgrestFilterOperator[] = [
|
|
30
|
-
"eq",
|
|
31
|
-
"neq",
|
|
32
|
-
"ilike",
|
|
33
|
-
];
|
|
34
|
-
|
|
35
|
-
/** Operators appropriate for numeric / integer columns. */
|
|
36
|
-
const NUMERIC_FILTER_OPERATORS: PostgrestFilterOperator[] = [
|
|
37
|
-
"eq",
|
|
38
|
-
"neq",
|
|
39
|
-
"gt",
|
|
40
|
-
"lt",
|
|
41
|
-
"gte",
|
|
42
|
-
"lte",
|
|
43
|
-
];
|
|
44
|
-
|
|
45
|
-
/** Operators appropriate for boolean columns. */
|
|
46
|
-
const BOOLEAN_FILTER_OPERATORS: PostgrestFilterOperator[] = ["eq", "neq"];
|
|
47
|
-
|
|
48
|
-
/** Fallback operators when no type information is available. */
|
|
49
|
-
const DEFAULT_FILTER_OPERATORS: PostgrestFilterOperator[] = [
|
|
50
|
-
"eq",
|
|
51
|
-
"neq",
|
|
52
|
-
"ilike",
|
|
53
|
-
"gt",
|
|
54
|
-
"lt",
|
|
55
|
-
"gte",
|
|
56
|
-
"lte",
|
|
57
|
-
];
|
|
58
|
-
|
|
59
|
-
/** Map from data type to the appropriate set of filter operators. */
|
|
60
|
-
const OPERATORS_BY_TYPE: Record<string, PostgrestFilterOperator[]> = {
|
|
61
|
-
string: STRING_FILTER_OPERATORS,
|
|
62
|
-
number: NUMERIC_FILTER_OPERATORS,
|
|
63
|
-
integer: NUMERIC_FILTER_OPERATORS,
|
|
64
|
-
boolean: BOOLEAN_FILTER_OPERATORS,
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
export const OPERATOR_LABELS: Record<PostgrestFilterOperator, string> = {
|
|
68
|
-
eq: "=",
|
|
69
|
-
neq: "≠",
|
|
70
|
-
like: "like",
|
|
71
|
-
ilike: "contains",
|
|
72
|
-
gt: ">",
|
|
73
|
-
lt: "<",
|
|
74
|
-
gte: "≥",
|
|
75
|
-
lte: "≤",
|
|
76
|
-
is: "is",
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export interface ColumnHeaderActions {
|
|
80
|
-
onSetSort: (key: string, ascending: boolean | null) => void;
|
|
81
|
-
onSetFilter: (
|
|
82
|
-
key: string,
|
|
83
|
-
operator: PostgrestFilterOperator | null,
|
|
84
|
-
value: string,
|
|
85
|
-
) => void;
|
|
86
|
-
onClearColumn: (key: string) => void;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/** The main column header cell renderer for PostgREST tables. */
|
|
90
|
-
export function renderPostgRESTColumnHeaderCell(
|
|
91
|
-
props: ColumnHeaderRendererProps & { actions: ColumnHeaderActions },
|
|
92
|
-
): React.ReactElement<ColumnHeaderCellProps> | null {
|
|
93
|
-
const { col, activeSort, activeFilter, actions } = props;
|
|
94
|
-
|
|
95
|
-
const isSortable = col.sortable === true;
|
|
96
|
-
const isFilterable =
|
|
97
|
-
col.filterable === true || typeof col.filterable === "object";
|
|
98
|
-
|
|
99
|
-
// If the column has no sort/filter capabilities, render a plain header
|
|
100
|
-
if (!isSortable && !isFilterable) {
|
|
101
|
-
return h(ColumnHeaderCell, { name: col.name });
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return h(ColumnHeaderCell, {
|
|
105
|
-
name: col.name,
|
|
106
|
-
nameRenderer: (): any =>
|
|
107
|
-
h(ColumnHeaderName, { col, activeFilter, activeSort }),
|
|
108
|
-
menuRenderer: () =>
|
|
109
|
-
h(ColumnActionsMenu, {
|
|
110
|
-
col,
|
|
111
|
-
isSortable,
|
|
112
|
-
isFilterable,
|
|
113
|
-
activeSort,
|
|
114
|
-
activeFilter,
|
|
115
|
-
actions,
|
|
116
|
-
}),
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/** Column name with active sort/filter indicator icons. */
|
|
121
|
-
function ColumnHeaderName({ col, activeSort, activeFilter }) {
|
|
122
|
-
const hasSortActive = activeSort != null;
|
|
123
|
-
const hasFilterActive = activeFilter != null;
|
|
124
|
-
return h("div.column-header-cell", [
|
|
125
|
-
h("span.column-name", col.name),
|
|
126
|
-
h.if(hasSortActive || hasFilterActive)("span.column-indicators", [
|
|
127
|
-
h.if(hasSortActive)(
|
|
128
|
-
"span.sort-indicator",
|
|
129
|
-
h(Icon, {
|
|
130
|
-
icon: activeSort?.ascending ? "sort-asc" : "sort-desc",
|
|
131
|
-
size: 12,
|
|
132
|
-
}),
|
|
133
|
-
),
|
|
134
|
-
h.if(hasFilterActive)(
|
|
135
|
-
"span.filter-indicator",
|
|
136
|
-
h(Icon, { icon: "filter", size: 12 }),
|
|
137
|
-
),
|
|
138
|
-
]),
|
|
139
|
-
]);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/** Resolve filter operators for a column, considering explicit config,
|
|
143
|
-
* inferred data type, and fallback defaults. */
|
|
144
|
-
function getOperatorsForColumn(col: ColumnSpec): PostgrestFilterOperator[] {
|
|
145
|
-
// Explicit operators in filterable config take priority
|
|
146
|
-
if (typeof col.filterable === "object" && col.filterable.operators?.length) {
|
|
147
|
-
return col.filterable.operators as PostgrestFilterOperator[];
|
|
148
|
-
}
|
|
149
|
-
// Otherwise, pick operators based on the inferred data type
|
|
150
|
-
if (col.dataType != null) {
|
|
151
|
-
return OPERATORS_BY_TYPE[col.dataType] ?? DEFAULT_FILTER_OPERATORS;
|
|
152
|
-
}
|
|
153
|
-
return DEFAULT_FILTER_OPERATORS;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/** Menu content rendered inside ColumnHeaderCell's built-in dropdown. */
|
|
157
|
-
function ColumnActionsMenu({
|
|
158
|
-
col,
|
|
159
|
-
isSortable,
|
|
160
|
-
isFilterable,
|
|
161
|
-
activeSort,
|
|
162
|
-
activeFilter,
|
|
163
|
-
actions,
|
|
164
|
-
}) {
|
|
165
|
-
const operators = getOperatorsForColumn(col);
|
|
166
|
-
|
|
167
|
-
const [filterOperator, setFilterOperator] = useState<PostgrestFilterOperator>(
|
|
168
|
-
activeFilter?.operator ?? operators[0],
|
|
169
|
-
);
|
|
170
|
-
const filterInputRef = useRef<HTMLInputElement>(null);
|
|
171
|
-
|
|
172
|
-
const applyFilter = useCallback(() => {
|
|
173
|
-
const val = filterInputRef.current?.value ?? "";
|
|
174
|
-
if (val.trim() === "") {
|
|
175
|
-
actions.onSetFilter(col.key, null, "");
|
|
176
|
-
} else {
|
|
177
|
-
actions.onSetFilter(col.key, filterOperator, val);
|
|
178
|
-
}
|
|
179
|
-
}, [col.key, filterOperator, actions]);
|
|
180
|
-
|
|
181
|
-
const hasAnyActive =
|
|
182
|
-
activeSort != null ||
|
|
183
|
-
(activeFilter != null &&
|
|
184
|
-
activeFilter.value !== "" &&
|
|
185
|
-
activeFilter.value != null);
|
|
186
|
-
|
|
187
|
-
return h(Menu, { className: "column-actions-menu" }, [
|
|
188
|
-
h("div.column-actions-popover", [
|
|
189
|
-
h.if(isSortable)("div.popover-section", [
|
|
190
|
-
h("div.popover-section-title", "Sort"),
|
|
191
|
-
h("div.sort-buttons", [
|
|
192
|
-
h(ButtonGroup, { minimal: true }, [
|
|
193
|
-
h(
|
|
194
|
-
Button,
|
|
195
|
-
{
|
|
196
|
-
icon: "sort-asc",
|
|
197
|
-
active: activeSort?.ascending === true,
|
|
198
|
-
intent: activeSort?.ascending === true ? "primary" : "none",
|
|
199
|
-
onClick() {
|
|
200
|
-
if (activeSort?.ascending === true) {
|
|
201
|
-
actions.onSetSort(col.key, null);
|
|
202
|
-
} else {
|
|
203
|
-
actions.onSetSort(col.key, true);
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
},
|
|
207
|
-
"A→Z",
|
|
208
|
-
),
|
|
209
|
-
h(
|
|
210
|
-
Button,
|
|
211
|
-
{
|
|
212
|
-
icon: "sort-desc",
|
|
213
|
-
active: activeSort?.ascending === false,
|
|
214
|
-
intent: activeSort?.ascending === false ? "primary" : "none",
|
|
215
|
-
onClick() {
|
|
216
|
-
if (activeSort?.ascending === false) {
|
|
217
|
-
actions.onSetSort(col.key, null);
|
|
218
|
-
} else {
|
|
219
|
-
actions.onSetSort(col.key, false);
|
|
220
|
-
}
|
|
221
|
-
},
|
|
222
|
-
},
|
|
223
|
-
"Z→A",
|
|
224
|
-
),
|
|
225
|
-
]),
|
|
226
|
-
]),
|
|
227
|
-
]),
|
|
228
|
-
h.if(isFilterable)("div.popover-section", [
|
|
229
|
-
h("div.popover-section-title", "Filter"),
|
|
230
|
-
h("div.filter-row", [
|
|
231
|
-
h(HTMLSelect, {
|
|
232
|
-
className: "filter-operator-select",
|
|
233
|
-
value: filterOperator,
|
|
234
|
-
options: operators.map((op) => ({
|
|
235
|
-
value: op,
|
|
236
|
-
label: OPERATOR_LABELS[op] ?? op,
|
|
237
|
-
})),
|
|
238
|
-
onChange(e) {
|
|
239
|
-
setFilterOperator(e.target.value as PostgrestFilterOperator);
|
|
240
|
-
},
|
|
241
|
-
}),
|
|
242
|
-
h(InputGroup, {
|
|
243
|
-
className: "filter-value-input",
|
|
244
|
-
small: true,
|
|
245
|
-
placeholder: "Value…",
|
|
246
|
-
defaultValue: activeFilter?.value ?? "",
|
|
247
|
-
inputRef: filterInputRef,
|
|
248
|
-
onKeyDown(e) {
|
|
249
|
-
if (e.key === "Enter") {
|
|
250
|
-
applyFilter();
|
|
251
|
-
}
|
|
252
|
-
},
|
|
253
|
-
rightElement: h(Button, {
|
|
254
|
-
icon: "arrow-right",
|
|
255
|
-
minimal: true,
|
|
256
|
-
small: true,
|
|
257
|
-
onClick: applyFilter,
|
|
258
|
-
}),
|
|
259
|
-
}),
|
|
260
|
-
]),
|
|
261
|
-
]),
|
|
262
|
-
h.if(hasAnyActive)("div.clear-section", [
|
|
263
|
-
h(
|
|
264
|
-
Button,
|
|
265
|
-
{
|
|
266
|
-
small: true,
|
|
267
|
-
minimal: true,
|
|
268
|
-
intent: "danger",
|
|
269
|
-
icon: "cross",
|
|
270
|
-
onClick() {
|
|
271
|
-
actions.onClearColumn(col.key);
|
|
272
|
-
if (filterInputRef.current) {
|
|
273
|
-
filterInputRef.current.value = "";
|
|
274
|
-
}
|
|
275
|
-
},
|
|
276
|
-
},
|
|
277
|
-
"Clear all",
|
|
278
|
-
),
|
|
279
|
-
]),
|
|
280
|
-
]),
|
|
281
|
-
]);
|
|
282
|
-
}
|