@standardbeagle/edit-db 0.4.447 → 0.4.449
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/edit-db.css +1 -1
- package/dist/editor.d.ts +6 -1
- package/dist/editor.es.js +2200 -2112
- package/dist/editor.umd.cjs +30 -30
- package/dist/hooks/useEditorConfig.d.ts +19 -0
- package/dist/hooks/useTableStats.d.ts +1 -1
- package/dist/lib/format-value-render.test.d.ts +1 -0
- package/dist/lib/format-value.d.ts +34 -0
- package/dist/lib/format-value.test.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Optional, opt-in editor features. Kept tiny and separate from the data/schema
|
|
4
|
+
* contexts so feature flags don't force those providers to re-render and so
|
|
5
|
+
* TableList can read flags without prop-drilling through the router.
|
|
6
|
+
*/
|
|
7
|
+
export interface EditorConfig {
|
|
8
|
+
/**
|
|
9
|
+
* Show per-table statistics (row-count bars, column/FK counts) in the table
|
|
10
|
+
* list. Off by default: it issues a row-count query per table, which a host
|
|
11
|
+
* may not want on every connect. Hosts opt in via `<Editor showStats />`.
|
|
12
|
+
*/
|
|
13
|
+
showStats: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function EditorConfigProvider({ config, children }: {
|
|
16
|
+
config: EditorConfig;
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare function useEditorConfig(): EditorConfig;
|
|
@@ -49,7 +49,7 @@ export interface UseTableStatsResult {
|
|
|
49
49
|
*
|
|
50
50
|
* @returns Table statistics map and loading state
|
|
51
51
|
*/
|
|
52
|
-
export declare function useTableStats(): UseTableStatsResult;
|
|
52
|
+
export declare function useTableStats(enabled?: boolean): UseTableStatsResult;
|
|
53
53
|
/**
|
|
54
54
|
* Formats a number into an abbreviated string representation.
|
|
55
55
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Column } from '../types/schema';
|
|
3
|
+
/**
|
|
4
|
+
* Per-column display formatting for grid/detail cells.
|
|
5
|
+
*
|
|
6
|
+
* Raw DB values — especially SQL Server datetimes like
|
|
7
|
+
* `2026-05-11T22:17:47.7636626` — are unreadable. This formats values into
|
|
8
|
+
* concise, locale-aware forms, driven by a `display-format` column metadata key
|
|
9
|
+
* with a sensible default inferred from the column type when none is set.
|
|
10
|
+
*
|
|
11
|
+
* Supported `display-format` values:
|
|
12
|
+
* date — locale date (e.g. "May 11, 2026")
|
|
13
|
+
* datetime — locale date + time (e.g. "May 11, 2026, 10:17 PM")
|
|
14
|
+
* time — locale time (e.g. "10:17 PM")
|
|
15
|
+
* relative — humanized relative time (e.g. "4 hours ago"), hover shows exact
|
|
16
|
+
* number — grouped locale number (e.g. "1,234,567")
|
|
17
|
+
* percent — locale percent (0.42 -> "42%")
|
|
18
|
+
* raw — no formatting (escape hatch)
|
|
19
|
+
*
|
|
20
|
+
* Any formatted cell keeps the exact value in a `title` so hovering reveals the
|
|
21
|
+
* precise underlying data.
|
|
22
|
+
*/
|
|
23
|
+
export declare const DISPLAY_FORMAT_KEY = "display-format";
|
|
24
|
+
export type DisplayFormat = 'date' | 'datetime' | 'time' | 'relative' | 'number' | 'percent' | 'raw';
|
|
25
|
+
/** Resolve the effective format: explicit metadata wins, else inferred from type. */
|
|
26
|
+
export declare function resolveDisplayFormat(column: Column): DisplayFormat | null;
|
|
27
|
+
/** "4 hours ago" / "in 3 days" via Intl.RelativeTimeFormat. */
|
|
28
|
+
export declare function formatRelative(date: Date, now?: Date): string;
|
|
29
|
+
/**
|
|
30
|
+
* Format a scalar value for display, given its column. Returns a muted
|
|
31
|
+
* placeholder for null/empty, a locale-formatted node for known formats (with a
|
|
32
|
+
* `title` revealing the exact value), or the plain string otherwise.
|
|
33
|
+
*/
|
|
34
|
+
export declare function formatColumnValue(value: unknown, column: Column): ReactNode;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|