@rebasepro/app 0.24.0 → 0.24.1-canary.g56af4a4

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/README.md CHANGED
@@ -68,7 +68,7 @@ This package is **framework-agnostic** in the sense that it doesn't depend on an
68
68
  | `useDialogsController` | Programmatic dialog management |
69
69
  | `useSnackbarController` | Show snackbar notifications |
70
70
  | `useModeController` / `useBuildModeController` | Light/dark mode |
71
- | `useStorageSource` / `useBackendStorageSource` | Storage source from context |
71
+ | `useStorageSource` | Storage source from context |
72
72
  | `useRebaseClient` | Access the `RebaseClient` instance |
73
73
  | `useLargeLayout` | Responsive layout breakpoint hook |
74
74
  | `useClipboard` | Copy-to-clipboard |
@@ -12,8 +12,8 @@ export declare function getSubcollectionColumnId(collection: AdminCollection<any
12
12
  * Every child view gets a 200px button column that opens its tab. For a relation
13
13
  * declared in `relations` that button is the relation's only presence in the
14
14
  * table. For one declared as a property it is the second: the property's own
15
- * column is already there, hydrated by the list fetch's `include: ["*"]`, showing
16
- * the child rows themselves — and carrying the *same heading*, because the tab
15
+ * column is already there, hydrated by the list fetch's `include`
16
+ * (`getRelationIncludeParams`), showing the child rows themselves — and carrying the *same heading*, because the tab
17
17
  * takes its name from the declaring property. Two columns called "Applications",
18
18
  * one of them a button, and nothing in the header to tell them apart.
19
19
  *
@@ -2,6 +2,12 @@ import { Entity, FilterValues, User } from "@rebasepro/types";
2
2
  import { EntityTableController, AdminCollection } from "@rebasepro/cms-types";
3
3
  import { ScrollRestorationController } from "./useScrollRestoration.js";
4
4
  export declare const DEFAULT_PAGE_SIZE = 50;
5
+ /**
6
+ * Rows held with `pagination: false` past which development builds warn. The
7
+ * docs promise every row, so they are all loaded; but tens of thousands of
8
+ * them sit in memory and re-render on every change, and nothing said so.
9
+ */
10
+ export declare const UNPAGINATED_WARNING_ROWS = 10000;
5
11
  export type DataTableControllerProps<M extends Record<string, any> = any> = {
6
12
  /**
7
13
  * Full path where the data of this table is located
@@ -26,6 +32,14 @@ export type DataTableControllerProps<M extends Record<string, any> = any> = {
26
32
  * When set to true the filters and sort will be updated in the URL
27
33
  */
28
34
  updateUrl?: boolean;
35
+ /**
36
+ * Read rows at all. Defaults to `true`. `false` closes the subscription and
37
+ * reads nothing — for a view that keeps the controller for its search and
38
+ * filters but draws its rows some other way, like the board, whose columns
39
+ * each read their own. The rows already held stay until it is enabled
40
+ * again, which reads afresh.
41
+ */
42
+ enabled?: boolean;
29
43
  };
30
44
  /**
31
45
  * Use this hook to build a controller for the {@link DataCollectionTable}.
@@ -42,4 +56,4 @@ export type DataTableControllerProps<M extends Record<string, any> = any> = {
42
56
  * @param fixedFilterFromProps
43
57
  * @param updateUrl
44
58
  */
45
- export declare function useDataTableController<M extends Record<string, any> = any, USER extends User = User>({ path, collection, scrollRestoration, entitiesDisplayedFirst, lastDeleteTimestamp, fixedFilter: fixedFilterFromProps, updateUrl }: DataTableControllerProps<M>): EntityTableController<M>;
59
+ export declare function useDataTableController<M extends Record<string, any> = any, USER extends User = User>({ path, collection, scrollRestoration, entitiesDisplayedFirst, lastDeleteTimestamp, fixedFilter: fixedFilterFromProps, updateUrl, enabled }: DataTableControllerProps<M>): EntityTableController<M>;
@@ -1,4 +1,18 @@
1
1
  import { Entity, FilterValues } from "@rebasepro/types";
2
+ /**
3
+ * Where a collection view was, and the rows to show when it comes back.
4
+ *
5
+ * `data` is the rows around what was on screen — a page either side, when the
6
+ * view reports what it draws — starting at row `dataOffset` (0 when absent:
7
+ * `data` then starts at the first row). It used to be every row the view held,
8
+ * which a table scrolled to 100,000 rows kept for the rest of the session and
9
+ * read again in full on the way back.
10
+ */
11
+ export type CollectionScrollEntry = {
12
+ scrollOffset: number;
13
+ data: Entity<any>[];
14
+ dataOffset?: number;
15
+ };
2
16
  /**
3
17
  * Forget every collection's scroll position and the rows kept with it.
4
18
  *
@@ -7,15 +21,10 @@ import { Entity, FilterValues } from "@rebasepro/types";
7
21
  */
8
22
  export declare function clearCollectionScrollCache(): void;
9
23
  export type ScrollRestorationController = {
10
- getCollectionScroll: (path: string, filters?: FilterValues<any>) => {
11
- scrollOffset: number;
12
- data: Entity<any>[];
13
- } | undefined;
14
- updateCollectionScroll: (props: {
24
+ getCollectionScroll: (path: string, filters?: FilterValues<any>) => CollectionScrollEntry | undefined;
25
+ updateCollectionScroll: (props: CollectionScrollEntry & {
15
26
  path: string;
16
- scrollOffset: number;
17
27
  filters?: FilterValues<any>;
18
- data: Entity<any>[];
19
28
  }) => void;
20
29
  };
21
30
  export declare function useScrollRestoration(): ScrollRestorationController;
@@ -14,6 +14,12 @@ export interface StorageSourcesContextValue {
14
14
  registry: Record<string, StorageSourceDefinition>;
15
15
  /** Built {@link StorageSource} for direct sources, keyed by key. */
16
16
  sources: Record<string, StorageSource>;
17
+ /**
18
+ * A server-routed source for a key not (yet) in `sources` — requests carry
19
+ * `?storageId=<key>`, so the server serves it or refuses naming it, rather
20
+ * than the panel guessing the default. Absent without a client.
21
+ */
22
+ createSource?: (key: string) => StorageSource;
17
23
  }
18
24
  /** @internal */
19
25
  export declare const StorageSourcesContext: React.Context<StorageSourcesContextValue>;