@declarion/react 0.12.4 → 0.15.0
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-CcogMLSZ.js → DraggableChildrenTable-I1gyEEIJ.js} +1 -1
- package/dist-lib/{Grid-Cwxca9aO.js → Grid-_7PlIyGn.js} +1 -1
- package/dist-lib/api/entities.d.ts +13 -7
- package/dist-lib/{dataTableStyles-EMyLDQRB.js → dataTableStyles-WuxWH5x7.js} +12 -12
- package/dist-lib/hooks/useCursorEntityData.d.ts +57 -0
- package/dist-lib/hooks/useEntityData.d.ts +2 -2
- package/dist-lib/index.js +2191 -2058
- package/dist-lib/types/api.d.ts +24 -0
- package/dist-lib/types/schema.d.ts +10 -0
- package/dist-lib/{value-CrpaObP_.js → value-YOCedRQq.js} +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { s as e } from "./DynamicIcon-DCRdxxZ7.js";
|
|
2
|
-
import { Xt as t, Yt as n, a as r, i, lt as a, n as o, r as s, t as c, xt as l } from "./dataTableStyles-
|
|
2
|
+
import { Xt as t, Yt as n, a as r, i, lt as a, n as o, r as s, t as c, xt as l } from "./dataTableStyles-WuxWH5x7.js";
|
|
3
3
|
import { useCallback as u, useMemo as d, useRef as f } from "react";
|
|
4
4
|
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
5
5
|
import { DndContext as h, PointerSensor as g, closestCenter as _, useSensor as v, useSensors as y } from "@dnd-kit/core";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as e, b as t, d as n, f as r, i, o as a, t as o, v as s, x as c, y as l } from "./value-
|
|
1
|
+
import { _ as e, b as t, d as n, f as r, i, o as a, t as o, v as s, x as c, y as l } from "./value-YOCedRQq.js";
|
|
2
2
|
import { useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
3
3
|
import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
4
4
|
import { DndContext as v, PointerSensor as y, closestCenter as b, useSensor as x, useSensors as S } from "@dnd-kit/core";
|
|
@@ -32,18 +32,24 @@ export declare class EntityClient<T extends Record<string, unknown> = Record<str
|
|
|
32
32
|
get(id: string): Promise<T & EnrichedRow & RowHelpers>;
|
|
33
33
|
/** List records with cursor-based pagination, field selection, and expansion.
|
|
34
34
|
*
|
|
35
|
-
*
|
|
36
|
-
* `cursor_semantics_mismatch` (sort grammar version bump)
|
|
37
|
-
* `cursor_locale_changed` (active locale switched mid-pagination),
|
|
38
|
-
* `
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
35
|
+
* Recovery on cursor-stale signals: when the server returns
|
|
36
|
+
* `cursor_semantics_mismatch` (sort grammar version bump),
|
|
37
|
+
* `cursor_locale_changed` (active locale switched mid-pagination), or
|
|
38
|
+
* `archive_cursor_invalid` (an undecodable cross-store archive cursor), the
|
|
39
|
+
* `after` token is dropped and the request is retried once from the top.
|
|
40
|
+
*
|
|
41
|
+
* CRITICAL for accumulating callers (infinite scroll): the returned
|
|
42
|
+
* `reset` flag is `true` when this recovery fired. The refetched data is
|
|
43
|
+
* WINDOW 1, not the next page - an accumulating `useInfiniteQuery` MUST
|
|
44
|
+
* discard its prior pages and start from this one, never append it as the
|
|
45
|
+
* next page (which would duplicate the head and drop the middle). Callers
|
|
46
|
+
* that fetch a single window can ignore `reset`. See Decisions Log #14.
|
|
42
47
|
*/
|
|
43
48
|
list(params?: V2ListParams): Promise<{
|
|
44
49
|
data: (T & RowHelpers)[];
|
|
45
50
|
meta: V2Meta;
|
|
46
51
|
$refs: Refs;
|
|
52
|
+
reset: boolean;
|
|
47
53
|
}>;
|
|
48
54
|
/** Create a single record. Wraps in array, returns unwrapped result. */
|
|
49
55
|
create(item: Partial<T> & Record<string, unknown>): Promise<T & EnrichedRow & RowHelpers>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { s as e, t } from "./DynamicIcon-DCRdxxZ7.js";
|
|
2
|
-
import { C as n, E as r, T as i, W as a, _ as o, b as s, c, d as l, f as u, g as d, h as f, i as p, k as m, l as h, m as g, n as _, o as ee, p as v, r as y, t as b, u as x, v as S, w as C, x as te, y as ne } from "./value-
|
|
2
|
+
import { C as n, E as r, T as i, W as a, _ as o, b as s, c, d as l, f as u, g as d, h as f, i as p, k as m, l as h, m as g, n as _, o as ee, p as v, r as y, t as b, u as x, v as S, w as C, x as te, y as ne } from "./value-YOCedRQq.js";
|
|
3
3
|
import { a as w, i as T, o as E, r as D, s as O, t as k } from "./rich-text-CJpzFOG5.js";
|
|
4
4
|
import { Suspense as A, forwardRef as j, lazy as M, useCallback as N, useEffect as P, useLayoutEffect as F, useMemo as I, useRef as L, useState as R } from "react";
|
|
5
5
|
import { useQuery as re } from "@tanstack/react-query";
|
|
@@ -2398,8 +2398,8 @@ function zn({ field: e, fieldName: t, value: n, mode: r, onChange: i, record: a,
|
|
|
2398
2398
|
}
|
|
2399
2399
|
//#endregion
|
|
2400
2400
|
//#region src/hooks/useEntityData.ts
|
|
2401
|
-
function Bn(e, t) {
|
|
2402
|
-
let
|
|
2401
|
+
function Bn(e, t, n = !0) {
|
|
2402
|
+
let r = {
|
|
2403
2403
|
...t,
|
|
2404
2404
|
count: "window"
|
|
2405
2405
|
};
|
|
@@ -2407,15 +2407,15 @@ function Bn(e, t) {
|
|
|
2407
2407
|
queryKey: [
|
|
2408
2408
|
"entity-data",
|
|
2409
2409
|
e,
|
|
2410
|
-
|
|
2410
|
+
r
|
|
2411
2411
|
],
|
|
2412
|
-
queryFn: ({ signal: t }) => Qt(e,
|
|
2413
|
-
enabled: !!e,
|
|
2412
|
+
queryFn: ({ signal: t }) => Qt(e, r, { signal: t }),
|
|
2413
|
+
enabled: !!e && n,
|
|
2414
2414
|
placeholderData: (t, n) => n?.queryKey?.[1] === e ? t : void 0
|
|
2415
2415
|
});
|
|
2416
2416
|
}
|
|
2417
|
-
function Vn(e, t) {
|
|
2418
|
-
let
|
|
2417
|
+
function Vn(e, t, n = !0) {
|
|
2418
|
+
let r = {
|
|
2419
2419
|
...t,
|
|
2420
2420
|
count: "only",
|
|
2421
2421
|
page: void 0,
|
|
@@ -2428,10 +2428,10 @@ function Vn(e, t) {
|
|
|
2428
2428
|
queryKey: [
|
|
2429
2429
|
"entity-count",
|
|
2430
2430
|
e,
|
|
2431
|
-
|
|
2431
|
+
r
|
|
2432
2432
|
],
|
|
2433
|
-
queryFn: ({ signal: t }) => Qt(e,
|
|
2434
|
-
enabled: !!e,
|
|
2433
|
+
queryFn: ({ signal: t }) => Qt(e, r, { signal: t }),
|
|
2434
|
+
enabled: !!e && n,
|
|
2435
2435
|
retry: 1,
|
|
2436
2436
|
staleTime: 3e4,
|
|
2437
2437
|
placeholderData: (t, n) => n?.queryKey?.[1] === e ? t : void 0
|
|
@@ -3451,7 +3451,7 @@ function Or(e) {
|
|
|
3451
3451
|
}
|
|
3452
3452
|
//#endregion
|
|
3453
3453
|
//#region src/components/file-widgets/GridLazy.tsx
|
|
3454
|
-
var kr = M(() => import("./Grid-
|
|
3454
|
+
var kr = M(() => import("./Grid-_7PlIyGn.js").then((e) => ({ default: e.Grid })));
|
|
3455
3455
|
function Ar() {
|
|
3456
3456
|
return /* @__PURE__ */ B("div", { className: "h-24 w-full rounded-md bg-muted animate-pulse" });
|
|
3457
3457
|
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { FilterNodeParam, Refs, V2Meta } from "../types/api";
|
|
2
|
+
/**
|
|
3
|
+
* Query-key root for the cursor (infinite) entity list. Distinct from the
|
|
4
|
+
* offset list's `"entity-data"` so the SSE handler can RESET it (drop pages,
|
|
5
|
+
* refetch window 1) instead of invalidating it - invalidating an infinite query
|
|
6
|
+
* refetches every accumulated page with its now-stale cursor and corrupts the
|
|
7
|
+
* list. See useSSE.ts.
|
|
8
|
+
*/
|
|
9
|
+
export declare const CURSOR_ENTITY_DATA_KEY = "entity-data-cursor";
|
|
10
|
+
export interface CursorEntityDataParams {
|
|
11
|
+
sort?: string;
|
|
12
|
+
filters?: FilterNodeParam[];
|
|
13
|
+
search?: string;
|
|
14
|
+
select?: string[];
|
|
15
|
+
expand?: string[];
|
|
16
|
+
includeDeleted?: boolean;
|
|
17
|
+
screen?: string;
|
|
18
|
+
preview?: boolean;
|
|
19
|
+
limit: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* useCursorEntityData drives the cursor-native admin list for an archive entity
|
|
23
|
+
* whose `list_pagination` is `cursor` (Postgres-hot + ClickHouse-cold). It
|
|
24
|
+
* accumulates windows with `useInfiniteQuery` over `EntityClient.list` (so the
|
|
25
|
+
* stale-cursor `reset` signal is available), requests the estimated count on
|
|
26
|
+
* the FIRST window only, and resets to window 1 when a stale cursor is hit
|
|
27
|
+
* mid-scroll. Realtime resets are driven centrally by the SSE handler via
|
|
28
|
+
* resetQueries on CURSOR_ENTITY_DATA_KEY.
|
|
29
|
+
*
|
|
30
|
+
* `enabled` gates the query so a NON-cursor entity (offset mode) pays nothing -
|
|
31
|
+
* the page calls both this and useEntityData and enables exactly one.
|
|
32
|
+
*/
|
|
33
|
+
export declare function useCursorEntityData(entity: string | undefined, params: CursorEntityDataParams, enabled: boolean): {
|
|
34
|
+
rows: (Record<string, unknown> & import("../api/entities").RowHelpers)[];
|
|
35
|
+
refs: Refs | undefined;
|
|
36
|
+
total: number | undefined;
|
|
37
|
+
countMode: string | undefined;
|
|
38
|
+
countUnknown: boolean;
|
|
39
|
+
hasMore: boolean;
|
|
40
|
+
fetchNextPage: (options?: import("@tanstack/react-query").FetchNextPageOptions) => Promise<import("@tanstack/react-query").InfiniteQueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
41
|
+
data: (Record<string, unknown> & import("../api/entities").RowHelpers)[];
|
|
42
|
+
meta: V2Meta;
|
|
43
|
+
$refs: Refs;
|
|
44
|
+
reset: boolean;
|
|
45
|
+
}, unknown>, Error>>;
|
|
46
|
+
isFetchingNextPage: boolean;
|
|
47
|
+
isLoading: boolean;
|
|
48
|
+
isFetching: boolean;
|
|
49
|
+
isError: boolean;
|
|
50
|
+
error: Error | null;
|
|
51
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@tanstack/react-query").InfiniteData<{
|
|
52
|
+
data: (Record<string, unknown> & import("../api/entities").RowHelpers)[];
|
|
53
|
+
meta: V2Meta;
|
|
54
|
+
$refs: Refs;
|
|
55
|
+
reset: boolean;
|
|
56
|
+
}, unknown>, Error>>;
|
|
57
|
+
};
|
|
@@ -8,7 +8,7 @@ import type { ListParams, ListResponse } from "../types/api";
|
|
|
8
8
|
* is fetched separately by `useEntityCount`; the table renders rows the
|
|
9
9
|
* moment this query resolves, independent of count latency.
|
|
10
10
|
*/
|
|
11
|
-
export declare function useEntityData(entity: string | undefined, params: ListParams): import("@tanstack/react-query").UseQueryResult<NoInfer<ListResponse<Record<string, unknown>>>, Error>;
|
|
11
|
+
export declare function useEntityData(entity: string | undefined, params: ListParams, enabled?: boolean): import("@tanstack/react-query").UseQueryResult<NoInfer<ListResponse<Record<string, unknown>>>, Error>;
|
|
12
12
|
/**
|
|
13
13
|
* useEntityCount fetches the total row count for a list view in a SEPARATE
|
|
14
14
|
* request from the window (`count: "only"` - the server skips the data
|
|
@@ -23,4 +23,4 @@ export declare function useEntityData(entity: string | undefined, params: ListPa
|
|
|
23
23
|
* to render. A count failure does NOT break the table: callers treat a
|
|
24
24
|
* failed/absent count as "unknown" and fall back to the loaded row count.
|
|
25
25
|
*/
|
|
26
|
-
export declare function useEntityCount(entity: string | undefined, params: ListParams): import("@tanstack/react-query").UseQueryResult<NoInfer<ListResponse<Record<string, unknown>>>, Error>;
|
|
26
|
+
export declare function useEntityCount(entity: string | undefined, params: ListParams, enabled?: boolean): import("@tanstack/react-query").UseQueryResult<NoInfer<ListResponse<Record<string, unknown>>>, Error>;
|