@pythia-software/query-table-ui 0.3.0 → 0.4.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/README.md +22 -0
- package/dist/index.d.ts +14 -1
- package/dist/index.js +566 -492
- package/dist/index.js.map +1 -1
- package/dist/theme.css +3 -0
- package/dist/theme.css.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -81,3 +81,25 @@ for customization and backend integration details.
|
|
|
81
81
|
## SELECT editor
|
|
82
82
|
|
|
83
83
|
`QueryBuilder` includes an **Edit columns** action. The exported `SelectColumnEditor` also accepts `{ api, onClose }` for standalone use. It supports draft column ordering, a searchable catalogue, sampled value frequencies, and a lazy-loaded CodeMirror formula editor with grouped live previews and regex inspection. Shared-definition saves and query-layout application are separate actions.
|
|
84
|
+
|
|
85
|
+
### Filter value presentation
|
|
86
|
+
|
|
87
|
+
Queries keep stable string keys while consumers can display names and rich badges.
|
|
88
|
+
Static options accept either strings (the existing API) or `{ value, label }` objects.
|
|
89
|
+
Wrap the table and query builder in `FilterValueProvider` to supply presentation for
|
|
90
|
+
current values, suggestions, and cell quick filters:
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
<FilterValueProvider value={{
|
|
94
|
+
label: (field, key) => lookup(field, key)?.name ?? key,
|
|
95
|
+
render: (field, key) => <Badge value={lookup(field, key)} fallback={key} />,
|
|
96
|
+
}}>
|
|
97
|
+
<QueryBuilder api={api} fields={schema.fields} total={api.total} />
|
|
98
|
+
<DataTable {...tableProps} />
|
|
99
|
+
</FilterValueProvider>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
The searchable static picker matches both labels and keys. Selection emits the
|
|
103
|
+
canonical `value` only; presentation is never serialized into queries. A resolver
|
|
104
|
+
can present a current value even when it is absent from the options. Strings without
|
|
105
|
+
a presentation provider retain the existing select control.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
1
2
|
import { ReactNode, SetStateAction } from 'react';
|
|
2
3
|
import { FieldDef, QueryState, RowId, FieldStats, WhereClause } from '@pythia-software/query-table-core';
|
|
3
4
|
import { SelectionApi, ColumnDragApi, QueryTableApi, AggregationsApi, SavedQueriesApi } from '@pythia-software/query-table-react';
|
|
@@ -176,4 +177,16 @@ interface SelectColumnEditorProps<Row> {
|
|
|
176
177
|
}
|
|
177
178
|
declare function SelectColumnEditor<Row>({ api, onClose, }: SelectColumnEditorProps<Row>): react_jsx_runtime.JSX.Element;
|
|
178
179
|
|
|
179
|
-
|
|
180
|
+
/** Consumer-owned presentation; canonical values remain in queries and URLs. */
|
|
181
|
+
interface FilterValuePresentation {
|
|
182
|
+
label?: (field: string, value: string) => string;
|
|
183
|
+
render?: (field: string, value: string) => ReactNode;
|
|
184
|
+
}
|
|
185
|
+
declare const FilterValueProvider: react.Provider<FilterValuePresentation>;
|
|
186
|
+
declare function PresentedFilterValue({ field, value, label }: {
|
|
187
|
+
field: string;
|
|
188
|
+
value: string;
|
|
189
|
+
label?: string;
|
|
190
|
+
}): react_jsx_runtime.JSX.Element;
|
|
191
|
+
|
|
192
|
+
export { type CellContext, CellMenu, type CellMenuProps, type CellRenderer, DataTable, type DataTableProps, FieldPicker, type FieldPickerProps, type FilterValuePresentation, FilterValueProvider, type MenuClassNames, MetricsPanel, type MetricsPanelProps, PresentedFilterValue, QueryBuilder, type QueryBuilderClassNames, type QueryBuilderProps, type RenderRegistry, SavedQueriesModal, type SavedQueriesModalProps, SelectColumnEditor, type SelectColumnEditorProps, SelectionToolbar, type SelectionToolbarProps, type TableClassNames, defaultRenderers, resolveRenderer, safeLinkHref };
|