@tailor-platform/app-shell 1.0.0 → 1.0.2

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.
@@ -831,19 +831,36 @@ export declare interface CollectionControl<TFieldName extends string = string, T
831
831
  clearSort: () => void;
832
832
  pageSize: number;
833
833
  setPageSize: (size: number) => void;
834
- cursor: string | null;
835
- paginationDirection: "forward" | "backward";
836
- nextPage: (cursor: string) => void;
837
- prevPage: (cursor: string) => void;
834
+ /** Navigate to the next page. Mode-aware: pushes cursor in forward, pops stack in backward. */
835
+ goToNextPage: (pageInfo: Pick<PageInfo, "endCursor">) => void;
836
+ /** Navigate to the previous page. Mode-aware: pops stack in forward, pushes cursor in backward. */
837
+ goToPrevPage: (pageInfo: Pick<PageInfo, "startCursor">) => void;
838
838
  resetPage: () => void;
839
839
  goToFirstPage: () => void;
840
840
  /**
841
841
  * Navigate to the last page.
842
842
  *
843
- * Requests the last `pageSize` items by setting `paginationDirection` to
844
- * `"backward"` with no cursor.
843
+ * When `total` is provided, the hook computes `total % pageSize` so the last
844
+ * page aligns with forward-pagination boundaries. Without `total`, it falls
845
+ * back to a full `pageSize` fetch.
845
846
  */
846
- goToLastPage: () => void;
847
+ goToLastPage: (total?: number | null) => void;
848
+ /**
849
+ * Determine whether a previous page exists, given the server's `pageInfo`.
850
+ * Accounts for the current pagination direction and cursor stack.
851
+ */
852
+ getHasPrevPage: (pageInfo: Pick<PageInfo, "hasPreviousPage">) => boolean;
853
+ /**
854
+ * Determine whether a next page exists, given the server's `pageInfo`.
855
+ * Accounts for the current pagination direction and cursor stack.
856
+ */
857
+ getHasNextPage: (pageInfo: Pick<PageInfo, "hasNextPage">) => boolean;
858
+ /**
859
+ * Monotonically increasing counter that bumps on every pagination reset.
860
+ * Used internally by `usePageCounter` to detect external resets (e.g.
861
+ * filter/sort changes) and sync `currentPage`.
862
+ */
863
+ resetCount: number;
847
864
  }
848
865
 
849
866
  /**
@@ -1690,8 +1707,14 @@ export declare interface DataTableContextValue<TRow extends Record<string, unkno
1690
1707
  pageInfo: PageInfo;
1691
1708
  total: number | null;
1692
1709
  totalPages: number | null;
1693
- nextPage: (cursor: string) => void;
1694
- prevPage: (cursor: string) => void;
1710
+ /** 1-based page counter, automatically kept in sync by navigation actions. */
1711
+ currentPage: number;
1712
+ goToNextPage: (pageInfo: Pick<PageInfo, "endCursor">) => void;
1713
+ goToPrevPage: (pageInfo: Pick<PageInfo, "startCursor">) => void;
1714
+ /** Jump to the first page. */
1715
+ goToFirstPage: () => void;
1716
+ /** Jump to the last page. Only functional when `totalPages` is known. */
1717
+ goToLastPage: () => void;
1695
1718
  hasPrevPage: boolean;
1696
1719
  hasNextPage: boolean;
1697
1720
  /**
@@ -1699,6 +1722,8 @@ export declare interface DataTableContextValue<TRow extends Record<string, unkno
1699
1722
  * configured. Used to render the correct number of skeleton / ghost rows.
1700
1723
  */
1701
1724
  pageSize: number;
1725
+ /** Change the page size and reset to the first page. */
1726
+ setPageSize: (size: number) => void;
1702
1727
  columns: Column<TRow>[];
1703
1728
  visibleColumns: Column<TRow>[];
1704
1729
  toggleColumn: (fieldOrId: string) => void;
@@ -4945,8 +4970,18 @@ export declare interface UseDataTableReturn<TRow extends Record<string, unknown>
4945
4970
  pageInfo: PageInfo;
4946
4971
  total: number | null;
4947
4972
  totalPages: number | null;
4948
- nextPage: (cursor: string) => void;
4949
- prevPage: (cursor: string) => void;
4973
+ /** 1-based page counter, automatically kept in sync by navigation actions. */
4974
+ currentPage: number;
4975
+ /** Navigate to the next page. Mode-aware: pushes cursor in forward, pops stack in backward. */
4976
+ goToNextPage: (pageInfo: Pick<PageInfo, "endCursor">) => void;
4977
+ /** Navigate to the previous page. Mode-aware: pops stack in forward, pushes cursor in backward. */
4978
+ goToPrevPage: (pageInfo: Pick<PageInfo, "startCursor">) => void;
4979
+ /** Jump to the first page. */
4980
+ goToFirstPage: () => void;
4981
+ /** Jump to the last page. Only functional when `totalPages` is known. */
4982
+ goToLastPage: () => void;
4983
+ /** Change the page size and reset to the first page. */
4984
+ setPageSize: (size: number) => void;
4950
4985
  hasPrevPage: boolean;
4951
4986
  hasNextPage: boolean;
4952
4987
  columns: Column<TRow>[];