material-react-table 2.0.2 → 2.0.4
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/dist/index.d.ts +15 -3
- package/dist/index.esm.js +9 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/locales/am/index.d.ts +3 -0
- package/locales/am/index.esm.d.ts +3 -0
- package/locales/am/index.esm.js +93 -0
- package/locales/am/index.js +97 -0
- package/locales/am/package.json +6 -0
- package/locales/ar/index.esm.js +3 -3
- package/locales/ar/index.js +3 -3
- package/locales/zh-Hans/index.esm.js +2 -2
- package/locales/zh-Hans/index.js +2 -2
- package/package.json +19 -19
- package/src/buttons/MRT_GrabHandleButton.tsx +1 -0
- package/src/locales/am.ts +94 -0
- package/src/locales/ar.ts +3 -3
- package/src/locales/zh-Hans.ts +2 -2
- package/src/toolbar/MRT_TablePagination.tsx +21 -7
- package/src/types.ts +5 -2
package/dist/index.d.ts
CHANGED
@@ -18,6 +18,7 @@ import { LinearProgressProps } from '@mui/material/LinearProgress';
|
|
18
18
|
import { PaginationProps } from '@mui/material/Pagination';
|
19
19
|
import { PaperProps } from '@mui/material/Paper';
|
20
20
|
import { RadioProps } from '@mui/material/Radio';
|
21
|
+
import { SelectProps } from '@mui/material/Select';
|
21
22
|
import { SkeletonProps } from '@mui/material/Skeleton';
|
22
23
|
import { SliderProps } from '@mui/material/Slider';
|
23
24
|
import { TableProps } from '@mui/material/Table';
|
@@ -773,10 +774,18 @@ type MRT_TableOptions<TData extends MRT_RowData> = Omit<Partial<TableOptions<TDa
|
|
773
774
|
muiPaginationProps?: ((props: {
|
774
775
|
table: MRT_TableInstance<TData>;
|
775
776
|
}) => Partial<PaginationProps & {
|
776
|
-
|
777
|
+
SelectProps?: Partial<SelectProps>;
|
778
|
+
rowsPerPageOptions?: {
|
779
|
+
label: string;
|
780
|
+
value: number;
|
781
|
+
}[] | number[];
|
777
782
|
showRowsPerPage?: boolean;
|
778
783
|
}>) | Partial<PaginationProps & {
|
779
|
-
|
784
|
+
SelectProps?: Partial<SelectProps>;
|
785
|
+
rowsPerPageOptions?: {
|
786
|
+
label: string;
|
787
|
+
value: number;
|
788
|
+
}[] | number[];
|
780
789
|
showRowsPerPage?: boolean;
|
781
790
|
}>;
|
782
791
|
muiRowDragHandleProps?: ((props: {
|
@@ -1530,7 +1539,10 @@ interface Props$5<TData extends MRT_RowData> extends LinearProgressProps {
|
|
1530
1539
|
declare const MRT_LinearProgressBar: <TData extends MRT_RowData>({ isTopToolbar, table, ...rest }: Props$5<TData>) => react_jsx_runtime.JSX.Element;
|
1531
1540
|
|
1532
1541
|
interface Props$4<TData extends MRT_RowData> extends Partial<PaginationProps & {
|
1533
|
-
rowsPerPageOptions?:
|
1542
|
+
rowsPerPageOptions?: {
|
1543
|
+
label: string;
|
1544
|
+
value: number;
|
1545
|
+
}[] | number[];
|
1534
1546
|
showRowsPerPage?: boolean;
|
1535
1547
|
}> {
|
1536
1548
|
position?: 'bottom' | 'top';
|
package/dist/index.esm.js
CHANGED
@@ -463,11 +463,11 @@ const MRT_TableBodyCellValue = ({ cell, table, }) => {
|
|
463
463
|
};
|
464
464
|
|
465
465
|
const MRT_GrabHandleButton = (_a) => {
|
466
|
-
var _b;
|
466
|
+
var _b, _c;
|
467
467
|
var { iconButtonProps, location, onDragEnd, onDragStart, table } = _a, rest = __rest(_a, ["iconButtonProps", "location", "onDragEnd", "onDragStart", "table"]);
|
468
468
|
const { options: { icons: { DragHandleIcon }, localization, }, } = table;
|
469
469
|
const _iconButtonProps = Object.assign(Object.assign({}, iconButtonProps), rest);
|
470
|
-
return (jsx(Tooltip, { enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: (_b = _iconButtonProps === null || _iconButtonProps === void 0 ? void 0 : _iconButtonProps.title) !== null && _b !== void 0 ? _b : localization.move, children: jsx(IconButton, Object.assign({ disableRipple: true, draggable: "true", size: "small" }, _iconButtonProps, { onClick: (e) => {
|
470
|
+
return (jsx(Tooltip, { enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: (_b = _iconButtonProps === null || _iconButtonProps === void 0 ? void 0 : _iconButtonProps.title) !== null && _b !== void 0 ? _b : localization.move, children: jsx(IconButton, Object.assign({ "aria-label": (_c = _iconButtonProps.title) !== null && _c !== void 0 ? _c : localization.move, disableRipple: true, draggable: "true", size: "small" }, _iconButtonProps, { onClick: (e) => {
|
471
471
|
var _a;
|
472
472
|
e.stopPropagation();
|
473
473
|
(_a = _iconButtonProps === null || _iconButtonProps === void 0 ? void 0 : _iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(_iconButtonProps, e);
|
@@ -2154,7 +2154,7 @@ const MRT_TablePagination = (_a) => {
|
|
2154
2154
|
const showFirstLastPageButtons = numberOfPages > 2;
|
2155
2155
|
const firstRowIndex = pageIndex * pageSize;
|
2156
2156
|
const lastRowIndex = Math.min(pageIndex * pageSize + pageSize, totalRowCount);
|
2157
|
-
const _b = paginationProps !== null && paginationProps !== void 0 ? paginationProps : {}, { rowsPerPageOptions = defaultRowsPerPage, showFirstButton = showFirstLastPageButtons, showLastButton = showFirstLastPageButtons, showRowsPerPage = true } = _b, _rest = __rest(_b, ["rowsPerPageOptions", "showFirstButton", "showLastButton", "showRowsPerPage"]);
|
2157
|
+
const _b = paginationProps !== null && paginationProps !== void 0 ? paginationProps : {}, { SelectProps, rowsPerPageOptions = defaultRowsPerPage, showFirstButton = showFirstLastPageButtons, showLastButton = showFirstLastPageButtons, showRowsPerPage = true } = _b, _rest = __rest(_b, ["SelectProps", "rowsPerPageOptions", "showFirstButton", "showLastButton", "showRowsPerPage"]);
|
2158
2158
|
return (jsxs(Box, { sx: {
|
2159
2159
|
alignItems: 'center',
|
2160
2160
|
display: 'flex',
|
@@ -2171,7 +2171,12 @@ const MRT_TablePagination = (_a) => {
|
|
2171
2171
|
px: '8px',
|
2172
2172
|
py: '12px',
|
2173
2173
|
zIndex: 2,
|
2174
|
-
}, children: [showRowsPerPage && (jsxs(Box, { sx: { alignItems: 'center', display: 'flex', gap: '8px' }, children: [jsx(InputLabel, { htmlFor: "mrt-rows-per-page", sx: { mb: 0 }, children: localization.rowsPerPage }), jsx(Select, { disableUnderline: true, id: "mrt-rows-per-page", inputProps: { 'aria-label': localization.rowsPerPage }, label: localization.rowsPerPage, onChange: (event) => setPageSize(+event.target.value), sx: { mb: 0 }, value: pageSize, variant: "standard",
|
2174
|
+
}, children: [showRowsPerPage && (jsxs(Box, { sx: { alignItems: 'center', display: 'flex', gap: '8px' }, children: [jsx(InputLabel, { htmlFor: "mrt-rows-per-page", sx: { mb: 0 }, children: localization.rowsPerPage }), jsx(Select, Object.assign({ disableUnderline: true, id: "mrt-rows-per-page", inputProps: { 'aria-label': localization.rowsPerPage }, label: localization.rowsPerPage, onChange: (event) => setPageSize(+event.target.value), sx: { mb: 0 }, value: pageSize, variant: "standard" }, SelectProps, { children: rowsPerPageOptions.map((option) => {
|
2175
|
+
var _a;
|
2176
|
+
const value = typeof option !== 'number' ? option.value : option;
|
2177
|
+
const label = typeof option !== 'number' ? option.label : `${option}`;
|
2178
|
+
return ((_a = SelectProps === null || SelectProps === void 0 ? void 0 : SelectProps.children) !== null && _a !== void 0 ? _a : ((SelectProps === null || SelectProps === void 0 ? void 0 : SelectProps.native) ? (jsx("option", { value: value, children: label }, value)) : (jsx(MenuItem, { sx: { m: 0 }, value: value, children: label }, value))));
|
2179
|
+
}) }))] })), paginationDisplayMode === 'pages' ? (jsx(Pagination, Object.assign({ count: numberOfPages, onChange: (_e, newPageIndex) => setPageIndex(newPageIndex - 1), page: pageIndex + 1, renderItem: (item) => (jsx(PaginationItem, Object.assign({ slots: {
|
2175
2180
|
first: FirstPageIcon,
|
2176
2181
|
last: LastPageIcon,
|
2177
2182
|
next: ChevronRightIcon,
|