material-react-table 1.8.5 → 1.9.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/dist/cjs/index.js +54 -49
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/_locales/sr-Cyrl-RS.d.ts +2 -0
- package/dist/cjs/types/_locales/sr-Latn-RS.d.ts +2 -0
- package/dist/cjs/types/body/MRT_TableBodyCell.d.ts +2 -3
- package/dist/esm/material-react-table.esm.js +53 -49
- package/dist/esm/material-react-table.esm.js.map +1 -1
- package/dist/esm/types/_locales/sr-Cyrl-RS.d.ts +2 -0
- package/dist/esm/types/_locales/sr-Latn-RS.d.ts +2 -0
- package/dist/esm/types/body/MRT_TableBodyCell.d.ts +2 -3
- package/locales/sr-Cyrl-RS.d.ts +2 -0
- package/locales/sr-Cyrl-RS.esm.d.ts +2 -0
- package/locales/sr-Cyrl-RS.esm.js +94 -0
- package/locales/sr-Cyrl-RS.esm.js.map +1 -0
- package/locales/sr-Cyrl-RS.js +98 -0
- package/locales/sr-Cyrl-RS.js.map +1 -0
- package/locales/sr-Latn-RS.d.ts +2 -0
- package/locales/sr-Latn-RS.esm.d.ts +2 -0
- package/locales/sr-Latn-RS.esm.js +94 -0
- package/locales/sr-Latn-RS.esm.js.map +1 -0
- package/locales/sr-Latn-RS.js +98 -0
- package/locales/sr-Latn-RS.js.map +1 -0
- package/package.json +1 -1
- package/src/_locales/sr-Cyrl-RS.ts +94 -0
- package/src/_locales/sr-Latn-RS.ts +94 -0
- package/src/body/MRT_TableBodyCell.tsx +9 -14
- package/src/body/MRT_TableBodyRow.tsx +1 -4
- package/src/head/MRT_TableHeadCell.tsx +4 -0
- package/src/head/MRT_TableHeadCellResizeHandle.tsx +1 -1
- package/src/head/MRT_TableHeadCellSortLabel.tsx +30 -22
- package/src/menus/MRT_FilterOptionMenu.tsx +1 -3
- package/src/menus/MRT_RowActionMenu.tsx +1 -0
- package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +2 -1
@@ -0,0 +1,94 @@
|
|
1
|
+
import type { MRT_Localization } from '../MaterialReactTable';
|
2
|
+
|
3
|
+
export const MRT_Localization_SR_LATN_RS: MRT_Localization = {
|
4
|
+
actions: 'Akcije',
|
5
|
+
and: 'i',
|
6
|
+
cancel: 'Otkaži',
|
7
|
+
changeFilterMode: 'Promeni režim filtriranja',
|
8
|
+
changeSearchMode: 'Promeni režim pretrage',
|
9
|
+
clearFilter: 'Poništi filter',
|
10
|
+
clearSearch: 'Poništi pretragu',
|
11
|
+
clearSort: 'Poništi sortiranje',
|
12
|
+
clickToCopy: 'Klikni da kopiraš',
|
13
|
+
collapse: 'Raširi',
|
14
|
+
collapseAll: 'Raširi sve',
|
15
|
+
columnActions: 'Akcije nad kolonama',
|
16
|
+
copiedToClipboard: 'Kopirani u clipboard',
|
17
|
+
dropToGroupBy: 'Ubaci u grupu po {column}',
|
18
|
+
edit: 'Izmeni',
|
19
|
+
expand: 'Proširi',
|
20
|
+
expandAll: 'Proširi sve',
|
21
|
+
filterArrIncludes: 'Uključuje',
|
22
|
+
filterArrIncludesAll: 'Uključuje sve',
|
23
|
+
filterArrIncludesSome: 'Uključuje',
|
24
|
+
filterBetween: 'Između',
|
25
|
+
filterBetweenInclusive: 'Inkluzivno između',
|
26
|
+
filterByColumn: 'Filtriraj po {column}',
|
27
|
+
filterContains: 'Sadrži',
|
28
|
+
filterEmpty: 'Prazno',
|
29
|
+
filterEndsWith: 'Završava se na',
|
30
|
+
filterEquals: 'Jednako',
|
31
|
+
filterEqualsString: 'Jednako',
|
32
|
+
filterFuzzy: 'Fazi',
|
33
|
+
filterGreaterThan: 'Veće',
|
34
|
+
filterGreaterThanOrEqualTo: 'Veće ili jednako',
|
35
|
+
filterInNumberRange: 'Između',
|
36
|
+
filterIncludesString: 'Sadrži',
|
37
|
+
filterIncludesStringSensitive: 'Sadrži',
|
38
|
+
filterLessThan: 'Manje',
|
39
|
+
filterLessThanOrEqualTo: 'Manje ili jednako',
|
40
|
+
filterMode: 'Režim filtriranja: {filterType}',
|
41
|
+
filterNotEmpty: 'Nije prazno',
|
42
|
+
filterNotEquals: 'Nije jednako',
|
43
|
+
filterStartsWith: 'Počinje sa',
|
44
|
+
filterWeakEquals: 'Jednako',
|
45
|
+
filteringByColumn: 'Filtriranje po {column} - {filterType} {filterValue}',
|
46
|
+
goToFirstPage: 'Idi na prvu stranicu',
|
47
|
+
goToLastPage: 'Idi na poslednju stranicu',
|
48
|
+
goToNextPage: 'Idi na sledeću stranicu',
|
49
|
+
goToPreviousPage: 'Idi na prošlu stranicu',
|
50
|
+
grab: 'Zgrabi',
|
51
|
+
groupByColumn: 'Grupiši po {column}',
|
52
|
+
groupedBy: 'Grupisano po ',
|
53
|
+
hideAll: 'Sakrij sve',
|
54
|
+
hideColumn: 'Sakrij {column} kolonu',
|
55
|
+
max: 'Max',
|
56
|
+
min: 'Min',
|
57
|
+
move: 'Pomeri',
|
58
|
+
noRecordsToDisplay: 'Nema redova za prikaz',
|
59
|
+
noResultsFound: 'Nema rezultata',
|
60
|
+
of: 'od',
|
61
|
+
or: 'ili',
|
62
|
+
pinToLeft: 'Zakači levo',
|
63
|
+
pinToRight: 'Zakači desno',
|
64
|
+
resetColumnSize: 'Resetuj širinu kolone',
|
65
|
+
resetOrder: 'Resetuj poredak',
|
66
|
+
rowActions: 'Akcije nad redovima',
|
67
|
+
rowNumber: '#',
|
68
|
+
rowNumbers: 'Broj redova',
|
69
|
+
rowsPerPage: 'Redova po stranici',
|
70
|
+
save: 'Snimi',
|
71
|
+
search: 'Pretraži',
|
72
|
+
selectedCountOfRowCountRowsSelected:
|
73
|
+
'{selectedCount} od {rowCount} redova označeno',
|
74
|
+
select: 'Označi',
|
75
|
+
showAll: 'Prikaži sve',
|
76
|
+
showAllColumns: 'Prikaži sve kolone',
|
77
|
+
showHideColumns: 'Prikaži/sakrij kolone',
|
78
|
+
showHideFilters: 'Prikaži/sakrij filtere',
|
79
|
+
showHideSearch: 'Prikaži/sakrij pretragu',
|
80
|
+
sortByColumnAsc: 'Sortiraj po {column} rastuće',
|
81
|
+
sortByColumnDesc: 'Sortiraj po {column} opadajuće',
|
82
|
+
sortedByColumnAsc: 'Sortirano po {column} rastuće',
|
83
|
+
sortedByColumnDesc: 'Sortirano po {column} opadajuće',
|
84
|
+
thenBy: ', onda po ',
|
85
|
+
toggleDensity: 'Podesi gustinu',
|
86
|
+
toggleFullScreen: 'Uključi/isključi preko celog ekrana',
|
87
|
+
toggleSelectAll: 'Označi/odznači sve redove',
|
88
|
+
toggleSelectRow: 'Označi/odznači red',
|
89
|
+
toggleVisibility: 'Uključi/isključi vidljivost',
|
90
|
+
ungroupByColumn: 'Odgrupiši po {column}',
|
91
|
+
unpin: 'Otkači',
|
92
|
+
unpinAll: 'Otkači sve',
|
93
|
+
unsorted: 'Nesortirano',
|
94
|
+
};
|
@@ -9,7 +9,7 @@ import React, {
|
|
9
9
|
} from 'react';
|
10
10
|
import Skeleton from '@mui/material/Skeleton';
|
11
11
|
import TableCell from '@mui/material/TableCell';
|
12
|
-
import {
|
12
|
+
import { useTheme } from '@mui/material/styles';
|
13
13
|
import { MRT_EditCellTextField } from '../inputs/MRT_EditCellTextField';
|
14
14
|
import { MRT_CopyButton } from '../buttons/MRT_CopyButton';
|
15
15
|
import { MRT_TableBodyRowGrabHandle } from './MRT_TableBodyRowGrabHandle';
|
@@ -24,7 +24,6 @@ import type { MRT_Cell, MRT_TableInstance } from '..';
|
|
24
24
|
|
25
25
|
interface Props {
|
26
26
|
cell: MRT_Cell;
|
27
|
-
enableHover?: boolean;
|
28
27
|
measureElement?: (element: HTMLTableCellElement) => void;
|
29
28
|
numRows: number;
|
30
29
|
rowIndex: number;
|
@@ -35,7 +34,6 @@ interface Props {
|
|
35
34
|
|
36
35
|
export const MRT_TableBodyCell = ({
|
37
36
|
cell,
|
38
|
-
enableHover,
|
39
37
|
measureElement,
|
40
38
|
numRows,
|
41
39
|
rowIndex,
|
@@ -237,14 +235,11 @@ export const MRT_TableBodyCell = ({
|
|
237
235
|
zIndex:
|
238
236
|
draggingColumn?.id === column.id ? 2 : column.getIsPinned() ? 1 : 0,
|
239
237
|
'&:hover': {
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
? `${lighten(theme.palette.background.default, 0.2)} !important`
|
246
|
-
: `${darken(theme.palette.background.default, 0.1)} !important`
|
247
|
-
: undefined,
|
238
|
+
outline: ['table', 'cell'].includes(editingMode ?? '')
|
239
|
+
? `1px solid ${theme.palette.text.secondary}`
|
240
|
+
: undefined,
|
241
|
+
outlineOffset: '-1px',
|
242
|
+
textOverflow: 'clip',
|
248
243
|
},
|
249
244
|
...getCommonCellStyles({
|
250
245
|
column,
|
@@ -296,10 +291,10 @@ export const MRT_TableBodyCell = ({
|
|
296
291
|
) : (
|
297
292
|
<MRT_TableBodyCellValue cell={cell} table={table} />
|
298
293
|
)}
|
294
|
+
{cell.getIsGrouped() && !columnDef.GroupedCell && (
|
295
|
+
<> ({row.subRows?.length})</>
|
296
|
+
)}
|
299
297
|
</>
|
300
|
-
{cell.getIsGrouped() && !columnDef.GroupedCell && (
|
301
|
-
<> ({row.subRows?.length})</>
|
302
|
-
)}
|
303
298
|
</TableCell>
|
304
299
|
);
|
305
300
|
};
|
@@ -32,7 +32,6 @@ export const MRT_TableBodyRow = ({
|
|
32
32
|
virtualRow,
|
33
33
|
}: Props) => {
|
34
34
|
const {
|
35
|
-
getIsSomeColumnsPinned,
|
36
35
|
getState,
|
37
36
|
options: {
|
38
37
|
enableRowOrdering,
|
@@ -63,7 +62,6 @@ export const MRT_TableBodyRow = ({
|
|
63
62
|
<>
|
64
63
|
<TableRow
|
65
64
|
data-index={virtualRow?.index}
|
66
|
-
hover
|
67
65
|
onDragEnter={handleDragEnter}
|
68
66
|
selected={row.getIsSelected()}
|
69
67
|
ref={(node: HTMLTableRowElement) => {
|
@@ -87,7 +85,7 @@ export const MRT_TableBodyRow = ({
|
|
87
85
|
width: '100%',
|
88
86
|
'&:hover td': {
|
89
87
|
backgroundColor:
|
90
|
-
tableRowProps?.hover !== false
|
88
|
+
tableRowProps?.hover !== false
|
91
89
|
? theme.palette.mode === 'dark'
|
92
90
|
? `${lighten(theme.palette.background.default, 0.12)}`
|
93
91
|
: `${darken(theme.palette.background.default, 0.05)}`
|
@@ -107,7 +105,6 @@ export const MRT_TableBodyRow = ({
|
|
107
105
|
: (cellOrVirtualCell as MRT_Cell);
|
108
106
|
const props = {
|
109
107
|
cell,
|
110
|
-
enableHover: tableRowProps?.hover !== false,
|
111
108
|
key: cell.id,
|
112
109
|
measureElement: columnVirtualizer?.measureElement,
|
113
110
|
numRows,
|
@@ -213,10 +213,14 @@ export const MRT_TableHeadCell = ({ header, table }: Props) => {
|
|
213
213
|
<Box
|
214
214
|
className="Mui-TableHeadCell-Content-Wrapper"
|
215
215
|
sx={{
|
216
|
+
minWidth: '5ch',
|
216
217
|
overflow: columnDefType === 'data' ? 'hidden' : undefined,
|
217
218
|
textOverflow: 'ellipsis',
|
218
219
|
whiteSpace:
|
219
220
|
(columnDef.header?.length ?? 0) < 20 ? 'nowrap' : 'normal',
|
221
|
+
'&:hover': {
|
222
|
+
textOverflow: 'clip',
|
223
|
+
},
|
220
224
|
}}
|
221
225
|
title={columnDefType === 'data' ? columnDef.header : undefined}
|
222
226
|
>
|
@@ -31,7 +31,7 @@ export const MRT_TableHeadCellResizeHandle = ({ header, table }: Props) => {
|
|
31
31
|
onTouchStart={header.getResizeHandler()}
|
32
32
|
sx={(theme) => ({
|
33
33
|
cursor: 'col-resize',
|
34
|
-
mr: density === 'compact' ? '-0.
|
34
|
+
mr: density === 'compact' ? '-0.75rem' : '-1rem',
|
35
35
|
position: 'absolute',
|
36
36
|
right: '1px',
|
37
37
|
px: '4px',
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
+
import Badge from '@mui/material/Badge';
|
2
3
|
import TableSortLabel from '@mui/material/TableSortLabel';
|
3
4
|
import Tooltip from '@mui/material/Tooltip';
|
4
5
|
import { MRT_Header, MRT_TableInstance } from '..';
|
@@ -16,6 +17,7 @@ export const MRT_TableHeadCellSortLabel = ({
|
|
16
17
|
tableCellProps,
|
17
18
|
}: Props) => {
|
18
19
|
const {
|
20
|
+
getState,
|
19
21
|
options: {
|
20
22
|
icons: { ArrowDownwardIcon },
|
21
23
|
localization,
|
@@ -23,6 +25,7 @@ export const MRT_TableHeadCellSortLabel = ({
|
|
23
25
|
} = table;
|
24
26
|
const { column } = header;
|
25
27
|
const { columnDef } = column;
|
28
|
+
const { sorting } = getState();
|
26
29
|
|
27
30
|
const sortTooltip = column.getIsSorted()
|
28
31
|
? column.getIsSorted() === 'desc'
|
@@ -32,28 +35,33 @@ export const MRT_TableHeadCellSortLabel = ({
|
|
32
35
|
|
33
36
|
return (
|
34
37
|
<Tooltip arrow placement="top" title={sortTooltip}>
|
35
|
-
<
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
38
|
+
<Badge
|
39
|
+
badgeContent={sorting.length > 1 ? column.getSortIndex() + 1 : 0}
|
40
|
+
overlap="circular"
|
41
|
+
>
|
42
|
+
<TableSortLabel
|
43
|
+
aria-label={sortTooltip}
|
44
|
+
active={!!column.getIsSorted()}
|
45
|
+
direction={
|
46
|
+
column.getIsSorted()
|
47
|
+
? (column.getIsSorted() as 'asc' | 'desc')
|
48
|
+
: undefined
|
49
|
+
}
|
50
|
+
sx={{
|
51
|
+
flex: '0 0',
|
52
|
+
width: '2.4ch',
|
53
|
+
transform:
|
54
|
+
tableCellProps?.align !== 'right'
|
55
|
+
? 'translateX(-0.5ch)'
|
56
|
+
: undefined,
|
57
|
+
}}
|
58
|
+
IconComponent={ArrowDownwardIcon}
|
59
|
+
onClick={(e) => {
|
60
|
+
e.stopPropagation();
|
61
|
+
header.column.getToggleSortingHandler()?.(e);
|
62
|
+
}}
|
63
|
+
/>
|
64
|
+
</Badge>
|
57
65
|
</Tooltip>
|
58
66
|
);
|
59
67
|
};
|
@@ -156,9 +156,7 @@ export const MRT_FilterOptionMenu = <TData extends Record<string, any> = {}>({
|
|
156
156
|
[header.id]: option,
|
157
157
|
}));
|
158
158
|
if (['empty', 'notEmpty'].includes(option as string)) {
|
159
|
-
|
160
|
-
column.setFilterValue(' ');
|
161
|
-
}
|
159
|
+
column.setFilterValue(' ');
|
162
160
|
} else if (
|
163
161
|
columnDef?.filterVariant === 'multi-select' ||
|
164
162
|
['arrIncludesSome', 'arrIncludesAll', 'arrIncludes'].includes(
|
@@ -98,8 +98,9 @@ export const MRT_ShowHideColumnsMenuItems = <
|
|
98
98
|
justifyContent: 'flex-start',
|
99
99
|
my: 0,
|
100
100
|
opacity: isDragging ? 0.5 : 1,
|
101
|
+
outlineOffset: '-2px',
|
101
102
|
outline: isDragging
|
102
|
-
? `
|
103
|
+
? `2px dashed ${theme.palette.divider}`
|
103
104
|
: hoveredColumn?.id === column.id
|
104
105
|
? `2px dashed ${theme.palette.primary.main}`
|
105
106
|
: 'none',
|