@easyvision/easyvision-ui 1.5.0 → 1.6.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/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
@@ -66,10 +66,11 @@ Input.displayName = "Input";
66
66
  var easyVisionRegistry = vanilla.createStore((set, get) => ({
67
67
  slices: {},
68
68
  ensure: (_kind, fullId, init) => {
69
- const existing = get().slices[fullId];
69
+ const state = get();
70
+ const existing = state.slices[fullId];
70
71
  if (existing) return existing;
71
72
  const created = init();
72
- set((s) => ({ slices: { ...s.slices, [fullId]: created } }));
73
+ state.slices[fullId] = created;
73
74
  return created;
74
75
  },
75
76
  patch: (fullId, partial) => {
@@ -1888,30 +1889,36 @@ function PaginationFooter({
1888
1889
  itemsPerPageOptions,
1889
1890
  onPageChange,
1890
1891
  onItemsPerPageChange,
1891
- labels
1892
+ labels,
1893
+ display = "always"
1892
1894
  }) {
1893
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;
1894
1899
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ev-table-footer", children: [
1895
1900
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ev-table-footer-section", children: [
1896
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: labels.rowsPerPage }),
1897
- /* @__PURE__ */ jsxRuntime.jsxs(
1898
- Select,
1899
- {
1900
- value: String(itemsPerPage),
1901
- onValueChange: (v) => onItemsPerPageChange(Number(v)),
1902
- children: [
1903
- /* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "ev-table-footer-ipp", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, {}) }),
1904
- /* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: itemsPerPageOptions.map((opt) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: String(opt), children: opt }, opt)) })
1905
- ]
1906
- }
1907
- ),
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
+ ] }),
1908
1915
  /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
1909
1916
  totalCount,
1910
1917
  " ",
1911
1918
  labels.results
1912
1919
  ] })
1913
1920
  ] }),
1914
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ev-table-footer-section", children: [
1921
+ showPageNav && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ev-table-footer-section", children: [
1915
1922
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: labels.page }),
1916
1923
  /* @__PURE__ */ jsxRuntime.jsxs(
1917
1924
  Select,
@@ -2154,6 +2161,7 @@ function EasyVisionTable(props) {
2154
2161
  getRowId: getRowIdProp,
2155
2162
  itemsPerPage: itemsPerPageProp = 10,
2156
2163
  itemsPerPageOptions = [10, 15, 20],
2164
+ paginationDisplay = "always",
2157
2165
  enableRowSelection = false,
2158
2166
  selectAllScope = "toggleable",
2159
2167
  selectAllResolution = "lazy",
@@ -2773,7 +2781,7 @@ function EasyVisionTable(props) {
2773
2781
  ] })
2774
2782
  }
2775
2783
  ),
2776
- /* @__PURE__ */ jsxRuntime.jsx(
2784
+ paginationDisplay !== "fixedTotalItems" && /* @__PURE__ */ jsxRuntime.jsx(
2777
2785
  PaginationFooter,
2778
2786
  {
2779
2787
  currentPage: page,
@@ -2782,7 +2790,8 @@ function EasyVisionTable(props) {
2782
2790
  itemsPerPageOptions,
2783
2791
  onPageChange: (p) => patch({ page: p }),
2784
2792
  onItemsPerPageChange: (n) => patch({ itemsPerPage: n, page: 1 }),
2785
- labels
2793
+ labels,
2794
+ display: paginationDisplay
2786
2795
  }
2787
2796
  )
2788
2797
  ] })