@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 +42 -0
- package/dist/index.cjs +27 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +28 -19
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -518,6 +518,23 @@ interface EasyVisionTableProps<T> extends BaseStatefulProps {
|
|
|
518
518
|
getRowId?: (row: T) => string;
|
|
519
519
|
itemsPerPage?: number;
|
|
520
520
|
itemsPerPageOptions?: number[];
|
|
521
|
+
/**
|
|
522
|
+
* Controls how the pagination footer is displayed. Independent of
|
|
523
|
+
* `paginationMode` (which decides where slicing happens — local or api).
|
|
524
|
+
*
|
|
525
|
+
* - `'always'` (default): full footer — rows-per-page selector, item count,
|
|
526
|
+
* page selector + nav. Matches the historical behavior.
|
|
527
|
+
* - `'fixedItemsPerPage'`: rows-per-page selector is hidden (the value is
|
|
528
|
+
* considered fixed). Item count is always visible. Page selector + nav
|
|
529
|
+
* appear only when `totalCount > itemsPerPage`. Good for tables where
|
|
530
|
+
* the page size is a deliberate product choice but you still want
|
|
531
|
+
* pagination on overflow.
|
|
532
|
+
* - `'fixedTotalItems'`: the footer is not rendered at all. Pair with a
|
|
533
|
+
* large `itemsPerPage` so every row fits in a single page. Good for
|
|
534
|
+
* short, naturally-bounded lists (a product's plans, conditions,
|
|
535
|
+
* periods, …) where pagination is just noise.
|
|
536
|
+
*/
|
|
537
|
+
paginationDisplay?: 'always' | 'fixedItemsPerPage' | 'fixedTotalItems';
|
|
521
538
|
enableRowSelection?: boolean;
|
|
522
539
|
selectAllScope?: 'page' | 'all' | 'toggleable';
|
|
523
540
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -518,6 +518,23 @@ interface EasyVisionTableProps<T> extends BaseStatefulProps {
|
|
|
518
518
|
getRowId?: (row: T) => string;
|
|
519
519
|
itemsPerPage?: number;
|
|
520
520
|
itemsPerPageOptions?: number[];
|
|
521
|
+
/**
|
|
522
|
+
* Controls how the pagination footer is displayed. Independent of
|
|
523
|
+
* `paginationMode` (which decides where slicing happens — local or api).
|
|
524
|
+
*
|
|
525
|
+
* - `'always'` (default): full footer — rows-per-page selector, item count,
|
|
526
|
+
* page selector + nav. Matches the historical behavior.
|
|
527
|
+
* - `'fixedItemsPerPage'`: rows-per-page selector is hidden (the value is
|
|
528
|
+
* considered fixed). Item count is always visible. Page selector + nav
|
|
529
|
+
* appear only when `totalCount > itemsPerPage`. Good for tables where
|
|
530
|
+
* the page size is a deliberate product choice but you still want
|
|
531
|
+
* pagination on overflow.
|
|
532
|
+
* - `'fixedTotalItems'`: the footer is not rendered at all. Pair with a
|
|
533
|
+
* large `itemsPerPage` so every row fits in a single page. Good for
|
|
534
|
+
* short, naturally-bounded lists (a product's plans, conditions,
|
|
535
|
+
* periods, …) where pagination is just noise.
|
|
536
|
+
*/
|
|
537
|
+
paginationDisplay?: 'always' | 'fixedItemsPerPage' | 'fixedTotalItems';
|
|
521
538
|
enableRowSelection?: boolean;
|
|
522
539
|
selectAllScope?: 'page' | 'all' | 'toggleable';
|
|
523
540
|
/**
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { createContext, forwardRef, useMemo, useSyncExternalStore, useRef, useEf
|
|
|
5
5
|
import { ChevronDown, ChevronUp, Check, Search, X, Plus, ChevronRight, Circle, Calendar as Calendar$1, ChevronLeft, ChevronsUpDown, Loader2, ArrowUp, ArrowDown, ArrowUpDown, Settings2 } from 'lucide-react';
|
|
6
6
|
import { clsx } from 'clsx';
|
|
7
7
|
import { twMerge } from 'tailwind-merge';
|
|
8
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
8
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
9
9
|
import { createStore } from 'zustand/vanilla';
|
|
10
10
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
11
11
|
import { Slot } from '@radix-ui/react-slot';
|
|
@@ -41,10 +41,11 @@ Input.displayName = "Input";
|
|
|
41
41
|
var easyVisionRegistry = createStore((set, get) => ({
|
|
42
42
|
slices: {},
|
|
43
43
|
ensure: (_kind, fullId, init) => {
|
|
44
|
-
const
|
|
44
|
+
const state = get();
|
|
45
|
+
const existing = state.slices[fullId];
|
|
45
46
|
if (existing) return existing;
|
|
46
47
|
const created = init();
|
|
47
|
-
|
|
48
|
+
state.slices[fullId] = created;
|
|
48
49
|
return created;
|
|
49
50
|
},
|
|
50
51
|
patch: (fullId, partial) => {
|
|
@@ -1863,30 +1864,36 @@ function PaginationFooter({
|
|
|
1863
1864
|
itemsPerPageOptions,
|
|
1864
1865
|
onPageChange,
|
|
1865
1866
|
onItemsPerPageChange,
|
|
1866
|
-
labels
|
|
1867
|
+
labels,
|
|
1868
|
+
display = "always"
|
|
1867
1869
|
}) {
|
|
1868
1870
|
const totalPages = Math.max(1, Math.ceil(totalCount / itemsPerPage));
|
|
1871
|
+
const fitsInOnePage = totalCount <= itemsPerPage;
|
|
1872
|
+
const showRowsPerPage = display === "always";
|
|
1873
|
+
const showPageNav = display === "always" || !fitsInOnePage;
|
|
1869
1874
|
return /* @__PURE__ */ jsxs("div", { className: "ev-table-footer", children: [
|
|
1870
1875
|
/* @__PURE__ */ jsxs("div", { className: "ev-table-footer-section", children: [
|
|
1871
|
-
/* @__PURE__ */
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1876
|
+
showRowsPerPage && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1877
|
+
/* @__PURE__ */ jsx("span", { children: labels.rowsPerPage }),
|
|
1878
|
+
/* @__PURE__ */ jsxs(
|
|
1879
|
+
Select,
|
|
1880
|
+
{
|
|
1881
|
+
value: String(itemsPerPage),
|
|
1882
|
+
onValueChange: (v) => onItemsPerPageChange(Number(v)),
|
|
1883
|
+
children: [
|
|
1884
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "ev-table-footer-ipp", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
1885
|
+
/* @__PURE__ */ jsx(SelectContent, { children: itemsPerPageOptions.map((opt) => /* @__PURE__ */ jsx(SelectItem, { value: String(opt), children: opt }, opt)) })
|
|
1886
|
+
]
|
|
1887
|
+
}
|
|
1888
|
+
)
|
|
1889
|
+
] }),
|
|
1883
1890
|
/* @__PURE__ */ jsxs("span", { children: [
|
|
1884
1891
|
totalCount,
|
|
1885
1892
|
" ",
|
|
1886
1893
|
labels.results
|
|
1887
1894
|
] })
|
|
1888
1895
|
] }),
|
|
1889
|
-
/* @__PURE__ */ jsxs("div", { className: "ev-table-footer-section", children: [
|
|
1896
|
+
showPageNav && /* @__PURE__ */ jsxs("div", { className: "ev-table-footer-section", children: [
|
|
1890
1897
|
/* @__PURE__ */ jsx("span", { children: labels.page }),
|
|
1891
1898
|
/* @__PURE__ */ jsxs(
|
|
1892
1899
|
Select,
|
|
@@ -2129,6 +2136,7 @@ function EasyVisionTable(props) {
|
|
|
2129
2136
|
getRowId: getRowIdProp,
|
|
2130
2137
|
itemsPerPage: itemsPerPageProp = 10,
|
|
2131
2138
|
itemsPerPageOptions = [10, 15, 20],
|
|
2139
|
+
paginationDisplay = "always",
|
|
2132
2140
|
enableRowSelection = false,
|
|
2133
2141
|
selectAllScope = "toggleable",
|
|
2134
2142
|
selectAllResolution = "lazy",
|
|
@@ -2748,7 +2756,7 @@ function EasyVisionTable(props) {
|
|
|
2748
2756
|
] })
|
|
2749
2757
|
}
|
|
2750
2758
|
),
|
|
2751
|
-
/* @__PURE__ */ jsx(
|
|
2759
|
+
paginationDisplay !== "fixedTotalItems" && /* @__PURE__ */ jsx(
|
|
2752
2760
|
PaginationFooter,
|
|
2753
2761
|
{
|
|
2754
2762
|
currentPage: page,
|
|
@@ -2757,7 +2765,8 @@ function EasyVisionTable(props) {
|
|
|
2757
2765
|
itemsPerPageOptions,
|
|
2758
2766
|
onPageChange: (p) => patch({ page: p }),
|
|
2759
2767
|
onItemsPerPageChange: (n) => patch({ itemsPerPage: n, page: 1 }),
|
|
2760
|
-
labels
|
|
2768
|
+
labels,
|
|
2769
|
+
display: paginationDisplay
|
|
2761
2770
|
}
|
|
2762
2771
|
)
|
|
2763
2772
|
] })
|