@standardbeagle/edit-db 0.4.448 → 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.es.js +2112 -2040
- package/dist/editor.umd.cjs +30 -30
- 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 @@
|
|
|
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 {};
|