sera-components 1.6.10 → 1.7.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.
@@ -1,10 +1,10 @@
1
1
  import { Trie } from '../utils';
2
- import { NavigateFunction, Permission, NoArgsRoute, NoURLArgsRoute } from '../types';
2
+ import { NavigateFunction, Permission, Route } from '../types';
3
3
  type MenuKey = string;
4
- export interface MenuRoute<Q, R> {
5
- path: NoURLArgsRoute<Q> | NoArgsRoute;
4
+ export interface MenuRoute<P, R> {
5
+ path: Route<P>;
6
6
  role: R;
7
- defaultPathArgs?: Q;
7
+ defaultPathArgs?: P;
8
8
  }
9
9
  export interface SeraMenuItem<R> {
10
10
  key: MenuKey;
@@ -1,10 +1,10 @@
1
- import { EntityRoutes, LinkComponent } from './types';
1
+ import { EntityRoutes, EntityLinkComponent } from './types';
2
2
  export declare const SeraContext: import('react').Context<{
3
- link: LinkComponent;
3
+ EntityLink: EntityLinkComponent;
4
4
  entityRoutes: EntityRoutes;
5
5
  }>;
6
- export declare const SeraContextProvider: ({ link, entityRoutes, children, }: {
7
- link: LinkComponent;
6
+ export declare const SeraContextProvider: ({ EntityLink, entityRoutes, children, }: {
7
+ EntityLink: EntityLinkComponent;
8
8
  entityRoutes: EntityRoutes;
9
9
  children: React.ReactNode;
10
10
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,9 +1,16 @@
1
1
  import { SeraColumn } from './make-columns';
2
2
  import { SeraActionConfig } from './table-action';
3
3
  export interface SeraEmbeddedTableProps<R> {
4
+ /** Pagination configuration */
4
5
  pagination?: {
6
+ /** Position(s) to display pagination controls */
5
7
  positions?: Set<"topRight" | "bottomLeft" | "bottomCenter" | "bottomRight">;
8
+ /** Whether to show page size selector. Defaults to true. */
6
9
  showSizeChanger?: boolean;
10
+ /** Initial page size. Defaults to 10. */
11
+ pageSize?: number;
12
+ /** Available page size options in the dropdown. Defaults to [10, 20, 50, 100]. */
13
+ pageSizeOptions?: number[];
7
14
  };
8
15
  columns: SeraColumn<R>[];
9
16
  data: R[];
@@ -1,9 +1,11 @@
1
1
  import { MantineSize } from '@mantine/core';
2
- export declare const TablePagination: ({ total, pageIndex, pageSize, allowPageSizeChange, onUpdatePagination, }: {
2
+ export declare const TablePagination: ({ total, pageIndex, pageSize, allowPageSizeChange, pageSizeOptions, onUpdatePagination, }: {
3
3
  total: number;
4
4
  pageIndex: number;
5
5
  pageSize: number;
6
6
  allowPageSizeChange?: boolean;
7
+ /** Available page size options. Defaults to ["10", "20", "50", "100"]. */
8
+ pageSizeOptions?: string[];
7
9
  onUpdatePagination: (pageIndex: number, pageSize: number) => void;
8
10
  }) => import("react/jsx-runtime").JSX.Element;
9
11
  export declare function DataTablePageSizeSelector({ size, values, value, onChange, }: {
@@ -5,9 +5,14 @@ export interface SeraTableProps<ID extends string | number, Q extends {
5
5
  limit: number;
6
6
  offset: number;
7
7
  }, R> {
8
+ /** Pagination configuration */
8
9
  pagination?: {
10
+ /** Position(s) to display pagination controls */
9
11
  positions?: Set<"topRight" | "bottomLeft" | "bottomCenter" | "bottomRight">;
12
+ /** Whether to show page size selector. Defaults to true. */
10
13
  showSizeChanger?: boolean;
14
+ /** Available page size options in the dropdown. Defaults to [10, 20, 50, 100]. */
15
+ pageSizeOptions?: number[];
11
16
  };
12
17
  columns: SeraColumn<R>[];
13
18
  query: ObservableQuery<Q>;
package/dist/types.d.ts CHANGED
@@ -21,49 +21,27 @@ export interface NavigateFunction {
21
21
  }>, options?: any): void | Promise<void>;
22
22
  (delta: number): void | Promise<void>;
23
23
  }
24
- export interface NoArgsRoute {
25
- path(): {
24
+ export interface Route<P> {
25
+ path(args: P): {
26
26
  open: (navigate: NavigateFunction) => void;
27
27
  };
28
- getURL(): string;
28
+ getURL(args: P): string;
29
29
  pathDef: string;
30
30
  }
31
- export interface NoURLArgsRoute<Q> {
32
- path({ queryArgs }: {
33
- queryArgs: Q;
34
- }): {
35
- open: (navigate: NavigateFunction) => void;
36
- };
37
- getURL({ queryArgs }: {
38
- queryArgs: Q;
39
- }): string;
40
- pathDef: string;
41
- }
42
- export interface EntityRoute {
43
- path({ urlArgs }: {
44
- urlArgs: {
45
- id: string | number;
46
- };
47
- }): {
48
- open: (navigate: NavigateFunction) => void;
49
- };
50
- getURL({ urlArgs }: {
51
- urlArgs: {
52
- id: string | number;
53
- };
54
- }): string;
31
+ export interface EntityRoute extends Route<{
32
+ id: string | number;
33
+ }> {
55
34
  }
56
35
  export interface EntityRoutes extends Record<ClassName, {
57
36
  view: EntityRoute;
58
37
  edit: EntityRoute;
59
38
  }> {
60
39
  }
61
- export type LinkComponent = React.FunctionComponent<{
40
+ export type EntityLinkComponent = React.FunctionComponent<{
62
41
  path: EntityRoute;
63
- urlArgs: {
42
+ args: {
64
43
  id: string | number;
65
44
  };
66
- queryArgs: {};
67
45
  openInNewPage?: boolean;
68
46
  children?: React.ReactNode;
69
47
  }>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sera-components",
3
3
  "private": false,
4
- "version": "1.6.10",
4
+ "version": "1.7.0",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"