@deix/rossini-core 6.0.2 → 6.1.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/lib/components/display/PaginatedList/PaginatedList.d.ts +2 -1
- package/lib/components/display/PaginatedList/PaginatedList.d.ts.map +1 -1
- package/lib/components/display/PaginatedList/PaginatedList.js +13 -2
- package/lib/components/provider/PageProvider.d.ts.map +1 -1
- package/lib/components/provider/PageProvider.js +3 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -3
|
@@ -2,6 +2,7 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { ListItemProps } from './ListItem';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
export interface PaginatedListProps {
|
|
5
|
+
urlPrefix?: string;
|
|
5
6
|
title?: string;
|
|
6
7
|
subtitle?: string;
|
|
7
8
|
items: ListItemProps[];
|
|
@@ -17,6 +18,6 @@ export interface PaginatedListProps {
|
|
|
17
18
|
emptyDataLabel?: string;
|
|
18
19
|
disablePaginationLabels?: boolean;
|
|
19
20
|
}
|
|
20
|
-
declare const PaginatedList: ({ title, subtitle, items, totalItems,
|
|
21
|
+
declare const PaginatedList: ({ urlPrefix, title, subtitle, items, totalItems, onPageChange, rowsPerPageOptions, onPageSizeChange, menu, densityMenuEnabled, maxHeight, emptyDataLabel, disablePaginationLabels, }: PaginatedListProps) => React.JSX.Element;
|
|
21
22
|
export default PaginatedList;
|
|
22
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;
|
|
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,MAAM,KAAK,IAAI,CAAC;IACzC,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,IAAI,CAAC,EAAE,SAAS,EAAE,CAAC;IACnB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AA2BD,QAAA,MAAM,aAAa,GAAI,sLAgBpB,kBAAkB,sBAyLpB,CAAC;AACF,eAAe,aAAa,CAAC"}
|
|
@@ -8,6 +8,7 @@ import ListItem from './ListItem';
|
|
|
8
8
|
import { useLocale } from '../../../utils/hooks/useLocale';
|
|
9
9
|
import usePersistedState from '../../../utils/hooks/usePersistedState';
|
|
10
10
|
import React from 'react';
|
|
11
|
+
import { parseAsInteger, useQueryState } from 'nuqs';
|
|
11
12
|
const densityIconMap = {
|
|
12
13
|
compact: React.createElement(ViewHeadlineIcon, null),
|
|
13
14
|
standard: React.createElement(TableRowsIcon, null),
|
|
@@ -31,8 +32,14 @@ const paginatedListTranslations = {
|
|
|
31
32
|
en: 'No data available',
|
|
32
33
|
},
|
|
33
34
|
};
|
|
34
|
-
const PaginatedList = ({
|
|
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
40
|
const locale = useLocale();
|
|
41
|
+
const [page, setPage] = useQueryState(`${urlPrefix}_page`, parseAsInteger.withDefault(0));
|
|
42
|
+
const [pageSize, setPageSize] = useQueryState(`${urlPrefix}_page_size`, parseAsInteger.withDefault(10));
|
|
36
43
|
// Appearance
|
|
37
44
|
const [listDensity, setListDensity] = usePersistedState(`listDensity`, 'standard');
|
|
38
45
|
const [densityMenuAnchorEl, setDensityMenuAnchorEl] = useState(null);
|
|
@@ -66,13 +73,17 @@ const PaginatedList = ({ title, subtitle, items, totalItems, page = 0, onPageCha
|
|
|
66
73
|
'Rows per page',
|
|
67
74
|
":")),
|
|
68
75
|
React.createElement(Select, { labelId: 'page-size-select-label', id: 'page-size-select', value: Number(pageSize), label: 'Rows per Page', onChange: (event) => {
|
|
76
|
+
setPageSize(Number(event.target.value));
|
|
69
77
|
onPageSizeChange(Number(event.target.value));
|
|
70
78
|
}, variant: 'standard' }, rowsPerPageOptions.map((opt) => (React.createElement(MenuItem, { key: opt, value: Number(opt) },
|
|
71
79
|
React.createElement(Typography, { variant: 'caption', sx: { mr: 2 } }, opt)))))),
|
|
72
80
|
React.createElement(Grid, { size: { xs: 12, md: 6 } },
|
|
73
81
|
React.createElement(Box, { sx: { display: 'flex', justifyContent: 'center' } },
|
|
74
82
|
React.createElement(Pagination, { count: Math.ceil(totalItems / pageSize), size: 'small', showFirstButton: true, showLastButton: true, page: page + 1, onChange: onPageChange
|
|
75
|
-
? (_evt, page) =>
|
|
83
|
+
? (_evt, page) => {
|
|
84
|
+
setPage(page - 1);
|
|
85
|
+
onPageChange(page - 1);
|
|
86
|
+
}
|
|
76
87
|
: undefined, sx: { mr: 4 } }))),
|
|
77
88
|
React.createElement(Grid, { size: { xs: 12, md: 3 }, sx: { textAlign: 'end' } },
|
|
78
89
|
React.createElement(Typography, { variant: 'caption' },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageProvider.d.ts","sourceRoot":"","sources":["../../../src/components/provider/PageProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG/C,OAAO,EAAE,QAAQ,EAAoB,MAAM,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"PageProvider.d.ts","sourceRoot":"","sources":["../../../src/components/provider/PageProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG/C,OAAO,EAAE,QAAQ,EAAoB,MAAM,GAAG,CAAC;AAG/C,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,YAAY,CAAC,EAAE,cAAc,CAAC;IAC9B,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,eAAe,CAAC,EAAE,QAAQ,CAAC;CAC5B;AAED,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAgB7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -3,9 +3,11 @@ import React from 'react';
|
|
|
3
3
|
import ThemeProvider from './ThemeProvider';
|
|
4
4
|
import { SnackbarProvider } from 'notistack';
|
|
5
5
|
import { UserInfoProvider } from '.';
|
|
6
|
+
import { NuqsAdapter } from 'nuqs/adapters/next/app';
|
|
6
7
|
const PageProvider = ({ children, lightPalette, darkPalette, userInfoUrl, defaultUserInfo, }) => {
|
|
7
8
|
return (React.createElement(ThemeProvider, { lightPalette: lightPalette, darkPalette: darkPalette },
|
|
8
9
|
React.createElement(UserInfoProvider, { url: userInfoUrl, defaultUserInfo: defaultUserInfo },
|
|
9
|
-
React.createElement(SnackbarProvider, { maxSnack: 3 },
|
|
10
|
+
React.createElement(SnackbarProvider, { maxSnack: 3 },
|
|
11
|
+
React.createElement(NuqsAdapter, null, children)))));
|
|
10
12
|
};
|
|
11
13
|
export default PageProvider;
|