material-react-table 2.12.0 → 2.12.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.
- package/dist/index.d.ts +0 -1
- package/dist/index.esm.js +20 -35
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +20 -35
- package/dist/index.js.map +1 -1
- package/locales/hr/index.d.ts +3 -0
- package/locales/hr/index.esm.d.ts +3 -0
- package/locales/hr/index.esm.js +95 -0
- package/locales/hr/index.js +99 -0
- package/locales/hr/package.json +6 -0
- package/package.json +23 -23
- package/src/components/inputs/MRT_FilterTextField.tsx +12 -25
- package/src/components/menus/MRT_ShowHideColumnsMenuItems.tsx +1 -4
- package/src/components/toolbar/MRT_TablePagination.tsx +10 -12
- package/src/hooks/useMRT_ColumnVirtualizer.ts +6 -8
- package/src/locales/hr.ts +96 -0
- package/src/types.ts +0 -1
package/dist/index.js
CHANGED
@@ -1735,22 +1735,23 @@ const extraIndexRangeExtractor = (range, draggingIndex) => {
|
|
1735
1735
|
|
1736
1736
|
const useMRT_ColumnVirtualizer = (table) => {
|
1737
1737
|
var _a, _b, _c, _d;
|
1738
|
-
const {
|
1739
|
-
const { columnPinning, draggingColumn } = getState();
|
1738
|
+
const { getState, options: { columnVirtualizerInstanceRef, columnVirtualizerOptions, enableColumnPinning, enableColumnVirtualization, }, refs: { tableContainerRef }, } = table;
|
1739
|
+
const { columnPinning, columnVisibility, draggingColumn } = getState();
|
1740
1740
|
if (!enableColumnVirtualization)
|
1741
1741
|
return undefined;
|
1742
1742
|
const columnVirtualizerProps = parseFromValuesOrFunc(columnVirtualizerOptions, {
|
1743
1743
|
table,
|
1744
1744
|
});
|
1745
|
-
const visibleColumns = getVisibleLeafColumns();
|
1745
|
+
const visibleColumns = table.getVisibleLeafColumns();
|
1746
1746
|
const [leftPinnedIndexes, rightPinnedIndexes] = react.useMemo(() => enableColumnPinning
|
1747
1747
|
? [
|
1748
|
-
|
1749
|
-
|
1748
|
+
table.getLeftVisibleLeafColumns().map((c) => c.getPinnedIndex()),
|
1749
|
+
table
|
1750
|
+
.getRightVisibleLeafColumns()
|
1750
1751
|
.map((column) => visibleColumns.length - column.getPinnedIndex() - 1)
|
1751
1752
|
.sort((a, b) => a - b),
|
1752
1753
|
]
|
1753
|
-
: [[], []], [columnPinning, enableColumnPinning]);
|
1754
|
+
: [[], []], [columnPinning, columnVisibility, enableColumnPinning]);
|
1754
1755
|
const numPinnedLeft = leftPinnedIndexes.length;
|
1755
1756
|
const numPinnedRight = rightPinnedIndexes.length;
|
1756
1757
|
const draggingColumnIndex = react.useMemo(() => (draggingColumn === null || draggingColumn === void 0 ? void 0 : draggingColumn.id)
|
@@ -2893,26 +2894,12 @@ const MRT_FilterTextField = (_a) => {
|
|
2893
2894
|
const { column } = header;
|
2894
2895
|
const { columnDef } = column;
|
2895
2896
|
const { filterVariant } = columnDef;
|
2896
|
-
const
|
2897
|
-
|
2898
|
-
|
2899
|
-
})),
|
2900
|
-
const
|
2901
|
-
|
2902
|
-
table,
|
2903
|
-
}));
|
2904
|
-
const datePickerProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterDatePickerProps, { column, table })), parseFromValuesOrFunc(columnDef.muiFilterDatePickerProps, {
|
2905
|
-
column,
|
2906
|
-
table,
|
2907
|
-
}));
|
2908
|
-
const dateTimePickerProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterDateTimePickerProps, { column, table })), parseFromValuesOrFunc(columnDef.muiFilterDateTimePickerProps, {
|
2909
|
-
column,
|
2910
|
-
table,
|
2911
|
-
}));
|
2912
|
-
const timePickerProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterTimePickerProps, { column, table })), parseFromValuesOrFunc(columnDef.muiFilterTimePickerProps, {
|
2913
|
-
column,
|
2914
|
-
table,
|
2915
|
-
}));
|
2897
|
+
const args = { column, rangeFilterIndex, table };
|
2898
|
+
const textFieldProps = Object.assign(Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterTextFieldProps, args)), parseFromValuesOrFunc(columnDef.muiFilterTextFieldProps, args)), rest);
|
2899
|
+
const autocompleteProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterAutocompleteProps, args)), parseFromValuesOrFunc(columnDef.muiFilterAutocompleteProps, args));
|
2900
|
+
const datePickerProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterDatePickerProps, args)), parseFromValuesOrFunc(columnDef.muiFilterDatePickerProps, args));
|
2901
|
+
const dateTimePickerProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterDateTimePickerProps, args)), parseFromValuesOrFunc(columnDef.muiFilterDateTimePickerProps, args));
|
2902
|
+
const timePickerProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiFilterTimePickerProps, args)), parseFromValuesOrFunc(columnDef.muiFilterTimePickerProps, args));
|
2916
2903
|
const { allowedColumnFilterOptions, currentFilterOption, facetedUniqueValues, isAutocompleteFilter, isDateFilter, isMultiSelectFilter, isRangeFilter, isSelectFilter, isTextboxFilter, } = getColumnFilterInfo({ header, table });
|
2917
2904
|
const dropdownOptions = useDropdownOptions({ header, table });
|
2918
2905
|
const filterChipLabel = ['empty', 'notEmpty'].includes(currentFilterOption)
|
@@ -3795,13 +3782,13 @@ const MRT_TablePagination = (_a) => {
|
|
3795
3782
|
var { position = 'bottom', table } = _a, rest = __rest(_a, ["position", "table"]);
|
3796
3783
|
const theme = styles.useTheme();
|
3797
3784
|
const isMobile = useMediaQuery__default["default"]('(max-width: 720px)');
|
3798
|
-
const {
|
3785
|
+
const { getState, options: { enableToolbarInternalActions, icons: { ChevronLeftIcon, ChevronRightIcon, FirstPageIcon, LastPageIcon }, localization, muiPaginationProps, paginationDisplayMode, }, } = table;
|
3799
3786
|
const { pagination: { pageIndex = 0, pageSize = 10 }, showGlobalFilter, } = getState();
|
3800
3787
|
const paginationProps = Object.assign(Object.assign({}, parseFromValuesOrFunc(muiPaginationProps, {
|
3801
3788
|
table,
|
3802
3789
|
})), rest);
|
3803
|
-
const totalRowCount =
|
3804
|
-
const numberOfPages =
|
3790
|
+
const totalRowCount = table.getRowCount();
|
3791
|
+
const numberOfPages = table.getPageCount();
|
3805
3792
|
const showFirstLastPageButtons = numberOfPages > 2;
|
3806
3793
|
const firstRowIndex = pageIndex * pageSize;
|
3807
3794
|
const lastRowIndex = Math.min(pageIndex * pageSize + pageSize, totalRowCount);
|
@@ -3831,17 +3818,17 @@ const MRT_TablePagination = (_a) => {
|
|
3831
3818
|
}, children: [showRowsPerPage && (jsxRuntime.jsxs(Box__default["default"], { sx: { alignItems: 'center', display: 'flex', gap: '8px' }, children: [jsxRuntime.jsx(InputLabel__default["default"], { htmlFor: "mrt-rows-per-page", sx: { mb: 0 }, children: localization.rowsPerPage }), jsxRuntime.jsx(Select__default["default"], Object.assign({ MenuProps: { disableScrollLock: true }, disableUnderline: true, disabled: disabled, inputProps: {
|
3832
3819
|
'aria-label': localization.rowsPerPage,
|
3833
3820
|
id: 'mrt-rows-per-page',
|
3834
|
-
}, label: localization.rowsPerPage, onChange: (event) => setPageSize(+event.target.value), sx: { mb: 0 }, value: pageSize, variant: "standard" }, SelectProps, { children: rowsPerPageOptions.map((option) => {
|
3821
|
+
}, label: localization.rowsPerPage, onChange: (event) => table.setPageSize(+event.target.value), sx: { mb: 0 }, value: pageSize, variant: "standard" }, SelectProps, { children: rowsPerPageOptions.map((option) => {
|
3835
3822
|
var _a;
|
3836
3823
|
const value = typeof option !== 'number' ? option.value : option;
|
3837
3824
|
const label = typeof option !== 'number' ? option.label : `${option}`;
|
3838
3825
|
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) ? (jsxRuntime.jsx("option", { value: value, children: label }, value)) : (jsxRuntime.jsx(MenuItem__default["default"], { sx: { m: 0 }, value: value, children: label }, value))));
|
3839
|
-
}) }))] })), paginationDisplayMode === 'pages' ? (jsxRuntime.jsx(Pagination__default["default"], Object.assign({ count: numberOfPages, disabled: disabled, onChange: (_e, newPageIndex) => setPageIndex(newPageIndex - 1), page: pageIndex + 1, renderItem: (item) => (jsxRuntime.jsx(PaginationItem__default["default"], Object.assign({ slots: {
|
3826
|
+
}) }))] })), paginationDisplayMode === 'pages' ? (jsxRuntime.jsx(Pagination__default["default"], Object.assign({ count: numberOfPages, disabled: disabled, onChange: (_e, newPageIndex) => table.setPageIndex(newPageIndex - 1), page: pageIndex + 1, renderItem: (item) => (jsxRuntime.jsx(PaginationItem__default["default"], Object.assign({ slots: {
|
3840
3827
|
first: FirstPageIcon,
|
3841
3828
|
last: LastPageIcon,
|
3842
3829
|
next: ChevronRightIcon,
|
3843
3830
|
previous: ChevronLeftIcon,
|
3844
|
-
} }, item))), showFirstButton: showFirstButton, showLastButton: showLastButton }, restPaginationProps))) : paginationDisplayMode === 'default' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Typography__default["default"], { align: "center", component: "span", sx: { m: '0 4px', minWidth: '8ch' }, variant: "body2", children: `${lastRowIndex === 0 ? 0 : (firstRowIndex + 1).toLocaleString()}-${lastRowIndex.toLocaleString()} ${localization.of} ${totalRowCount.toLocaleString()}` }), jsxRuntime.jsxs(Box__default["default"], { gap: "xs", children: [showFirstButton && (jsxRuntime.jsx(Tooltip__default["default"], Object.assign({}, tooltipProps, { title: localization.goToFirstPage, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToFirstPage, disabled: disableBack, onClick: () =>
|
3831
|
+
} }, item))), showFirstButton: showFirstButton, showLastButton: showLastButton }, restPaginationProps))) : paginationDisplayMode === 'default' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Typography__default["default"], { align: "center", component: "span", sx: { m: '0 4px', minWidth: '8ch' }, variant: "body2", children: `${lastRowIndex === 0 ? 0 : (firstRowIndex + 1).toLocaleString()}-${lastRowIndex.toLocaleString()} ${localization.of} ${totalRowCount.toLocaleString()}` }), jsxRuntime.jsxs(Box__default["default"], { gap: "xs", children: [showFirstButton && (jsxRuntime.jsx(Tooltip__default["default"], Object.assign({}, tooltipProps, { title: localization.goToFirstPage, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToFirstPage, disabled: disableBack, onClick: () => table.firstPage(), size: "small", children: jsxRuntime.jsx(FirstPageIcon, Object.assign({}, flipIconStyles(theme))) }) }) }))), jsxRuntime.jsx(Tooltip__default["default"], Object.assign({}, tooltipProps, { title: localization.goToPreviousPage, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToPreviousPage, disabled: disableBack, onClick: () => table.previousPage(), size: "small", children: jsxRuntime.jsx(ChevronLeftIcon, Object.assign({}, flipIconStyles(theme))) }) }) })), jsxRuntime.jsx(Tooltip__default["default"], Object.assign({}, tooltipProps, { title: localization.goToNextPage, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToNextPage, disabled: disableNext, onClick: () => table.nextPage(), size: "small", children: jsxRuntime.jsx(ChevronRightIcon, Object.assign({}, flipIconStyles(theme))) }) }) })), showLastButton && (jsxRuntime.jsx(Tooltip__default["default"], Object.assign({}, tooltipProps, { title: localization.goToLastPage, children: jsxRuntime.jsx("span", { children: jsxRuntime.jsx(IconButton__default["default"], { "aria-label": localization.goToLastPage, disabled: disableNext, onClick: () => table.lastPage(), size: "small", children: jsxRuntime.jsx(LastPageIcon, Object.assign({}, flipIconStyles(theme))) }) }) })))] })] })) : null] }));
|
3845
3832
|
};
|
3846
3833
|
|
3847
3834
|
const MRT_ToolbarDropZone = (_a) => {
|
@@ -3919,9 +3906,7 @@ const MRT_ShowHideColumnsMenuItems = (_a) => {
|
|
3919
3906
|
const { columnOrder } = getState();
|
3920
3907
|
const { columnDef } = column;
|
3921
3908
|
const { columnDefType } = columnDef;
|
3922
|
-
const switchChecked =
|
3923
|
-
(columnDefType === 'group' &&
|
3924
|
-
column.getLeafColumns().some((col) => col.getIsVisible()));
|
3909
|
+
const switchChecked = column.getIsVisible();
|
3925
3910
|
const handleToggleColumnHidden = (column) => {
|
3926
3911
|
var _a, _b;
|
3927
3912
|
if (columnDefType === 'group') {
|