material-react-table 3.1.0 → 3.2.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.
Files changed (127) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.esm.js +38 -13
  3. package/dist/index.esm.js.map +1 -1
  4. package/dist/index.js +38 -13
  5. package/dist/index.js.map +1 -1
  6. package/locales/ar/index.esm.js +1 -0
  7. package/locales/ar/index.js +1 -0
  8. package/locales/az/index.esm.js +1 -0
  9. package/locales/az/index.js +1 -0
  10. package/locales/bg/index.esm.js +1 -0
  11. package/locales/bg/index.js +1 -0
  12. package/locales/cs/index.esm.js +1 -0
  13. package/locales/cs/index.js +1 -0
  14. package/locales/da/index.esm.js +1 -0
  15. package/locales/da/index.js +1 -0
  16. package/locales/de/index.esm.js +1 -0
  17. package/locales/de/index.js +1 -0
  18. package/locales/el/index.esm.js +1 -0
  19. package/locales/el/index.js +1 -0
  20. package/locales/en/index.esm.js +1 -0
  21. package/locales/en/index.js +1 -0
  22. package/locales/es/index.esm.js +1 -0
  23. package/locales/es/index.js +1 -0
  24. package/locales/et/index.esm.js +1 -0
  25. package/locales/et/index.js +1 -0
  26. package/locales/fa/index.esm.js +1 -0
  27. package/locales/fa/index.js +1 -0
  28. package/locales/fi/index.esm.js +1 -0
  29. package/locales/fi/index.js +1 -0
  30. package/locales/fr/index.esm.js +1 -0
  31. package/locales/fr/index.js +1 -0
  32. package/locales/he/index.esm.js +1 -0
  33. package/locales/he/index.js +1 -0
  34. package/locales/hr/index.esm.js +1 -0
  35. package/locales/hr/index.js +1 -0
  36. package/locales/hu/index.esm.js +1 -0
  37. package/locales/hu/index.js +1 -0
  38. package/locales/hy/index.esm.js +1 -0
  39. package/locales/hy/index.js +1 -0
  40. package/locales/id/index.esm.js +1 -0
  41. package/locales/id/index.js +1 -0
  42. package/locales/it/index.esm.js +1 -0
  43. package/locales/it/index.js +1 -0
  44. package/locales/ja/index.esm.js +1 -0
  45. package/locales/ja/index.js +1 -0
  46. package/locales/ko/index.esm.js +1 -0
  47. package/locales/ko/index.js +1 -0
  48. package/locales/nl/index.esm.js +1 -0
  49. package/locales/nl/index.js +1 -0
  50. package/locales/no/index.esm.js +1 -0
  51. package/locales/no/index.js +1 -0
  52. package/locales/np/index.esm.js +1 -0
  53. package/locales/np/index.js +1 -0
  54. package/locales/pl/index.esm.js +1 -0
  55. package/locales/pl/index.js +1 -0
  56. package/locales/pt/index.esm.js +1 -0
  57. package/locales/pt/index.js +1 -0
  58. package/locales/pt-BR/index.esm.js +1 -0
  59. package/locales/pt-BR/index.js +1 -0
  60. package/locales/ro/index.esm.js +1 -0
  61. package/locales/ro/index.js +1 -0
  62. package/locales/ru/index.esm.js +1 -0
  63. package/locales/ru/index.js +1 -0
  64. package/locales/sk/index.esm.js +1 -0
  65. package/locales/sk/index.js +1 -0
  66. package/locales/sr-Cyrl-RS/index.esm.js +1 -0
  67. package/locales/sr-Cyrl-RS/index.js +1 -0
  68. package/locales/sr-Latn-RS/index.esm.js +1 -0
  69. package/locales/sr-Latn-RS/index.js +1 -0
  70. package/locales/sv/index.esm.js +1 -0
  71. package/locales/sv/index.js +1 -0
  72. package/locales/tr/index.esm.js +1 -0
  73. package/locales/tr/index.js +1 -0
  74. package/locales/uk/index.esm.js +1 -0
  75. package/locales/uk/index.js +1 -0
  76. package/locales/vi/index.esm.js +1 -0
  77. package/locales/vi/index.js +1 -0
  78. package/locales/zh-Hans/index.esm.js +1 -0
  79. package/locales/zh-Hans/index.js +1 -0
  80. package/locales/zh-Hant/index.esm.js +1 -0
  81. package/locales/zh-Hant/index.js +1 -0
  82. package/package.json +1 -1
  83. package/src/components/inputs/MRT_FilterTextField.tsx +18 -4
  84. package/src/components/toolbar/MRT_TablePagination.tsx +5 -3
  85. package/src/components/toolbar/MRT_ToolbarAlertBanner.tsx +2 -2
  86. package/src/hooks/useMRT_Effects.ts +1 -1
  87. package/src/hooks/useMRT_RowVirtualizer.ts +16 -4
  88. package/src/locales/ar.ts +1 -0
  89. package/src/locales/az.ts +1 -0
  90. package/src/locales/bg.ts +1 -0
  91. package/src/locales/cs.ts +1 -0
  92. package/src/locales/da.ts +1 -0
  93. package/src/locales/de.ts +1 -0
  94. package/src/locales/el.ts +1 -0
  95. package/src/locales/en.ts +1 -0
  96. package/src/locales/es.ts +1 -0
  97. package/src/locales/et.ts +1 -0
  98. package/src/locales/fa.ts +1 -0
  99. package/src/locales/fi.ts +1 -0
  100. package/src/locales/fr.ts +1 -0
  101. package/src/locales/he.ts +1 -0
  102. package/src/locales/hr.ts +1 -0
  103. package/src/locales/hu.ts +1 -0
  104. package/src/locales/hy.ts +1 -0
  105. package/src/locales/id.ts +1 -0
  106. package/src/locales/it.ts +1 -0
  107. package/src/locales/ja.ts +1 -0
  108. package/src/locales/ko.ts +1 -0
  109. package/src/locales/nl.ts +1 -0
  110. package/src/locales/no.ts +1 -0
  111. package/src/locales/np.ts +1 -0
  112. package/src/locales/pl.ts +1 -0
  113. package/src/locales/pt-BR.ts +1 -0
  114. package/src/locales/pt.ts +1 -0
  115. package/src/locales/ro.ts +1 -0
  116. package/src/locales/ru.ts +1 -0
  117. package/src/locales/sk.ts +1 -0
  118. package/src/locales/sr-Cyrl-RS.ts +1 -0
  119. package/src/locales/sr-Latn-RS.ts +1 -0
  120. package/src/locales/sv.ts +1 -0
  121. package/src/locales/tr.ts +1 -0
  122. package/src/locales/uk.ts +1 -0
  123. package/src/locales/vi.ts +1 -0
  124. package/src/locales/zh-Hans.ts +1 -0
  125. package/src/locales/zh-Hant.ts +1 -0
  126. package/src/types.ts +2 -0
  127. package/src/utils/virtualization.utils.ts +5 -0
@@ -1,12 +1,13 @@
1
1
  import {
2
2
  type ChangeEvent,
3
3
  type MouseEvent,
4
+ SyntheticEvent,
4
5
  useCallback,
5
6
  useEffect,
6
7
  useRef,
7
8
  useState,
8
9
  } from 'react';
9
- import Autocomplete from '@mui/material/Autocomplete';
10
+ import Autocomplete, { AutocompleteInputChangeReason } from '@mui/material/Autocomplete';
10
11
  import Box from '@mui/material/Box';
11
12
  import Checkbox from '@mui/material/Checkbox';
12
13
  import Chip from '@mui/material/Chip';
@@ -143,11 +144,13 @@ export const MRT_FilterTextField = <TData extends MRT_RowData>({
143
144
  ? (column.getFilterValue() as [string, string])?.[
144
145
  rangeFilterIndex as number
145
146
  ] || ''
147
+ : isAutocompleteFilter
148
+ ? typeof column.getFilterValue() === 'string' ? column.getFilterValue() as string : ''
146
149
  : ((column.getFilterValue() as string) ?? ''),
147
150
  );
148
151
  const [autocompleteValue, setAutocompleteValue] =
149
152
  useState<DropdownOption | null>(
150
- isAutocompleteFilter ? (filterValue as DropdownOption | null) : null,
153
+ () => isAutocompleteFilter ? ((column.getFilterValue() || null) as DropdownOption | null) : null,
151
154
  );
152
155
 
153
156
  const handleChangeDebounced = useCallback(
@@ -184,9 +187,13 @@ export const MRT_FilterTextField = <TData extends MRT_RowData>({
184
187
  textFieldProps?.onChange?.(event);
185
188
  };
186
189
 
190
+ const handleAutocompleteInputChange = (_event: SyntheticEvent, newValue: string, _reason: AutocompleteInputChangeReason) => {
191
+ handleChange(newValue)
192
+ };
193
+
187
194
  const handleAutocompleteChange = (newValue: DropdownOption | null) => {
188
195
  setAutocompleteValue(newValue);
189
- handleChange(getValueAndLabel(newValue).value);
196
+ handleChangeDebounced(getValueAndLabel(newValue).value);
190
197
  };
191
198
 
192
199
  const handleClear = () => {
@@ -200,6 +207,12 @@ export const MRT_FilterTextField = <TData extends MRT_RowData>({
200
207
  newFilterValues[rangeFilterIndex as number] = undefined;
201
208
  return newFilterValues;
202
209
  });
210
+ } else if (isAutocompleteFilter) {
211
+ setAutocompleteValue(null)
212
+ setFilterValue('')
213
+ // when using 'autocomplete' this function is called only inside effect and only if the filterValue === undefined
214
+ // so the following call is excessive; should be uncommented if the handleClear becomes part of the Autocomplete component callbacks
215
+ // column.setFilterValue(undefined)
203
216
  } else {
204
217
  setFilterValue('');
205
218
  column.setFilterValue(undefined);
@@ -434,6 +447,8 @@ export const MRT_FilterTextField = <TData extends MRT_RowData>({
434
447
  options={
435
448
  dropdownOptions?.map((option) => getValueAndLabel(option)) ?? []
436
449
  }
450
+ inputValue={filterValue as string}
451
+ onInputChange={handleAutocompleteInputChange}
437
452
  {...autocompleteProps}
438
453
  renderInput={(builtinTextFieldProps: TextFieldProps) => (
439
454
  <TextField
@@ -455,7 +470,6 @@ export const MRT_FilterTextField = <TData extends MRT_RowData>({
455
470
  ...commonTextFieldProps?.slotProps?.htmlInput,
456
471
  },
457
472
  }}
458
- onChange={handleTextFieldChange}
459
473
  onClick={(e: MouseEvent<HTMLInputElement>) => e.stopPropagation()}
460
474
  />
461
475
  )}
@@ -174,10 +174,12 @@ export const MRT_TablePagination = <TData extends MRT_RowData>({
174
174
  sx={{ m: '0 4px', minWidth: '8ch' }}
175
175
  variant="body2"
176
176
  >{`${
177
- lastRowIndex === 0 ? 0 : (firstRowIndex + 1).toLocaleString()
178
- }-${lastRowIndex.toLocaleString()} ${
177
+ lastRowIndex === 0
178
+ ? 0
179
+ : (firstRowIndex + 1).toLocaleString(localization.language)
180
+ }-${lastRowIndex.toLocaleString(localization.language)} ${
179
181
  localization.of
180
- } ${totalRowCount.toLocaleString()}`}</Typography>
182
+ } ${totalRowCount.toLocaleString(localization.language)}`}</Typography>
181
183
  <Box gap="xs">
182
184
  {showFirstButton && (
183
185
  <Tooltip {...tooltipProps} title={localization.goToFirstPage}>
@@ -65,8 +65,8 @@ export const MRT_ToolbarAlertBanner = <TData extends MRT_RowData>({
65
65
  selectedRowCount > 0 ? (
66
66
  <Stack alignItems="center" direction="row" gap="16px">
67
67
  {localization.selectedCountOfRowCountRowsSelected
68
- ?.replace('{selectedCount}', selectedRowCount.toLocaleString())
69
- ?.replace('{rowCount}', totalRowCount.toString())}
68
+ ?.replace('{selectedCount}', selectedRowCount.toLocaleString(localization.language))
69
+ ?.replace('{rowCount}', totalRowCount.toLocaleString(localization.language))}
70
70
  <Button
71
71
  onClick={(event) =>
72
72
  getMRT_SelectAllHandler({ table })(event, false, true)
@@ -73,7 +73,7 @@ export const useMRT_Effects = <TData extends MRT_RowData>(
73
73
  if (firstVisibleRowIndex >= totalRowCount) {
74
74
  table.setPageIndex(Math.ceil(totalRowCount / pageSize) - 1);
75
75
  }
76
- }, [totalRowCount]);
76
+ }, [totalRowCount, enablePagination, isLoading, showSkeletons]);
77
77
 
78
78
  //turn off sort when global filter is looking for ranked results
79
79
  const appliedSort = useRef<MRT_SortingState>(sorting);
@@ -1,4 +1,4 @@
1
- import { useCallback } from 'react';
1
+ import { useCallback, useMemo } from 'react';
2
2
  import { type Range, useVirtualizer } from '@tanstack/react-virtual';
3
3
  import {
4
4
  type MRT_Row,
@@ -36,7 +36,19 @@ export const useMRT_RowVirtualizer = <
36
36
  table,
37
37
  });
38
38
 
39
- const rowCount = rows?.length ?? getRowModel().rows.length;
39
+ const realRows = rows ?? getRowModel().rows;
40
+ /**
41
+ * when filtering, should find the correct index in filtered rows
42
+ */
43
+ const draggingRowIndex = useMemo(
44
+ () =>
45
+ draggingRow?.id
46
+ ? realRows.findIndex((r) => r.id === draggingRow?.id)
47
+ : undefined,
48
+ [realRows, draggingRow?.id],
49
+ );
50
+
51
+ const rowCount = realRows.length;
40
52
 
41
53
  const normalRowHeight =
42
54
  density === 'compact' ? 37 : density === 'comfortable' ? 58 : 73;
@@ -58,9 +70,9 @@ export const useMRT_RowVirtualizer = <
58
70
  overscan: 4,
59
71
  rangeExtractor: useCallback(
60
72
  (range: Range) => {
61
- return extraIndexRangeExtractor(range, draggingRow?.index ?? 0);
73
+ return extraIndexRangeExtractor(range, draggingRowIndex);
62
74
  },
63
- [draggingRow],
75
+ [draggingRowIndex],
64
76
  ),
65
77
  ...rowVirtualizerProps,
66
78
  }) as unknown as MRT_RowVirtualizer<TScrollElement, TItemElement>;
package/src/locales/ar.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_AR: MRT_Localization = {
4
+ language: 'ar',
4
5
  actions: 'إجراءات',
5
6
  and: 'و',
6
7
  cancel: 'إلغاء',
package/src/locales/az.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_AZ: MRT_Localization = {
4
+ language: 'az',
4
5
  actions: 'Əməliyyatlar',
5
6
  and: 'və',
6
7
  cancel: 'Ləğv Et',
package/src/locales/bg.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_BG: MRT_Localization = {
4
+ language: 'bg',
4
5
  actions: 'Действия',
5
6
  and: 'и',
6
7
  cancel: 'Отказ',
package/src/locales/cs.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_CS: MRT_Localization = {
4
+ language: 'cs',
4
5
  actions: 'Akce',
5
6
  and: 'a',
6
7
  cancel: 'Zrušit',
package/src/locales/da.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_DA: MRT_Localization = {
4
+ language: 'da',
4
5
  actions: 'Handlinger',
5
6
  and: 'og',
6
7
  cancel: 'Annuller',
package/src/locales/de.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_DE: MRT_Localization = {
4
+ language: 'de',
4
5
  actions: 'Aktionen',
5
6
  and: 'und',
6
7
  cancel: 'Abbrechen',
package/src/locales/el.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_EL: MRT_Localization = {
4
+ language: 'el',
4
5
  actions: 'Ενέργειες',
5
6
  and: 'και',
6
7
  cancel: 'Ακύρωση',
package/src/locales/en.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_EN: MRT_Localization = {
4
+ language: 'en',
4
5
  actions: 'Actions',
5
6
  and: 'and',
6
7
  cancel: 'Cancel',
package/src/locales/es.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_ES: MRT_Localization = {
4
+ language: 'es',
4
5
  actions: 'Acciones',
5
6
  and: 'y',
6
7
  cancel: 'Cancelar',
package/src/locales/et.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_ET: MRT_Localization = {
4
+ language: 'et',
4
5
  actions: 'Toimingud',
5
6
  and: 'ja',
6
7
  cancel: 'Tühista',
package/src/locales/fa.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_FA: MRT_Localization = {
4
+ language: 'fa',
4
5
  actions: 'عملیات',
5
6
  and: 'و',
6
7
  cancel: 'انصراف',
package/src/locales/fi.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_FI: MRT_Localization = {
4
+ language: 'fi',
4
5
  actions: 'Toiminnot',
5
6
  and: 'ja',
6
7
  cancel: 'Peruuta',
package/src/locales/fr.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_FR: MRT_Localization = {
4
+ language: 'fr',
4
5
  actions: 'Actions',
5
6
  and: 'et',
6
7
  cancel: 'Annuler',
package/src/locales/he.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_HE: MRT_Localization = {
4
+ language: 'he',
4
5
  actions: 'פעולות',
5
6
  and: 'ו',
6
7
  cancel: 'ביטול',
package/src/locales/hr.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_HR: MRT_Localization = {
4
+ language: 'hr',
4
5
  actions: 'Radnje',
5
6
  and: 'i',
6
7
  cancel: 'Odustani',
package/src/locales/hu.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_HU: MRT_Localization = {
4
+ language: 'hu',
4
5
  actions: 'Műveletek',
5
6
  and: 'és',
6
7
  cancel: 'Mégse',
package/src/locales/hy.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_HY: MRT_Localization = {
4
+ language: 'hy',
4
5
  actions: 'Գործողություններ',
5
6
  and: 'և',
6
7
  cancel: 'Չեղարկել',
package/src/locales/id.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_ID: MRT_Localization = {
4
+ language: 'id',
4
5
  actions: 'Aksi',
5
6
  and: 'dan',
6
7
  cancel: 'Batal',
package/src/locales/it.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_IT: MRT_Localization = {
4
+ language: 'it',
4
5
  actions: 'Azioni',
5
6
  and: 'e',
6
7
  cancel: 'Cancella',
package/src/locales/ja.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_JA: MRT_Localization = {
4
+ language: 'ja',
4
5
  actions: '操作',
5
6
  and: 'と',
6
7
  cancel: 'キャンセル',
package/src/locales/ko.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_KO: MRT_Localization = {
4
+ language: 'ko',
4
5
  actions: '동작',
5
6
  and: '~',
6
7
  cancel: '취소',
package/src/locales/nl.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_NL: MRT_Localization = {
4
+ language: 'nl',
4
5
  actions: 'Acties',
5
6
  and: 'en',
6
7
  cancel: 'Annuleren',
package/src/locales/no.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_NO: MRT_Localization = {
4
+ language: 'no',
4
5
  cancel: 'Avbryt',
5
6
  actions: 'Handlinger',
6
7
  and: 'og',
package/src/locales/np.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_NP: MRT_Localization = {
4
+ language: 'np',
4
5
  actions: 'कार्यहरू',
5
6
  and: 'तथा',
6
7
  cancel: 'रद्द गर्नुहोस्',
package/src/locales/pl.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_PL: MRT_Localization = {
4
+ language: 'pl',
4
5
  actions: 'Akcje',
5
6
  and: 'i',
6
7
  cancel: 'Anuluj',
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_PT_BR: MRT_Localization = {
4
+ language: 'pt-BR',
4
5
  actions: 'Ações',
5
6
  and: 'e',
6
7
  cancel: 'Cancelar',
package/src/locales/pt.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_PT: MRT_Localization = {
4
+ language: 'pt',
4
5
  actions: 'Ações',
5
6
  and: 'e',
6
7
  cancel: 'Cancelar',
package/src/locales/ro.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_RO: MRT_Localization = {
4
+ language: 'ro',
4
5
  actions: 'Acțiuni',
5
6
  and: 'și',
6
7
  cancel: 'Anulează',
package/src/locales/ru.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_RU: MRT_Localization = {
4
+ language: 'ru',
4
5
  actions: 'Действия',
5
6
  and: 'и',
6
7
  cancel: 'Отменить',
package/src/locales/sk.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_SK: MRT_Localization = {
4
+ language: 'sk',
4
5
  actions: 'Akcie',
5
6
  and: 'a',
6
7
  cancel: 'Zrušiť',
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_SR_CYRL_RS: MRT_Localization = {
4
+ language: 'sr-Cyrl-RS',
4
5
  actions: 'Акције',
5
6
  and: 'и',
6
7
  cancel: 'Откажи',
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_SR_LATN_RS: MRT_Localization = {
4
+ language: 'sr-Latn-RS',
4
5
  actions: 'Akcije',
5
6
  and: 'i',
6
7
  cancel: 'Otkaži',
package/src/locales/sv.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_SV: MRT_Localization = {
4
+ language: 'sv',
4
5
  actions: 'Åtgärder',
5
6
  and: 'och',
6
7
  cancel: 'Avbryt',
package/src/locales/tr.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_TR: MRT_Localization = {
4
+ language: 'tr',
4
5
  actions: 'İşlemler',
5
6
  and: 've',
6
7
  cancel: 'İptal',
package/src/locales/uk.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_UK: MRT_Localization = {
4
+ language: 'uk',
4
5
  actions: 'Дії',
5
6
  and: 'і',
6
7
  cancel: 'Скасувати',
package/src/locales/vi.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_VI: MRT_Localization = {
4
+ language: 'vi',
4
5
  actions: 'Thao tác',
5
6
  and: 'và',
6
7
  cancel: 'Huỷ bỏ',
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_ZH_HANS: MRT_Localization = {
4
+ language: 'zh-Hans',
4
5
  actions: '操作',
5
6
  and: '与',
6
7
  cancel: '取消',
@@ -1,6 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_ZH_HANT: MRT_Localization = {
4
+ language: 'zh-Hant',
4
5
  actions: '動作',
5
6
  and: '與',
6
7
  cancel: '取消',
package/src/types.ts CHANGED
@@ -150,6 +150,8 @@ export type MRT_ColumnHelper<TData extends MRT_RowData> = {
150
150
  };
151
151
 
152
152
  export interface MRT_Localization {
153
+ // language of the localization as BCP 47 language tag for number formatting
154
+ language: string;
153
155
  actions: string;
154
156
  and: string;
155
157
  cancel: string;
@@ -1,5 +1,10 @@
1
1
  import { type Range, defaultRangeExtractor } from '@tanstack/react-virtual';
2
2
 
3
+ /**
4
+ * When scroll, the `draggingRow` or `draggingColumn` can be removed from document because of virtualization,
5
+ * then, the `dragEnd` event on `MRT_TableBodyRowGrabHandle` or `MRT_TableHeadCellGrabHandle` will not fire.
6
+ * We should keep the `draggingRow` or `draggingColumn` in `getVirtualItems()` to avoid this thing.
7
+ */
3
8
  export const extraIndexRangeExtractor = (
4
9
  range: Range,
5
10
  draggingIndex?: number,