material-react-table 2.0.0-beta.8 → 2.0.0-rc.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/README.md +36 -27
- package/dist/index.d.ts +54 -5
- package/dist/{esm/material-react-table.esm.js → index.esm.js} +79 -83
- package/dist/index.esm.js.map +1 -0
- package/dist/{cjs/index.js → index.js} +298 -208
- package/dist/index.js.map +1 -0
- package/locales/ar/index.js +2 -0
- package/locales/ar/package.json +3 -11
- package/locales/az/index.js +2 -0
- package/locales/az/package.json +3 -11
- package/locales/bg/index.js +2 -0
- package/locales/bg/package.json +3 -11
- package/locales/cs/index.js +2 -0
- package/locales/cs/package.json +3 -11
- package/locales/da/index.js +2 -0
- package/locales/da/package.json +3 -11
- package/locales/de/index.js +2 -0
- package/locales/de/package.json +3 -11
- package/locales/en/index.js +2 -0
- package/locales/en/package.json +3 -11
- package/locales/es/index.js +2 -0
- package/locales/es/package.json +3 -11
- package/locales/et/index.js +2 -0
- package/locales/et/package.json +3 -11
- package/locales/fa/index.js +2 -0
- package/locales/fa/package.json +3 -11
- package/locales/fi/index.js +2 -0
- package/locales/fi/package.json +3 -11
- package/locales/fr/index.js +2 -0
- package/locales/fr/package.json +3 -11
- package/locales/hu/index.js +2 -0
- package/locales/hu/package.json +3 -11
- package/locales/hy/index.js +2 -0
- package/locales/hy/package.json +3 -11
- package/locales/id/index.js +2 -0
- package/locales/id/package.json +3 -11
- package/locales/it/index.js +2 -0
- package/locales/it/package.json +3 -11
- package/locales/ja/index.js +2 -0
- package/locales/ja/package.json +3 -11
- package/locales/ko/index.js +2 -0
- package/locales/ko/package.json +3 -11
- package/locales/nl/index.js +2 -0
- package/locales/nl/package.json +3 -11
- package/locales/no/index.js +2 -0
- package/locales/no/package.json +3 -11
- package/locales/np/index.js +2 -0
- package/locales/np/package.json +3 -11
- package/locales/pl/index.js +2 -0
- package/locales/pl/package.json +3 -11
- package/locales/pt/index.js +2 -0
- package/locales/pt/package.json +3 -11
- package/locales/pt-BR/index.js +2 -0
- package/locales/pt-BR/package.json +3 -11
- package/locales/ro/index.js +2 -0
- package/locales/ro/package.json +3 -11
- package/locales/ru/index.js +2 -0
- package/locales/ru/package.json +3 -11
- package/locales/sk/index.js +2 -0
- package/locales/sk/package.json +3 -11
- package/locales/sr-Cyrl-RS/index.js +2 -0
- package/locales/sr-Cyrl-RS/package.json +3 -11
- package/locales/sr-Latn-RS/index.js +2 -0
- package/locales/sr-Latn-RS/package.json +3 -11
- package/locales/sv/index.js +2 -0
- package/locales/sv/package.json +3 -11
- package/locales/tr/index.js +2 -0
- package/locales/tr/package.json +3 -11
- package/locales/uk/index.js +2 -0
- package/locales/uk/package.json +3 -11
- package/locales/vi/index.js +2 -0
- package/locales/vi/package.json +3 -11
- package/locales/zh-Hans/index.esm.js +18 -18
- package/locales/zh-Hans/index.js +20 -18
- package/locales/zh-Hans/package.json +3 -11
- package/locales/zh-Hant/index.js +2 -0
- package/locales/zh-Hant/package.json +3 -11
- package/package.json +25 -36
- package/src/body/MRT_TableBodyCell.tsx +2 -2
- package/src/buttons/MRT_ColumnPinningButtons.tsx +3 -3
- package/src/buttons/MRT_CopyButton.tsx +0 -1
- package/src/buttons/MRT_EditActionButtons.tsx +2 -2
- package/src/buttons/MRT_ExpandAllButton.tsx +0 -1
- package/src/buttons/MRT_ExpandButton.tsx +0 -1
- package/src/buttons/MRT_GrabHandleButton.tsx +0 -1
- package/src/buttons/MRT_RowPinButton.tsx +0 -1
- package/src/buttons/MRT_ShowHideColumnsButton.tsx +1 -1
- package/src/buttons/MRT_ToggleDensePaddingButton.tsx +1 -1
- package/src/buttons/MRT_ToggleFiltersButton.tsx +1 -1
- package/src/buttons/MRT_ToggleFullScreenButton.tsx +0 -1
- package/src/buttons/MRT_ToggleGlobalFilterButton.tsx +1 -1
- package/src/buttons/MRT_ToggleRowActionMenuButton.tsx +1 -2
- package/src/column.utils.ts +17 -0
- package/src/head/MRT_TableHeadCellColumnActionsButton.tsx +0 -1
- package/src/head/MRT_TableHeadCellFilterLabel.tsx +1 -1
- package/src/head/MRT_TableHeadCellSortLabel.tsx +1 -1
- package/src/hooks/index.ts +4 -0
- package/src/hooks/useMRT_TableOptions.ts +2 -2
- package/src/index.ts +1 -0
- package/src/inputs/MRT_EditCellTextField.tsx +20 -30
- package/src/inputs/MRT_FilterCheckbox.tsx +0 -1
- package/src/inputs/MRT_FilterTextField.tsx +41 -53
- package/src/inputs/MRT_GlobalFilterTextField.tsx +2 -2
- package/src/inputs/MRT_SelectCheckbox.tsx +0 -1
- package/src/locales/zh-Hans.ts +18 -18
- package/src/menus/MRT_ShowHideColumnsMenuItems.tsx +0 -1
- package/src/table/MRT_TablePaper.tsx +6 -6
- package/src/types.ts +23 -4
- package/dist/cjs/index.js.map +0 -1
- package/dist/esm/material-react-table.esm.js.map +0 -1
- package/locales/ar.js +0 -93
- package/locales/az.js +0 -93
- package/locales/bg.js +0 -93
- package/locales/cs.js +0 -93
- package/locales/da.js +0 -93
- package/locales/de.js +0 -93
- package/locales/en.js +0 -93
- package/locales/es.js +0 -93
- package/locales/et.js +0 -93
- package/locales/fa.js +0 -93
- package/locales/fi.js +0 -93
- package/locales/fr.js +0 -93
- package/locales/hu.js +0 -93
- package/locales/hy.js +0 -93
- package/locales/id.js +0 -93
- package/locales/it.js +0 -93
- package/locales/ja.js +0 -93
- package/locales/ko.js +0 -93
- package/locales/nl.js +0 -93
- package/locales/no.js +0 -93
- package/locales/np.js +0 -93
- package/locales/pl.js +0 -93
- package/locales/pt-BR.js +0 -93
- package/locales/pt.js +0 -93
- package/locales/ro.js +0 -93
- package/locales/ru.js +0 -93
- package/locales/sk.js +0 -93
- package/locales/sr-Cyrl-RS.js +0 -93
- package/locales/sr-Latn-RS.js +0 -93
- package/locales/sv.js +0 -93
- package/locales/tr.js +0 -93
- package/locales/uk.js +0 -93
- package/locales/vi.js +0 -93
- package/locales/zh-Hans.js +0 -93
- package/locales/zh-Hant.js +0 -93
|
@@ -93,12 +93,12 @@ export const MRT_EditActionButtons = <TData extends MRT_RowData>({
|
|
|
93
93
|
>
|
|
94
94
|
{variant === 'icon' ? (
|
|
95
95
|
<>
|
|
96
|
-
<Tooltip
|
|
96
|
+
<Tooltip title={localization.cancel}>
|
|
97
97
|
<IconButton aria-label={localization.cancel} onClick={handleCancel}>
|
|
98
98
|
<CancelIcon />
|
|
99
99
|
</IconButton>
|
|
100
100
|
</Tooltip>
|
|
101
|
-
<Tooltip
|
|
101
|
+
<Tooltip title={localization.save}>
|
|
102
102
|
<IconButton
|
|
103
103
|
aria-label={localization.save}
|
|
104
104
|
color="info"
|
|
@@ -27,7 +27,7 @@ export const MRT_ShowHideColumnsButton = <TData extends MRT_RowData>({
|
|
|
27
27
|
|
|
28
28
|
return (
|
|
29
29
|
<>
|
|
30
|
-
<Tooltip
|
|
30
|
+
<Tooltip title={rest?.title ?? localization.showHideColumns}>
|
|
31
31
|
<IconButton
|
|
32
32
|
aria-label={localization.showHideColumns}
|
|
33
33
|
onClick={handleClick}
|
|
@@ -31,7 +31,7 @@ export const MRT_ToggleDensePaddingButton = <TData extends MRT_RowData>({
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
return (
|
|
34
|
-
<Tooltip
|
|
34
|
+
<Tooltip title={rest?.title ?? localization.toggleDensity}>
|
|
35
35
|
<IconButton
|
|
36
36
|
aria-label={localization.toggleDensity}
|
|
37
37
|
onClick={handleToggleDensePadding}
|
|
@@ -25,7 +25,7 @@ export const MRT_ToggleFiltersButton = <TData extends MRT_RowData>({
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
return (
|
|
28
|
-
<Tooltip
|
|
28
|
+
<Tooltip title={rest?.title ?? localization.showHideFilters}>
|
|
29
29
|
<IconButton
|
|
30
30
|
aria-label={localization.showHideFilters}
|
|
31
31
|
onClick={handleToggleShowFilters}
|
|
@@ -28,7 +28,7 @@ export const MRT_ToggleGlobalFilterButton = <TData extends MRT_RowData>({
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
return (
|
|
31
|
-
<Tooltip
|
|
31
|
+
<Tooltip title={rest?.title ?? localization.showHideSearch}>
|
|
32
32
|
<IconButton
|
|
33
33
|
aria-label={rest?.title ?? localization.showHideSearch}
|
|
34
34
|
disabled={!!globalFilter}
|
|
@@ -80,7 +80,7 @@ export const MRT_ToggleRowActionMenuButton = <TData extends MRT_RowData>({
|
|
|
80
80
|
) : !renderRowActionMenuItems &&
|
|
81
81
|
parseFromValuesOrFunc(enableEditing, row) &&
|
|
82
82
|
['modal', 'row'].includes(editDisplayMode!) ? (
|
|
83
|
-
<Tooltip
|
|
83
|
+
<Tooltip placement="right" title={localization.edit}>
|
|
84
84
|
<IconButton
|
|
85
85
|
aria-label={localization.edit}
|
|
86
86
|
onClick={handleStartEditMode}
|
|
@@ -93,7 +93,6 @@ export const MRT_ToggleRowActionMenuButton = <TData extends MRT_RowData>({
|
|
|
93
93
|
) : renderRowActionMenuItems ? (
|
|
94
94
|
<>
|
|
95
95
|
<Tooltip
|
|
96
|
-
arrow
|
|
97
96
|
enterDelay={1000}
|
|
98
97
|
enterNextDelay={1000}
|
|
99
98
|
title={localization.rowActions}
|
package/src/column.utils.ts
CHANGED
|
@@ -348,3 +348,20 @@ export function createMRTColumnHelper<
|
|
|
348
348
|
group: (column) => column as MRT_GroupColumnDef<TData>,
|
|
349
349
|
};
|
|
350
350
|
}
|
|
351
|
+
|
|
352
|
+
export const getValueAndLabel = (
|
|
353
|
+
option: { label?: string; text?: string; value: string } | string,
|
|
354
|
+
): { label: string; value: string } => {
|
|
355
|
+
let label: string = '';
|
|
356
|
+
let value: string = '';
|
|
357
|
+
if (option) {
|
|
358
|
+
if (typeof option !== 'object') {
|
|
359
|
+
label = option;
|
|
360
|
+
value = option;
|
|
361
|
+
} else {
|
|
362
|
+
label = option.label ?? option.text ?? option.value;
|
|
363
|
+
value = option.value ?? label;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
return { label, value };
|
|
367
|
+
};
|
|
@@ -92,7 +92,7 @@ export const MRT_TableHeadCellFilterLabel = <TData extends MRT_RowData = {}>({
|
|
|
92
92
|
unmountOnExit
|
|
93
93
|
>
|
|
94
94
|
<Box component="span" sx={{ flex: '0 0' }}>
|
|
95
|
-
<Tooltip
|
|
95
|
+
<Tooltip placement="top" title={filterTooltip}>
|
|
96
96
|
<IconButton
|
|
97
97
|
disableRipple
|
|
98
98
|
onClick={(event: MouseEvent<HTMLButtonElement>) => {
|
|
@@ -45,7 +45,7 @@ export const MRT_TableHeadCellSortLabel = <TData extends MRT_RowData>({
|
|
|
45
45
|
: localization.sortByColumnAsc.replace('{column}', columnDef.header);
|
|
46
46
|
|
|
47
47
|
return (
|
|
48
|
-
<Tooltip
|
|
48
|
+
<Tooltip placement="top" title={sortTooltip}>
|
|
49
49
|
<Badge
|
|
50
50
|
badgeContent={sorting.length > 1 ? column.getSortIndex() + 1 : 0}
|
|
51
51
|
overlap="circular"
|
|
@@ -86,7 +86,7 @@ export const useMRT_TableOptions: <TData extends MRT_RowData>(
|
|
|
86
86
|
positionPagination = 'bottom',
|
|
87
87
|
positionToolbarAlertBanner = 'top',
|
|
88
88
|
positionToolbarDropZone = 'top',
|
|
89
|
-
|
|
89
|
+
rowNumberDisplayMode = 'static',
|
|
90
90
|
rowPinningDisplayMode = 'sticky',
|
|
91
91
|
selectAllMode = 'page',
|
|
92
92
|
sortingFns,
|
|
@@ -194,7 +194,7 @@ export const useMRT_TableOptions: <TData extends MRT_RowData>(
|
|
|
194
194
|
positionPagination,
|
|
195
195
|
positionToolbarAlertBanner,
|
|
196
196
|
positionToolbarDropZone,
|
|
197
|
-
|
|
197
|
+
rowNumberDisplayMode,
|
|
198
198
|
rowPinningDisplayMode,
|
|
199
199
|
selectAllMode,
|
|
200
200
|
sortingFns: _sortingFns,
|
package/src/index.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import MenuItem from '@mui/material/MenuItem';
|
|
8
8
|
import TextField from '@mui/material/TextField';
|
|
9
9
|
import { type TextFieldProps } from '@mui/material/TextField';
|
|
10
|
-
import { parseFromValuesOrFunc } from '../column.utils';
|
|
10
|
+
import { getValueAndLabel, parseFromValuesOrFunc } from '../column.utils';
|
|
11
11
|
import {
|
|
12
12
|
type MRT_Cell,
|
|
13
13
|
type MRT_RowData,
|
|
@@ -62,9 +62,9 @@ export const MRT_EditCellTextField = <TData extends MRT_RowData>({
|
|
|
62
62
|
//@ts-ignore
|
|
63
63
|
row._valuesCache[column.id] = newValue;
|
|
64
64
|
if (isCreating) {
|
|
65
|
-
setCreatingRow(
|
|
65
|
+
setCreatingRow(row);
|
|
66
66
|
} else if (isEditing) {
|
|
67
|
-
setEditingRow(
|
|
67
|
+
setEditingRow(row);
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
|
|
@@ -150,33 +150,23 @@ export const MRT_EditCellTextField = <TData extends MRT_RowData>({
|
|
|
150
150
|
onKeyDown={handleEnterKeyDown}
|
|
151
151
|
>
|
|
152
152
|
{textFieldProps.children ??
|
|
153
|
-
columnDef?.editSelectOptions?.map(
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
gap: '0.5rem',
|
|
171
|
-
m: 0,
|
|
172
|
-
}}
|
|
173
|
-
value={value}
|
|
174
|
-
>
|
|
175
|
-
{text}
|
|
176
|
-
</MenuItem>
|
|
177
|
-
);
|
|
178
|
-
},
|
|
179
|
-
)}
|
|
153
|
+
columnDef?.editSelectOptions?.map((option) => {
|
|
154
|
+
const { label, value } = getValueAndLabel(option);
|
|
155
|
+
return (
|
|
156
|
+
<MenuItem
|
|
157
|
+
key={value}
|
|
158
|
+
sx={{
|
|
159
|
+
alignItems: 'center',
|
|
160
|
+
display: 'flex',
|
|
161
|
+
gap: '0.5rem',
|
|
162
|
+
m: 0,
|
|
163
|
+
}}
|
|
164
|
+
value={value}
|
|
165
|
+
>
|
|
166
|
+
{label}
|
|
167
|
+
</MenuItem>
|
|
168
|
+
);
|
|
169
|
+
})}
|
|
180
170
|
</TextField>
|
|
181
171
|
);
|
|
182
172
|
};
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
DatePicker,
|
|
22
22
|
type DatePickerProps,
|
|
23
23
|
} from '@mui/x-date-pickers/DatePicker';
|
|
24
|
-
import { parseFromValuesOrFunc } from '../column.utils';
|
|
24
|
+
import { getValueAndLabel, parseFromValuesOrFunc } from '../column.utils';
|
|
25
25
|
import { MRT_FilterOptionMenu } from '../menus/MRT_FilterOptionMenu';
|
|
26
26
|
import {
|
|
27
27
|
type MRT_Header,
|
|
@@ -242,7 +242,7 @@ export const MRT_FilterTextField = <TData extends MRT_RowData>({
|
|
|
242
242
|
position="end"
|
|
243
243
|
sx={{ mr: isSelectFilter || isMultiSelectFilter ? '20px' : undefined }}
|
|
244
244
|
>
|
|
245
|
-
<Tooltip
|
|
245
|
+
<Tooltip placement="right" title={localization.clearFilter ?? ''}>
|
|
246
246
|
<span>
|
|
247
247
|
<IconButton
|
|
248
248
|
aria-label={localization.clearFilter}
|
|
@@ -264,7 +264,7 @@ export const MRT_FilterTextField = <TData extends MRT_RowData>({
|
|
|
264
264
|
|
|
265
265
|
const startAdornment = showChangeModeButton ? (
|
|
266
266
|
<InputAdornment position="start">
|
|
267
|
-
<Tooltip
|
|
267
|
+
<Tooltip title={localization.changeFilterMode}>
|
|
268
268
|
<span>
|
|
269
269
|
<IconButton
|
|
270
270
|
aria-label={localization.changeFilterMode}
|
|
@@ -309,6 +309,7 @@ export const MRT_FilterTextField = <TData extends MRT_RowData>({
|
|
|
309
309
|
</label>
|
|
310
310
|
) : null,
|
|
311
311
|
inputProps: {
|
|
312
|
+
'aria-label': filterPlaceholder,
|
|
312
313
|
autoComplete: 'new-password', // disable autocomplete and autofill
|
|
313
314
|
disabled: !!filterChipLabel,
|
|
314
315
|
sx: {
|
|
@@ -373,9 +374,13 @@ export const MRT_FilterTextField = <TData extends MRT_RowData>({
|
|
|
373
374
|
) : isAutocompleteFilter ? (
|
|
374
375
|
<Autocomplete
|
|
375
376
|
freeSolo
|
|
376
|
-
getOptionLabel={(option) => option}
|
|
377
|
-
onChange={(_e, newValue) =>
|
|
378
|
-
|
|
377
|
+
getOptionLabel={(option) => getValueAndLabel(option).label}
|
|
378
|
+
onChange={(_e, newValue) =>
|
|
379
|
+
handleChange(getValueAndLabel(newValue).value)
|
|
380
|
+
}
|
|
381
|
+
options={
|
|
382
|
+
dropdownOptions?.map((option) => getValueAndLabel(option)) ?? []
|
|
383
|
+
}
|
|
379
384
|
{...autocompleteProps}
|
|
380
385
|
renderInput={(builtinTextFieldProps) => (
|
|
381
386
|
<TextField
|
|
@@ -407,19 +412,13 @@ export const MRT_FilterTextField = <TData extends MRT_RowData>({
|
|
|
407
412
|
) : (
|
|
408
413
|
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: '2px' }}>
|
|
409
414
|
{(selected as string[])?.map((value) => {
|
|
410
|
-
const selectedValue = dropdownOptions?.find(
|
|
411
|
-
option
|
|
412
|
-
? option.value === value
|
|
413
|
-
: option === value,
|
|
415
|
+
const selectedValue = dropdownOptions?.find(
|
|
416
|
+
(option) => getValueAndLabel(option).value === value,
|
|
414
417
|
);
|
|
415
418
|
return (
|
|
416
419
|
<Chip
|
|
417
420
|
key={value}
|
|
418
|
-
label={
|
|
419
|
-
selectedValue instanceof Object
|
|
420
|
-
? selectedValue.text
|
|
421
|
-
: selectedValue
|
|
422
|
-
}
|
|
421
|
+
label={getValueAndLabel(selectedValue).label}
|
|
423
422
|
/>
|
|
424
423
|
);
|
|
425
424
|
})}
|
|
@@ -438,44 +437,33 @@ export const MRT_FilterTextField = <TData extends MRT_RowData>({
|
|
|
438
437
|
</MenuItem>,
|
|
439
438
|
...[
|
|
440
439
|
textFieldProps.children ??
|
|
441
|
-
dropdownOptions?.map(
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
{
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
).includes(value)}
|
|
469
|
-
sx={{ mr: '0.5rem' }}
|
|
470
|
-
/>
|
|
471
|
-
)}
|
|
472
|
-
{text}{' '}
|
|
473
|
-
{!columnDef.filterSelectOptions &&
|
|
474
|
-
`(${facetedUniqueValues.get(value)})`}
|
|
475
|
-
</MenuItem>
|
|
476
|
-
);
|
|
477
|
-
},
|
|
478
|
-
),
|
|
440
|
+
dropdownOptions?.map((option, index) => {
|
|
441
|
+
const { label, value } = getValueAndLabel(option);
|
|
442
|
+
return (
|
|
443
|
+
<MenuItem
|
|
444
|
+
key={`${index}-${value}`}
|
|
445
|
+
sx={{
|
|
446
|
+
alignItems: 'center',
|
|
447
|
+
display: 'flex',
|
|
448
|
+
gap: '0.5rem',
|
|
449
|
+
m: 0,
|
|
450
|
+
}}
|
|
451
|
+
value={value}
|
|
452
|
+
>
|
|
453
|
+
{isMultiSelectFilter && (
|
|
454
|
+
<Checkbox
|
|
455
|
+
checked={(
|
|
456
|
+
(column.getFilterValue() ?? []) as string[]
|
|
457
|
+
).includes(value)}
|
|
458
|
+
sx={{ mr: '0.5rem' }}
|
|
459
|
+
/>
|
|
460
|
+
)}
|
|
461
|
+
{label}{' '}
|
|
462
|
+
{!columnDef.filterSelectOptions &&
|
|
463
|
+
`(${facetedUniqueValues.get(value)})`}
|
|
464
|
+
</MenuItem>
|
|
465
|
+
);
|
|
466
|
+
}),
|
|
479
467
|
],
|
|
480
468
|
]}
|
|
481
469
|
</TextField>
|
|
@@ -95,7 +95,7 @@ export const MRT_GlobalFilterTextField = <TData extends MRT_RowData>({
|
|
|
95
95
|
InputProps={{
|
|
96
96
|
endAdornment: (
|
|
97
97
|
<InputAdornment position="end">
|
|
98
|
-
<Tooltip
|
|
98
|
+
<Tooltip title={localization.clearSearch ?? ''}>
|
|
99
99
|
<span>
|
|
100
100
|
<IconButton
|
|
101
101
|
aria-label={localization.clearSearch}
|
|
@@ -111,7 +111,7 @@ export const MRT_GlobalFilterTextField = <TData extends MRT_RowData>({
|
|
|
111
111
|
),
|
|
112
112
|
startAdornment: enableGlobalFilterModes ? (
|
|
113
113
|
<InputAdornment position="start">
|
|
114
|
-
<Tooltip
|
|
114
|
+
<Tooltip title={localization.changeSearchMode}>
|
|
115
115
|
<IconButton
|
|
116
116
|
aria-label={localization.changeSearchMode}
|
|
117
117
|
onClick={handleGlobalFilterMenuOpen}
|
package/src/locales/zh-Hans.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { type MRT_Localization } from '..';
|
|
2
2
|
|
|
3
3
|
export const MRT_Localization_ZH_HANS: MRT_Localization = {
|
|
4
|
-
actions: '
|
|
4
|
+
actions: '操作',
|
|
5
5
|
and: '与',
|
|
6
6
|
cancel: '取消',
|
|
7
7
|
changeFilterMode: '更改过滤模式',
|
|
8
|
-
changeSearchMode: '
|
|
8
|
+
changeSearchMode: '更改搜索模式',
|
|
9
9
|
clearFilter: '清除过滤',
|
|
10
|
-
clearSearch: '
|
|
10
|
+
clearSearch: '清除搜索',
|
|
11
11
|
clearSort: '清除排序',
|
|
12
12
|
clickToCopy: '点击以复制',
|
|
13
13
|
collapse: '折叠',
|
|
14
14
|
collapseAll: '全部折叠',
|
|
15
|
-
columnActions: '
|
|
15
|
+
columnActions: '列操作',
|
|
16
16
|
copiedToClipboard: '已复制至剪贴板',
|
|
17
17
|
dropToGroupBy: '拖放以按 {column} 分组',
|
|
18
18
|
edit: '编辑',
|
|
@@ -42,7 +42,7 @@ export const MRT_Localization_ZH_HANS: MRT_Localization = {
|
|
|
42
42
|
filterNotEquals: '不等于',
|
|
43
43
|
filterStartsWith: '开首为',
|
|
44
44
|
filterWeakEquals: '等于',
|
|
45
|
-
filteringByColumn: '
|
|
45
|
+
filteringByColumn: '以 {column} 过滤:{filterType} {filterValue}',
|
|
46
46
|
goToFirstPage: '到第一页',
|
|
47
47
|
goToLastPage: '到最后一页',
|
|
48
48
|
goToNextPage: '下一页',
|
|
@@ -51,7 +51,7 @@ export const MRT_Localization_ZH_HANS: MRT_Localization = {
|
|
|
51
51
|
groupByColumn: '按 {column} 分组',
|
|
52
52
|
groupedBy: '分组依据 ',
|
|
53
53
|
hideAll: '隐藏全部',
|
|
54
|
-
hideColumn: '隐藏 {column}
|
|
54
|
+
hideColumn: '隐藏 {column} 列',
|
|
55
55
|
max: '最大',
|
|
56
56
|
min: '最小',
|
|
57
57
|
move: '移动',
|
|
@@ -62,30 +62,30 @@ export const MRT_Localization_ZH_HANS: MRT_Localization = {
|
|
|
62
62
|
pin: '固定',
|
|
63
63
|
pinToLeft: '固定至左边',
|
|
64
64
|
pinToRight: '固定至右边',
|
|
65
|
-
resetColumnSize: '
|
|
65
|
+
resetColumnSize: '重置列大小',
|
|
66
66
|
resetOrder: '重置排序',
|
|
67
|
-
rowActions: '
|
|
67
|
+
rowActions: '行操作',
|
|
68
68
|
rowNumber: '#',
|
|
69
|
-
rowNumbers: '
|
|
70
|
-
rowsPerPage: '
|
|
71
|
-
save: '
|
|
72
|
-
search: '
|
|
73
|
-
selectedCountOfRowCountRowsSelected: '
|
|
69
|
+
rowNumbers: '行号码',
|
|
70
|
+
rowsPerPage: '每页行数',
|
|
71
|
+
save: '保存',
|
|
72
|
+
search: '搜索',
|
|
73
|
+
selectedCountOfRowCountRowsSelected: '已选择行:{selectedCount}/{rowCount}',
|
|
74
74
|
select: '选择',
|
|
75
75
|
showAll: '显示全部',
|
|
76
|
-
showAllColumns: '
|
|
77
|
-
showHideColumns: '显示/隐藏
|
|
76
|
+
showAllColumns: '显示全部列',
|
|
77
|
+
showHideColumns: '显示/隐藏 列',
|
|
78
78
|
showHideFilters: '显示/隐藏 过滤条件',
|
|
79
|
-
showHideSearch: '显示/隐藏
|
|
79
|
+
showHideSearch: '显示/隐藏 搜索条件',
|
|
80
80
|
sortByColumnAsc: '按 {column} 顺序排序',
|
|
81
81
|
sortByColumnDesc: '按 {column} 倒序排序',
|
|
82
82
|
sortedByColumnAsc: '已按 {column} 顺序排序',
|
|
83
83
|
sortedByColumnDesc: '已按 {column} 倒序排序',
|
|
84
84
|
thenBy: ',然后以',
|
|
85
|
-
toggleDensity: '
|
|
85
|
+
toggleDensity: '切换间距',
|
|
86
86
|
toggleFullScreen: '切换全屏',
|
|
87
87
|
toggleSelectAll: '切换选择全部',
|
|
88
|
-
toggleSelectRow: '
|
|
88
|
+
toggleSelectRow: '切换选择行',
|
|
89
89
|
toggleVisibility: '切换可见度',
|
|
90
90
|
ungroupByColumn: '取消按 {column} 分组',
|
|
91
91
|
unpin: '取消固定',
|
|
@@ -27,7 +27,7 @@ export const MRT_TablePaper = <TData extends MRT_RowData>({
|
|
|
27
27
|
} = table;
|
|
28
28
|
const { isFullScreen } = getState();
|
|
29
29
|
|
|
30
|
-
const
|
|
30
|
+
const paperProps = {
|
|
31
31
|
...parseFromValuesOrFunc(muiTablePaperProps, { table }),
|
|
32
32
|
...rest,
|
|
33
33
|
};
|
|
@@ -35,12 +35,12 @@ export const MRT_TablePaper = <TData extends MRT_RowData>({
|
|
|
35
35
|
return (
|
|
36
36
|
<Paper
|
|
37
37
|
elevation={2}
|
|
38
|
-
{...
|
|
38
|
+
{...paperProps}
|
|
39
39
|
ref={(ref: HTMLDivElement) => {
|
|
40
40
|
tablePaperRef.current = ref;
|
|
41
|
-
if (
|
|
41
|
+
if (paperProps?.ref) {
|
|
42
42
|
//@ts-ignore
|
|
43
|
-
|
|
43
|
+
paperProps.ref.current = ref;
|
|
44
44
|
}
|
|
45
45
|
}}
|
|
46
46
|
style={{
|
|
@@ -60,14 +60,14 @@ export const MRT_TablePaper = <TData extends MRT_RowData>({
|
|
|
60
60
|
zIndex: 999,
|
|
61
61
|
}
|
|
62
62
|
: {}),
|
|
63
|
-
...
|
|
63
|
+
...paperProps?.style,
|
|
64
64
|
}}
|
|
65
65
|
sx={(theme) => ({
|
|
66
66
|
backgroundColor: getMRTTheme(table, theme).baseBackgroundColor,
|
|
67
67
|
backgroundImage: 'unset',
|
|
68
68
|
overflow: 'hidden',
|
|
69
69
|
transition: 'all 100ms ease-in-out',
|
|
70
|
-
...(parseFromValuesOrFunc(
|
|
70
|
+
...(parseFromValuesOrFunc(paperProps?.sx, theme) as any),
|
|
71
71
|
})}
|
|
72
72
|
>
|
|
73
73
|
{enableTopToolbar &&
|
package/src/types.ts
CHANGED
|
@@ -424,7 +424,17 @@ export type MRT_ColumnDef<TData extends MRT_RowData, TValue = unknown> = Omit<
|
|
|
424
424
|
LiteralUnion<string & MRT_FilterOption>
|
|
425
425
|
> | null;
|
|
426
426
|
columns?: MRT_ColumnDef<TData, TValue>[];
|
|
427
|
-
editSelectOptions?: (
|
|
427
|
+
editSelectOptions?: (
|
|
428
|
+
| {
|
|
429
|
+
label?: string;
|
|
430
|
+
/**
|
|
431
|
+
* @deprecated use `label` instead
|
|
432
|
+
*/
|
|
433
|
+
text?: string;
|
|
434
|
+
value: any;
|
|
435
|
+
}
|
|
436
|
+
| string
|
|
437
|
+
)[];
|
|
428
438
|
editVariant?: 'select' | 'text';
|
|
429
439
|
enableClickToCopy?: boolean;
|
|
430
440
|
enableColumnActions?: boolean;
|
|
@@ -434,7 +444,17 @@ export type MRT_ColumnDef<TData extends MRT_RowData, TValue = unknown> = Omit<
|
|
|
434
444
|
enableEditing?: ((row: MRT_Row<TData>) => boolean) | boolean;
|
|
435
445
|
enableFilterMatchHighlighting?: boolean;
|
|
436
446
|
filterFn?: MRT_FilterFn<TData>;
|
|
437
|
-
filterSelectOptions?: (
|
|
447
|
+
filterSelectOptions?: (
|
|
448
|
+
| {
|
|
449
|
+
label?: string;
|
|
450
|
+
/**
|
|
451
|
+
* @deprecated use `label` instead
|
|
452
|
+
*/
|
|
453
|
+
text?: string;
|
|
454
|
+
value: any;
|
|
455
|
+
}
|
|
456
|
+
| string
|
|
457
|
+
)[];
|
|
438
458
|
filterVariant?:
|
|
439
459
|
| 'autocomplete'
|
|
440
460
|
| 'checkbox'
|
|
@@ -1094,7 +1114,7 @@ export type MRT_TableOptions<TData extends MRT_RowData> = Omit<
|
|
|
1094
1114
|
table: MRT_TableInstance<TData>;
|
|
1095
1115
|
}) => ReactNode;
|
|
1096
1116
|
rowCount?: number;
|
|
1097
|
-
|
|
1117
|
+
rowNumberDisplayMode?: 'original' | 'static';
|
|
1098
1118
|
rowPinningDisplayMode?:
|
|
1099
1119
|
| 'bottom'
|
|
1100
1120
|
| 'select-bottom'
|
|
@@ -1113,7 +1133,6 @@ export type MRT_TableOptions<TData extends MRT_RowData> = Omit<
|
|
|
1113
1133
|
}) => Partial<VirtualizerOptions<HTMLDivElement, HTMLTableRowElement>>)
|
|
1114
1134
|
| Partial<VirtualizerOptions<HTMLDivElement, HTMLTableRowElement>>;
|
|
1115
1135
|
selectAllMode?: 'all' | 'page';
|
|
1116
|
-
selectDisplayMode?: 'checkbox' | 'radio' | 'switch';
|
|
1117
1136
|
/**
|
|
1118
1137
|
* Manage state externally any way you want, then pass it back into MRT.
|
|
1119
1138
|
*/
|