@standardbeagle/edit-db 0.4.685 → 0.4.688

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.
@@ -1,3 +1,4 @@
1
+ import { DefaultSort } from './useEditorConfig';
1
2
  import { Table, Column, Join } from '../types/schema';
2
3
  import { ColumnDef, ColumnFiltersState, SortingState } from '@tanstack/react-table';
3
4
  import { DrillFrame } from '../lib/drill-stack';
@@ -129,4 +130,12 @@ interface UseDataTableResult {
129
130
  * @param onOpenColumn - Callback when opening a side panel column
130
131
  * @returns Data table state and control functions
131
132
  */
133
+ /**
134
+ * The sort a grid opens with, from the host's `defaultSort` config: the table's
135
+ * own entry wins over `"*"`. Empty when nothing is configured, when the named
136
+ * column is not on the table, or when it cannot drive an ORDER BY (blob/JSON),
137
+ * so the caller falls back to its positional default instead of erroring the
138
+ * first query.
139
+ */
140
+ export declare function resolveConfiguredSort(table: Table | null, defaultSort: Record<string, DefaultSort> | undefined): SortingState;
132
141
  export declare function useDataTable(table: Table | null, id?: string, filterTable?: string, filterColumn?: string, onExpandContent?: (rowIndex: number, columnName: string) => void, onOpenColumn?: (panel: DrillFrame) => void): UseDataTableResult;
@@ -1,5 +1,10 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { TableAction } from '../lib/table-action';
3
+ /** One configured grid sort: the column name and its direction (ascending unless `desc`). */
4
+ export interface DefaultSort {
5
+ column: string;
6
+ desc?: boolean;
7
+ }
3
8
  /**
4
9
  * Optional, opt-in editor features. Kept tiny and separate from the data/schema
5
10
  * contexts so feature flags don't force those providers to re-render and so
@@ -32,6 +37,19 @@ export interface EditorConfig {
32
37
  * annotate but sit in the middle of the natural column order.
33
38
  */
34
39
  trailingColumns?: string[];
40
+ /**
41
+ * Sort a grid opens with, keyed by table name; `"*"` covers every table
42
+ * without its own entry. Resolved by `resolveConfiguredSort` in
43
+ * useDataTable, which drops an entry naming a column the table lacks or
44
+ * cannot ORDER BY, so a host-wide `id desc` is safe on keyless tables.
45
+ */
46
+ defaultSort?: Record<string, DefaultSort>;
47
+ /**
48
+ * Column the header quick-search starts on, keyed by table name. Applied by
49
+ * the header only when the column is one it can search (string/numeric);
50
+ * anything else falls back to the first searchable column.
51
+ */
52
+ defaultSearchColumns?: Record<string, string>;
35
53
  /**
36
54
  * Host-contributed actions on each table in the navigation list, rendered in
37
55
  * the table's kebab menu AFTER the built-in Download actions. The host owns
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Which column the header quick-search starts on. The host's configured column
3
+ * for the table wins when it is one of the searchable options; otherwise the
4
+ * first option, so a table with no configuration behaves as before. Returns the
5
+ * option's `value` (the `name,paramType` pair the header keys its picker by).
6
+ */
7
+ export declare function pickDefaultSearchColumn(options: ReadonlyArray<{
8
+ key: string;
9
+ value: string;
10
+ }> | undefined, configured: string | undefined): string;
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@standardbeagle/edit-db",
3
3
  "private": false,
4
- "version": "0.4.685",
4
+ "version": "0.4.688",
5
5
  "type": "module",
6
6
  "dependencies": {
7
7
  "@radix-ui/react-slot": "^1.2.4",