@deix/rossini-core 6.3.0 → 6.3.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.
|
@@ -18,6 +18,6 @@ export interface PaginatedListProps {
|
|
|
18
18
|
emptyDataLabel?: string;
|
|
19
19
|
disablePaginationLabels?: boolean;
|
|
20
20
|
}
|
|
21
|
-
declare const PaginatedList: ({ urlPrefix, title, subtitle, items, totalItems, onPageChange, rowsPerPageOptions, onPageSizeChange, menu, densityMenuEnabled, maxHeight, emptyDataLabel, disablePaginationLabels, }: PaginatedListProps) => React.JSX.Element;
|
|
21
|
+
declare const PaginatedList: ({ urlPrefix, title, subtitle, items, totalItems, page, onPageChange, pageSize, rowsPerPageOptions, onPageSizeChange, menu, densityMenuEnabled, maxHeight, emptyDataLabel, disablePaginationLabels, }: PaginatedListProps) => React.JSX.Element;
|
|
22
22
|
export default PaginatedList;
|
|
23
23
|
//# sourceMappingURL=PaginatedList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaginatedList.d.ts","sourceRoot":"","sources":["../../../../src/components/display/PaginatedList/PaginatedList.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAqB5C,OAAiB,EAAW,aAAa,EAAE,MAAM,YAAY,CAAC;AAI9D,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,CAAC,IAAI,EAAE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BpB,kBAAkB,sBAyLpB,CAAC;AACF,eAAe,aAAa,CAAC"}
|
|
@@ -32,14 +32,10 @@ const paginatedListTranslations = {
|
|
|
32
32
|
en: 'No data available',
|
|
33
33
|
},
|
|
34
34
|
};
|
|
35
|
-
const PaginatedList = ({ urlPrefix = 'pl', title, subtitle, items, totalItems,
|
|
36
|
-
//page = 0,
|
|
37
|
-
onPageChange,
|
|
38
|
-
//pageSize = 10,
|
|
39
|
-
rowsPerPageOptions = [10, 25, 50], onPageSizeChange, menu = [], densityMenuEnabled = false, maxHeight = '90vh', emptyDataLabel, disablePaginationLabels = false, }) => {
|
|
35
|
+
const PaginatedList = ({ urlPrefix = 'pl', title, subtitle, items, totalItems, page = 0, onPageChange, pageSize = 10, rowsPerPageOptions = [10, 25, 50], onPageSizeChange, menu = [], densityMenuEnabled = false, maxHeight = '90vh', emptyDataLabel, disablePaginationLabels = false, }) => {
|
|
40
36
|
const locale = useLocale();
|
|
41
|
-
const [
|
|
42
|
-
const [
|
|
37
|
+
const [currentPage, setCurrentPage] = useQueryState(`${urlPrefix}_page`, parseAsInteger.withDefault(page));
|
|
38
|
+
const [currentPageSize, setCurrentPageSize] = useQueryState(`${urlPrefix}_page_size`, parseAsInteger.withDefault(pageSize));
|
|
43
39
|
// Appearance
|
|
44
40
|
const [listDensity, setListDensity] = usePersistedState(`listDensity`, 'standard');
|
|
45
41
|
const [densityMenuAnchorEl, setDensityMenuAnchorEl] = useState(null);
|
|
@@ -72,24 +68,24 @@ rowsPerPageOptions = [10, 25, 50], onPageSizeChange, menu = [], densityMenuEnabl
|
|
|
72
68
|
paginatedListTranslations.rowsPerPage[locale] ||
|
|
73
69
|
'Rows per page',
|
|
74
70
|
":")),
|
|
75
|
-
React.createElement(Select, { labelId: 'page-size-select-label', id: 'page-size-select', value: Number(
|
|
76
|
-
|
|
71
|
+
React.createElement(Select, { labelId: 'page-size-select-label', id: 'page-size-select', value: Number(currentPageSize), label: 'Rows per Page', onChange: (event) => {
|
|
72
|
+
setCurrentPageSize(Number(event.target.value));
|
|
77
73
|
onPageSizeChange(Number(event.target.value));
|
|
78
74
|
}, variant: 'standard' }, rowsPerPageOptions.map((opt) => (React.createElement(MenuItem, { key: opt, value: Number(opt) },
|
|
79
75
|
React.createElement(Typography, { variant: 'caption', sx: { mr: 2 } }, opt)))))),
|
|
80
76
|
React.createElement(Grid, { size: { xs: 12, md: 6 } },
|
|
81
77
|
React.createElement(Box, { sx: { display: 'flex', justifyContent: 'center' } },
|
|
82
|
-
React.createElement(Pagination, { count: Math.ceil(totalItems /
|
|
78
|
+
React.createElement(Pagination, { count: Math.ceil(totalItems / currentPageSize), size: 'small', showFirstButton: true, showLastButton: true, page: currentPage + 1, onChange: onPageChange
|
|
83
79
|
? (_evt, page) => {
|
|
84
|
-
|
|
80
|
+
setCurrentPage(page - 1);
|
|
85
81
|
onPageChange(page - 1);
|
|
86
82
|
}
|
|
87
83
|
: undefined, sx: { mr: 4 } }))),
|
|
88
84
|
React.createElement(Grid, { size: { xs: 12, md: 3 }, sx: { textAlign: 'end' } },
|
|
89
85
|
React.createElement(Typography, { variant: 'caption' },
|
|
90
|
-
|
|
86
|
+
currentPage * currentPageSize + 1,
|
|
91
87
|
"-",
|
|
92
|
-
Math.min((
|
|
88
|
+
Math.min((currentPage + 1) * currentPageSize, totalItems),
|
|
93
89
|
' ',
|
|
94
90
|
paginatedListTranslations.of[locale],
|
|
95
91
|
" ",
|