@declarion/react 0.1.84 → 0.1.85
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-lib/{DraggableChildrenTable-XKJWMb1S.js → DraggableChildrenTable-CVdCUPGE.js} +48 -48
- package/dist-lib/{DraggableChildrenTable-XKJWMb1S.js.map → DraggableChildrenTable-CVdCUPGE.js.map} +1 -1
- package/dist-lib/components/pages/list/ListHeader.d.ts +9 -1
- package/dist-lib/hooks/useEntityData.d.ts +26 -2
- package/dist-lib/index.d.ts +2 -1
- package/dist-lib/index.js +4006 -3938
- package/dist-lib/index.js.map +1 -1
- package/dist-lib/lib/format-count.d.ts +40 -0
- package/dist-lib/types/api.d.ts +29 -2
- package/dist-lib/types/schema.d.ts +10 -0
- package/dist-lib/{useUserLocale-CSS6fwi8.js → useUserLocale-B3bnZHMZ.js} +401 -374
- package/dist-lib/useUserLocale-B3bnZHMZ.js.map +1 -0
- package/dist-lib/value-DgzPSFZM.js.map +1 -1
- package/package.json +1 -1
- package/dist-lib/useUserLocale-CSS6fwi8.js.map +0 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Row-count formatting for list views. Display precision MUST match data
|
|
3
|
+
* accuracy (docs/plans/2026-05-18-declarative-row-count.md, Principle 3):
|
|
4
|
+
*
|
|
5
|
+
* - an exact count renders to the unit with thousands separators
|
|
6
|
+
* (3,613,711) - it is known precisely;
|
|
7
|
+
* - an estimate renders coarse (~3.6M) - showing an estimate to the unit
|
|
8
|
+
* is false precision and is wrong.
|
|
9
|
+
*
|
|
10
|
+
* This is the single shared count formatter; the SDK has no other. Field
|
|
11
|
+
* cell factories that call `toLocaleString` for per-cell numbers are a
|
|
12
|
+
* separate concern and are not routed through here.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* formatEstimatedCount renders a coarse estimate: a `~` prefix, ~2
|
|
16
|
+
* significant figures, and a magnitude suffix (K/M/B).
|
|
17
|
+
*
|
|
18
|
+
* 3_613_711 -> "~3.6M"
|
|
19
|
+
* 850_000 -> "~850K"
|
|
20
|
+
* 12_000 -> "~12K"
|
|
21
|
+
* 940 -> "~940" (below 1000: no suffix, the ~ still signals an estimate)
|
|
22
|
+
*
|
|
23
|
+
* Two significant figures: a value's first 2 digits are kept and the rest
|
|
24
|
+
* collapse to the magnitude suffix. 3_613_711 -> 3.6M (one decimal because
|
|
25
|
+
* the leading digit is single); 12_000 -> 12K (no decimal because 2 leading
|
|
26
|
+
* digits already give 2 sig figs).
|
|
27
|
+
*/
|
|
28
|
+
export declare function formatEstimatedCount(total: number): string;
|
|
29
|
+
/**
|
|
30
|
+
* formatExactCount renders an exact count to the unit with locale thousands
|
|
31
|
+
* separators: 3613711 -> "3,613,711".
|
|
32
|
+
*/
|
|
33
|
+
export declare function formatExactCount(total: number): string;
|
|
34
|
+
/**
|
|
35
|
+
* formatCount picks the rendering by the count strategy actually used to
|
|
36
|
+
* produce `total` (the server's `meta.count_mode`), NOT the entity schema:
|
|
37
|
+
* a forced exact count must render exact even on a `count: estimated`
|
|
38
|
+
* entity.
|
|
39
|
+
*/
|
|
40
|
+
export declare function formatCount(total: number, mode: "exact" | "estimated"): string;
|
package/dist-lib/types/api.d.ts
CHANGED
|
@@ -1,10 +1,27 @@
|
|
|
1
1
|
import type { AccentDef, LocalizedString } from "./schema";
|
|
2
2
|
import type { HydratedFile } from "./files";
|
|
3
3
|
export interface ListMeta {
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Total matching rows. Present only when the request asked for a count
|
|
6
|
+
* (`count=with` / `count=only` / `count=exact`). Absent (undefined) on a
|
|
7
|
+
* window-only response (`count` omitted) - the page of rows arrives
|
|
8
|
+
* without ever blocking on the count. Treat `count_mode === undefined` as
|
|
9
|
+
* "no count yet" and ignore `total` then.
|
|
10
|
+
*/
|
|
11
|
+
total?: number;
|
|
5
12
|
page: number;
|
|
6
13
|
per_page: number;
|
|
7
|
-
|
|
14
|
+
/** Present only when a count was computed (see `total`). */
|
|
15
|
+
total_pages?: number;
|
|
16
|
+
has_more?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* How `total` was produced: "exact" (an exact COUNT(*)) or "estimated"
|
|
19
|
+
* (an O(1) query-planner estimate). Absent when no count was computed.
|
|
20
|
+
* The SDK keys display precision on this, NOT on the entity schema, so a
|
|
21
|
+
* forced exact count renders precisely even on a `count: estimated`
|
|
22
|
+
* entity.
|
|
23
|
+
*/
|
|
24
|
+
count_mode?: "exact" | "estimated";
|
|
8
25
|
}
|
|
9
26
|
export interface ListResponse<T = Record<string, unknown>> {
|
|
10
27
|
data: T[];
|
|
@@ -206,6 +223,16 @@ export interface ListParams {
|
|
|
206
223
|
* every column (default, backwards-compatible).
|
|
207
224
|
*/
|
|
208
225
|
select?: string[];
|
|
226
|
+
/**
|
|
227
|
+
* Row-count strategy for this request. Maps to the `?count=` query param.
|
|
228
|
+
* omitted / "window" - rows only, no total (the page-window request;
|
|
229
|
+
* the table never blocks on a count).
|
|
230
|
+
* "only" - total only, no rows (the follow-up count request).
|
|
231
|
+
* "with" - rows + total, using the entity's declared strategy.
|
|
232
|
+
* "exact" - rows + forced exact total.
|
|
233
|
+
* See docs/plans/2026-05-18-declarative-row-count.md.
|
|
234
|
+
*/
|
|
235
|
+
count?: "window" | "only" | "with" | "exact";
|
|
209
236
|
}
|
|
210
237
|
/** Minimal filter node type for API params (matches backend FilterNode). */
|
|
211
238
|
export interface FilterNodeParam {
|
|
@@ -284,6 +284,16 @@ export interface Entity {
|
|
|
284
284
|
* docs/plans/completed/2026-05-18-realtime-cdc-redesign.md.
|
|
285
285
|
*/
|
|
286
286
|
realtime?: boolean;
|
|
287
|
+
/**
|
|
288
|
+
* Per-entity row-count strategy for list views. "exact" (default, also
|
|
289
|
+
* the meaning of absent) shows an exact total; "estimated" shows an
|
|
290
|
+
* O(1) query-planner estimate, rendered coarse (~3.6M) for high-volume
|
|
291
|
+
* tables. Independent of `realtime`. The SDK keys list-view count
|
|
292
|
+
* precision on the response `meta.count_mode`, not this field, so a
|
|
293
|
+
* forced exact count still renders precisely. See
|
|
294
|
+
* docs/plans/2026-05-18-declarative-row-count.md.
|
|
295
|
+
*/
|
|
296
|
+
count?: "exact" | "estimated";
|
|
287
297
|
}
|
|
288
298
|
export interface ExportConfig {
|
|
289
299
|
enabled?: boolean;
|