@easyvision/easyvision-ui 1.5.1 → 1.6.1

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
@@ -36,6 +36,7 @@ import {
36
36
  - [Column definitions](#column-definitions)
37
37
  - [Column sizing, truncation, and resizing](#column-sizing-truncation-and-resizing)
38
38
  - [Body height & sticky header](#body-height--sticky-header)
39
+ - [Pagination footer modes](#pagination-footer-modes)
39
40
  - [Selection](#selection)
40
41
  - [Highlighting rows (master/detail)](#highlighting-rows-masterdetail)
41
42
  - [Binding a multifilter](#binding-a-multifilter)
@@ -779,6 +780,46 @@ Recommended pattern: `"min(<vh>, <px>)"`. On most monitors the px cap wins (cons
779
780
 
780
781
  Both axes get a thin, theme-aware scrollbar via co-located CSS in [`EasyVisionTable.css`](./table/EasyVisionTable.css), so the styling ships with the component and works in any host project regardless of how that project handles scrollbars globally. Dark mode is detected via `prefers-color-scheme`, a `.dark` ancestor (Shadcn convention), or `[data-theme='dark']`.
781
782
 
783
+ #### Pagination footer modes
784
+
785
+ `paginationDisplay` controls **how** the pagination footer is rendered. It's independent of `paginationMode`, which controls **where** slicing happens (in-memory vs. server). Defaults to `'always'`, so existing tables are unchanged.
786
+
787
+ | value | rows-per-page selector | item count | page selector + nav |
788
+ |---|---|---|---|
789
+ | `'always'` (default) | shown | shown | shown |
790
+ | `'fixedItemsPerPage'` | hidden | shown | only when `totalCount > itemsPerPage` |
791
+ | `'fixedTotalItems'` | hidden | hidden | hidden (entire footer is not rendered) |
792
+
793
+ ```tsx
794
+ // Default: full footer
795
+ <EasyVisionTable id="users" data={users} columns={cols} />
796
+
797
+ // Page size is a fixed product choice; pagination appears only on overflow.
798
+ // Item count stays visible so users still see "X results".
799
+ <EasyVisionTable
800
+ id="dashboard-alerts"
801
+ data={alerts}
802
+ columns={cols}
803
+ itemsPerPage={5}
804
+ paginationDisplay="fixedItemsPerPage"
805
+ />
806
+
807
+ // Short, naturally-bounded list (a product's plans, conditions, …).
808
+ // All rows render in one page; the footer is gone entirely.
809
+ <EasyVisionTable
810
+ id="product-plans"
811
+ data={plans}
812
+ columns={cols}
813
+ itemsPerPage={9999}
814
+ paginationDisplay="fixedTotalItems"
815
+ />
816
+ ```
817
+
818
+ Notes:
819
+ - For `'fixedTotalItems'`, pair with a large `itemsPerPage` so every row actually renders — the prop hides the controls but doesn't change the page size.
820
+ - For `'fixedItemsPerPage'`, the rows-per-page *selector* is hidden because "fixed" implies the size is a deliberate setting; the underlying `itemsPerPage` slice value still drives slicing as usual.
821
+ - API mode (`paginationMode="api"`) works with all three values. In `'fixedItemsPerPage'`, the server still receives the configured `itemsPerPage`; nav controls just don't surface until `totalCount` exceeds it.
822
+
782
823
  ### Selection
783
824
 
784
825
  ```tsx
@@ -976,6 +1017,7 @@ The toolbar row is hidden entirely when none of `toolbarLeft`, `toolbarRight`, o
976
1017
  | `getRowId` | `(row) => string` | `(row) => String(row.id)` — override only for non-standard shapes |
977
1018
  | `itemsPerPage` | `number` | `10` |
978
1019
  | `itemsPerPageOptions` | `number[]` | `[10, 15, 20]` |
1020
+ | `paginationDisplay` | `'always' \| 'fixedItemsPerPage' \| 'fixedTotalItems'` | `'always'` — footer rendering mode; see [Pagination footer modes](#pagination-footer-modes) |
979
1021
  | `enableRowSelection` | `boolean` | `false` |
980
1022
  | `selectAllScope` | `'page' \| 'all' \| 'toggleable'` | `'toggleable'` |
981
1023
  | `selectAllResolution` | `'lazy' \| 'eager'` | `'lazy'` — `'eager'` materializes the full id list on wildcard select-all and locks sort while active |
package/dist/index.cjs CHANGED
@@ -1889,30 +1889,36 @@ function PaginationFooter({
1889
1889
  itemsPerPageOptions,
1890
1890
  onPageChange,
1891
1891
  onItemsPerPageChange,
1892
- labels
1892
+ labels,
1893
+ display = "always"
1893
1894
  }) {
1894
1895
  const totalPages = Math.max(1, Math.ceil(totalCount / itemsPerPage));
1896
+ const fitsInOnePage = totalCount <= itemsPerPage;
1897
+ const showRowsPerPage = display === "always";
1898
+ const showPageNav = display === "always" || !fitsInOnePage;
1895
1899
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ev-table-footer", children: [
1896
1900
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ev-table-footer-section", children: [
1897
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: labels.rowsPerPage }),
1898
- /* @__PURE__ */ jsxRuntime.jsxs(
1899
- Select,
1900
- {
1901
- value: String(itemsPerPage),
1902
- onValueChange: (v) => onItemsPerPageChange(Number(v)),
1903
- children: [
1904
- /* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "ev-table-footer-ipp", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, {}) }),
1905
- /* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: itemsPerPageOptions.map((opt) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: String(opt), children: opt }, opt)) })
1906
- ]
1907
- }
1908
- ),
1901
+ showRowsPerPage && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1902
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: labels.rowsPerPage }),
1903
+ /* @__PURE__ */ jsxRuntime.jsxs(
1904
+ Select,
1905
+ {
1906
+ value: String(itemsPerPage),
1907
+ onValueChange: (v) => onItemsPerPageChange(Number(v)),
1908
+ children: [
1909
+ /* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "ev-table-footer-ipp", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, {}) }),
1910
+ /* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: itemsPerPageOptions.map((opt) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: String(opt), children: opt }, opt)) })
1911
+ ]
1912
+ }
1913
+ )
1914
+ ] }),
1909
1915
  /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
1910
1916
  totalCount,
1911
1917
  " ",
1912
1918
  labels.results
1913
1919
  ] })
1914
1920
  ] }),
1915
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ev-table-footer-section", children: [
1921
+ showPageNav && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ev-table-footer-section", children: [
1916
1922
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: labels.page }),
1917
1923
  /* @__PURE__ */ jsxRuntime.jsxs(
1918
1924
  Select,
@@ -2155,6 +2161,7 @@ function EasyVisionTable(props) {
2155
2161
  getRowId: getRowIdProp,
2156
2162
  itemsPerPage: itemsPerPageProp = 10,
2157
2163
  itemsPerPageOptions = [10, 15, 20],
2164
+ paginationDisplay = "always",
2158
2165
  enableRowSelection = false,
2159
2166
  selectAllScope = "toggleable",
2160
2167
  selectAllResolution = "lazy",
@@ -2774,7 +2781,7 @@ function EasyVisionTable(props) {
2774
2781
  ] })
2775
2782
  }
2776
2783
  ),
2777
- /* @__PURE__ */ jsxRuntime.jsx(
2784
+ paginationDisplay !== "fixedTotalItems" && /* @__PURE__ */ jsxRuntime.jsx(
2778
2785
  PaginationFooter,
2779
2786
  {
2780
2787
  currentPage: page,
@@ -2783,7 +2790,8 @@ function EasyVisionTable(props) {
2783
2790
  itemsPerPageOptions,
2784
2791
  onPageChange: (p) => patch({ page: p }),
2785
2792
  onItemsPerPageChange: (n) => patch({ itemsPerPage: n, page: 1 }),
2786
- labels
2793
+ labels,
2794
+ display: paginationDisplay
2787
2795
  }
2788
2796
  )
2789
2797
  ] })