@novastera-oss/material-react-table 4.0.0-beta.11
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/LICENSE +21 -0
- package/README.md +203 -0
- package/dist/index.cjs +5207 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +1871 -0
- package/dist/index.js +5101 -0
- package/dist/index.js.map +1 -0
- package/locales/ar/index.d.ts +3 -0
- package/locales/ar/index.esm.d.ts +3 -0
- package/locales/ar/index.esm.js +96 -0
- package/locales/ar/index.js +98 -0
- package/locales/ar/package.json +6 -0
- package/locales/az/index.d.ts +3 -0
- package/locales/az/index.esm.d.ts +3 -0
- package/locales/az/index.esm.js +96 -0
- package/locales/az/index.js +98 -0
- package/locales/az/package.json +6 -0
- package/locales/bg/index.d.ts +3 -0
- package/locales/bg/index.esm.d.ts +3 -0
- package/locales/bg/index.esm.js +96 -0
- package/locales/bg/index.js +98 -0
- package/locales/bg/package.json +6 -0
- package/locales/cs/index.d.ts +3 -0
- package/locales/cs/index.esm.d.ts +3 -0
- package/locales/cs/index.esm.js +96 -0
- package/locales/cs/index.js +98 -0
- package/locales/cs/package.json +6 -0
- package/locales/da/index.d.ts +3 -0
- package/locales/da/index.esm.d.ts +3 -0
- package/locales/da/index.esm.js +96 -0
- package/locales/da/index.js +98 -0
- package/locales/da/package.json +6 -0
- package/locales/de/index.d.ts +3 -0
- package/locales/de/index.esm.d.ts +3 -0
- package/locales/de/index.esm.js +96 -0
- package/locales/de/index.js +98 -0
- package/locales/de/package.json +6 -0
- package/locales/el/index.d.ts +3 -0
- package/locales/el/index.esm.d.ts +3 -0
- package/locales/el/index.esm.js +96 -0
- package/locales/el/index.js +98 -0
- package/locales/el/package.json +6 -0
- package/locales/en/index.d.ts +3 -0
- package/locales/en/index.esm.d.ts +3 -0
- package/locales/en/index.esm.js +96 -0
- package/locales/en/index.js +98 -0
- package/locales/en/package.json +6 -0
- package/locales/es/index.d.ts +3 -0
- package/locales/es/index.esm.d.ts +3 -0
- package/locales/es/index.esm.js +96 -0
- package/locales/es/index.js +98 -0
- package/locales/es/package.json +6 -0
- package/locales/et/index.d.ts +3 -0
- package/locales/et/index.esm.d.ts +3 -0
- package/locales/et/index.esm.js +96 -0
- package/locales/et/index.js +98 -0
- package/locales/et/package.json +6 -0
- package/locales/fa/index.d.ts +3 -0
- package/locales/fa/index.esm.d.ts +3 -0
- package/locales/fa/index.esm.js +96 -0
- package/locales/fa/index.js +98 -0
- package/locales/fa/package.json +6 -0
- package/locales/fi/index.d.ts +3 -0
- package/locales/fi/index.esm.d.ts +3 -0
- package/locales/fi/index.esm.js +96 -0
- package/locales/fi/index.js +98 -0
- package/locales/fi/package.json +6 -0
- package/locales/fr/index.d.ts +3 -0
- package/locales/fr/index.esm.d.ts +3 -0
- package/locales/fr/index.esm.js +96 -0
- package/locales/fr/index.js +98 -0
- package/locales/fr/package.json +6 -0
- package/locales/he/index.d.ts +3 -0
- package/locales/he/index.esm.d.ts +3 -0
- package/locales/he/index.esm.js +96 -0
- package/locales/he/index.js +98 -0
- package/locales/he/package.json +6 -0
- package/locales/hr/index.d.ts +3 -0
- package/locales/hr/index.esm.d.ts +3 -0
- package/locales/hr/index.esm.js +96 -0
- package/locales/hr/index.js +98 -0
- package/locales/hr/package.json +6 -0
- package/locales/hu/index.d.ts +3 -0
- package/locales/hu/index.esm.d.ts +3 -0
- package/locales/hu/index.esm.js +96 -0
- package/locales/hu/index.js +98 -0
- package/locales/hu/package.json +6 -0
- package/locales/hy/index.d.ts +3 -0
- package/locales/hy/index.esm.d.ts +3 -0
- package/locales/hy/index.esm.js +96 -0
- package/locales/hy/index.js +98 -0
- package/locales/hy/package.json +6 -0
- package/locales/id/index.d.ts +3 -0
- package/locales/id/index.esm.d.ts +3 -0
- package/locales/id/index.esm.js +96 -0
- package/locales/id/index.js +98 -0
- package/locales/id/package.json +6 -0
- package/locales/it/index.d.ts +3 -0
- package/locales/it/index.esm.d.ts +3 -0
- package/locales/it/index.esm.js +96 -0
- package/locales/it/index.js +98 -0
- package/locales/it/package.json +6 -0
- package/locales/ja/index.d.ts +3 -0
- package/locales/ja/index.esm.d.ts +3 -0
- package/locales/ja/index.esm.js +96 -0
- package/locales/ja/index.js +98 -0
- package/locales/ja/package.json +6 -0
- package/locales/ko/index.d.ts +3 -0
- package/locales/ko/index.esm.d.ts +3 -0
- package/locales/ko/index.esm.js +96 -0
- package/locales/ko/index.js +98 -0
- package/locales/ko/package.json +6 -0
- package/locales/nl/index.d.ts +3 -0
- package/locales/nl/index.esm.d.ts +3 -0
- package/locales/nl/index.esm.js +96 -0
- package/locales/nl/index.js +98 -0
- package/locales/nl/package.json +6 -0
- package/locales/no/index.d.ts +3 -0
- package/locales/no/index.esm.d.ts +3 -0
- package/locales/no/index.esm.js +96 -0
- package/locales/no/index.js +98 -0
- package/locales/no/package.json +6 -0
- package/locales/np/index.d.ts +3 -0
- package/locales/np/index.esm.d.ts +3 -0
- package/locales/np/index.esm.js +96 -0
- package/locales/np/index.js +98 -0
- package/locales/np/package.json +6 -0
- package/locales/pl/index.d.ts +3 -0
- package/locales/pl/index.esm.d.ts +3 -0
- package/locales/pl/index.esm.js +96 -0
- package/locales/pl/index.js +98 -0
- package/locales/pl/package.json +6 -0
- package/locales/pt/index.d.ts +3 -0
- package/locales/pt/index.esm.d.ts +3 -0
- package/locales/pt/index.esm.js +96 -0
- package/locales/pt/index.js +98 -0
- package/locales/pt/package.json +6 -0
- package/locales/pt-BR/index.d.ts +3 -0
- package/locales/pt-BR/index.esm.d.ts +3 -0
- package/locales/pt-BR/index.esm.js +96 -0
- package/locales/pt-BR/index.js +98 -0
- package/locales/pt-BR/package.json +6 -0
- package/locales/ro/index.d.ts +3 -0
- package/locales/ro/index.esm.d.ts +3 -0
- package/locales/ro/index.esm.js +96 -0
- package/locales/ro/index.js +98 -0
- package/locales/ro/package.json +6 -0
- package/locales/ru/index.d.ts +3 -0
- package/locales/ru/index.esm.d.ts +3 -0
- package/locales/ru/index.esm.js +96 -0
- package/locales/ru/index.js +98 -0
- package/locales/ru/package.json +6 -0
- package/locales/sk/index.d.ts +3 -0
- package/locales/sk/index.esm.d.ts +3 -0
- package/locales/sk/index.esm.js +96 -0
- package/locales/sk/index.js +98 -0
- package/locales/sk/package.json +6 -0
- package/locales/sr-Cyrl-RS/index.d.ts +3 -0
- package/locales/sr-Cyrl-RS/index.esm.d.ts +3 -0
- package/locales/sr-Cyrl-RS/index.esm.js +96 -0
- package/locales/sr-Cyrl-RS/index.js +98 -0
- package/locales/sr-Cyrl-RS/package.json +6 -0
- package/locales/sr-Latn-RS/index.d.ts +3 -0
- package/locales/sr-Latn-RS/index.esm.d.ts +3 -0
- package/locales/sr-Latn-RS/index.esm.js +96 -0
- package/locales/sr-Latn-RS/index.js +98 -0
- package/locales/sr-Latn-RS/package.json +6 -0
- package/locales/sv/index.d.ts +3 -0
- package/locales/sv/index.esm.d.ts +3 -0
- package/locales/sv/index.esm.js +96 -0
- package/locales/sv/index.js +98 -0
- package/locales/sv/package.json +6 -0
- package/locales/tr/index.d.ts +3 -0
- package/locales/tr/index.esm.d.ts +3 -0
- package/locales/tr/index.esm.js +96 -0
- package/locales/tr/index.js +98 -0
- package/locales/tr/package.json +6 -0
- package/locales/uk/index.d.ts +3 -0
- package/locales/uk/index.esm.d.ts +3 -0
- package/locales/uk/index.esm.js +96 -0
- package/locales/uk/index.js +98 -0
- package/locales/uk/package.json +6 -0
- package/locales/vi/index.d.ts +3 -0
- package/locales/vi/index.esm.d.ts +3 -0
- package/locales/vi/index.esm.js +96 -0
- package/locales/vi/index.js +98 -0
- package/locales/vi/package.json +6 -0
- package/locales/zh-Hans/index.d.ts +3 -0
- package/locales/zh-Hans/index.esm.d.ts +3 -0
- package/locales/zh-Hans/index.esm.js +96 -0
- package/locales/zh-Hans/index.js +98 -0
- package/locales/zh-Hans/package.json +6 -0
- package/locales/zh-Hant/index.d.ts +3 -0
- package/locales/zh-Hant/index.esm.d.ts +3 -0
- package/locales/zh-Hant/index.esm.js +96 -0
- package/locales/zh-Hant/index.js +98 -0
- package/locales/zh-Hant/package.json +6 -0
- package/package.json +103 -0
- package/src/components/MaterialReactTable.tsx +36 -0
- package/src/components/body/MRT_TableBody.tsx +233 -0
- package/src/components/body/MRT_TableBodyCell.tsx +356 -0
- package/src/components/body/MRT_TableBodyCellValue.tsx +130 -0
- package/src/components/body/MRT_TableBodyRow.tsx +306 -0
- package/src/components/body/MRT_TableBodyRowGrabHandle.tsx +61 -0
- package/src/components/body/MRT_TableBodyRowPinButton.tsx +58 -0
- package/src/components/body/MRT_TableDetailPanel.tsx +118 -0
- package/src/components/buttons/MRT_ColumnPinningButtons.tsx +73 -0
- package/src/components/buttons/MRT_CopyButton.tsx +91 -0
- package/src/components/buttons/MRT_EditActionButtons.tsx +135 -0
- package/src/components/buttons/MRT_ExpandAllButton.tsx +82 -0
- package/src/components/buttons/MRT_ExpandButton.tsx +106 -0
- package/src/components/buttons/MRT_GrabHandleButton.tsx +66 -0
- package/src/components/buttons/MRT_RowPinButton.tsx +84 -0
- package/src/components/buttons/MRT_ShowHideColumnsButton.tsx +50 -0
- package/src/components/buttons/MRT_ToggleDensePaddingButton.tsx +52 -0
- package/src/components/buttons/MRT_ToggleFiltersButton.tsx +40 -0
- package/src/components/buttons/MRT_ToggleFullScreenButton.tsx +51 -0
- package/src/components/buttons/MRT_ToggleGlobalFilterButton.tsx +46 -0
- package/src/components/buttons/MRT_ToggleRowActionMenuButton.tsx +126 -0
- package/src/components/footer/MRT_TableFooter.tsx +92 -0
- package/src/components/footer/MRT_TableFooterCell.tsx +111 -0
- package/src/components/footer/MRT_TableFooterRow.tsx +99 -0
- package/src/components/head/MRT_TableHead.tsx +95 -0
- package/src/components/head/MRT_TableHeadCell.tsx +357 -0
- package/src/components/head/MRT_TableHeadCellColumnActionsButton.tsx +100 -0
- package/src/components/head/MRT_TableHeadCellFilterContainer.tsx +52 -0
- package/src/components/head/MRT_TableHeadCellFilterLabel.tsx +180 -0
- package/src/components/head/MRT_TableHeadCellGrabHandle.tsx +91 -0
- package/src/components/head/MRT_TableHeadCellResizeHandle.tsx +96 -0
- package/src/components/head/MRT_TableHeadCellSortLabel.tsx +102 -0
- package/src/components/head/MRT_TableHeadRow.tsx +94 -0
- package/src/components/inputs/MRT_EditCellTextField.tsx +195 -0
- package/src/components/inputs/MRT_FilterCheckbox.tsx +107 -0
- package/src/components/inputs/MRT_FilterRangeFields.tsx +42 -0
- package/src/components/inputs/MRT_FilterRangeSlider.tsx +145 -0
- package/src/components/inputs/MRT_FilterTextField.tsx +629 -0
- package/src/components/inputs/MRT_GlobalFilterTextField.tsx +165 -0
- package/src/components/inputs/MRT_SelectCheckbox.tsx +142 -0
- package/src/components/menus/MRT_ActionMenuItem.tsx +62 -0
- package/src/components/menus/MRT_CellActionMenu.tsx +109 -0
- package/src/components/menus/MRT_ColumnActionMenu.tsx +354 -0
- package/src/components/menus/MRT_FilterOptionMenu.tsx +294 -0
- package/src/components/menus/MRT_RowActionMenu.tsx +90 -0
- package/src/components/menus/MRT_ShowHideColumnsMenu.tsx +181 -0
- package/src/components/menus/MRT_ShowHideColumnsMenuItems.tsx +204 -0
- package/src/components/modals/MRT_EditRowModal.tsx +114 -0
- package/src/components/table/MRT_Table.tsx +86 -0
- package/src/components/table/MRT_TableContainer.tsx +115 -0
- package/src/components/table/MRT_TableLoadingOverlay.tsx +58 -0
- package/src/components/table/MRT_TablePaper.tsx +91 -0
- package/src/components/toolbar/MRT_BottomToolbar.tsx +112 -0
- package/src/components/toolbar/MRT_LinearProgressBar.tsx +53 -0
- package/src/components/toolbar/MRT_TablePagination.tsx +250 -0
- package/src/components/toolbar/MRT_ToolbarAlertBanner.tsx +182 -0
- package/src/components/toolbar/MRT_ToolbarDropZone.tsx +82 -0
- package/src/components/toolbar/MRT_ToolbarInternalButtons.tsx +73 -0
- package/src/components/toolbar/MRT_TopToolbar.tsx +134 -0
- package/src/fns/aggregationFns.ts +3 -0
- package/src/fns/filterFns.ts +196 -0
- package/src/fns/sortingFns.ts +33 -0
- package/src/hooks/display-columns/getMRT_RowActionsColumnDef.tsx +28 -0
- package/src/hooks/display-columns/getMRT_RowDragColumnDef.tsx +29 -0
- package/src/hooks/display-columns/getMRT_RowExpandColumnDef.tsx +91 -0
- package/src/hooks/display-columns/getMRT_RowNumbersColumnDef.tsx +30 -0
- package/src/hooks/display-columns/getMRT_RowPinningColumnDef.tsx +24 -0
- package/src/hooks/display-columns/getMRT_RowSelectColumnDef.tsx +34 -0
- package/src/hooks/display-columns/getMRT_RowSpacerColumnDef.tsx +33 -0
- package/src/hooks/useMRT_ColumnVirtualizer.ts +124 -0
- package/src/hooks/useMRT_Effects.ts +106 -0
- package/src/hooks/useMRT_RowVirtualizer.ts +88 -0
- package/src/hooks/useMRT_Rows.ts +44 -0
- package/src/hooks/useMRT_TableInstance.ts +317 -0
- package/src/hooks/useMRT_TableOptions.ts +270 -0
- package/src/hooks/useMaterialReactTable.ts +12 -0
- package/src/icons.ts +73 -0
- package/src/index.ts +91 -0
- package/src/locales/ar.ts +97 -0
- package/src/locales/az.ts +97 -0
- package/src/locales/bg.ts +97 -0
- package/src/locales/cs.ts +98 -0
- package/src/locales/da.ts +97 -0
- package/src/locales/de.ts +97 -0
- package/src/locales/el.ts +97 -0
- package/src/locales/en.ts +97 -0
- package/src/locales/es.ts +97 -0
- package/src/locales/et.ts +98 -0
- package/src/locales/fa.ts +97 -0
- package/src/locales/fi.ts +98 -0
- package/src/locales/fr.ts +97 -0
- package/src/locales/he.ts +97 -0
- package/src/locales/hr.ts +97 -0
- package/src/locales/hu.ts +97 -0
- package/src/locales/hy.ts +97 -0
- package/src/locales/id.ts +98 -0
- package/src/locales/it.ts +97 -0
- package/src/locales/ja.ts +97 -0
- package/src/locales/ko.ts +97 -0
- package/src/locales/mk.ts +96 -0
- package/src/locales/nl.ts +97 -0
- package/src/locales/no.ts +99 -0
- package/src/locales/np.ts +98 -0
- package/src/locales/pl.ts +97 -0
- package/src/locales/pt-BR.ts +97 -0
- package/src/locales/pt.ts +97 -0
- package/src/locales/ro.ts +97 -0
- package/src/locales/ru.ts +97 -0
- package/src/locales/sk.ts +98 -0
- package/src/locales/sr-Cyrl-RS.ts +97 -0
- package/src/locales/sr-Latn-RS.ts +97 -0
- package/src/locales/sv.ts +97 -0
- package/src/locales/tr.ts +97 -0
- package/src/locales/uk.ts +97 -0
- package/src/locales/vi.ts +97 -0
- package/src/locales/zh-Hans.ts +96 -0
- package/src/locales/zh-Hant.ts +96 -0
- package/src/types.ts +1295 -0
- package/src/utils/cell.utils.ts +234 -0
- package/src/utils/column.utils.ts +209 -0
- package/src/utils/displayColumn.utils.ts +152 -0
- package/src/utils/row.utils.ts +260 -0
- package/src/utils/style.utils.ts +221 -0
- package/src/utils/tanstack.helpers.ts +64 -0
- package/src/utils/utils.ts +56 -0
- package/src/utils/virtualization.utils.ts +24 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const MRT_Localization_ZH_HANS = {
|
|
4
|
+
language: 'zh-Hans',
|
|
5
|
+
actions: '操作',
|
|
6
|
+
and: '与',
|
|
7
|
+
cancel: '取消',
|
|
8
|
+
changeFilterMode: '更改过滤模式',
|
|
9
|
+
changeSearchMode: '更改搜索模式',
|
|
10
|
+
clearFilter: '清除过滤',
|
|
11
|
+
clearSearch: '清除搜索',
|
|
12
|
+
clearSelection: '清除选择',
|
|
13
|
+
clearSort: '清除排序',
|
|
14
|
+
clickToCopy: '点击以复制',
|
|
15
|
+
copy: '复制',
|
|
16
|
+
collapse: '折叠',
|
|
17
|
+
collapseAll: '全部折叠',
|
|
18
|
+
columnActions: '列操作',
|
|
19
|
+
copiedToClipboard: '已复制至剪贴板',
|
|
20
|
+
dropToGroupBy: '拖放以按 {column} 分组',
|
|
21
|
+
edit: '编辑',
|
|
22
|
+
expand: '展开',
|
|
23
|
+
expandAll: '全部展开',
|
|
24
|
+
filterArrIncludes: '包括',
|
|
25
|
+
filterArrIncludesAll: '包括所有',
|
|
26
|
+
filterArrIncludesSome: '包括',
|
|
27
|
+
filterBetween: '介于首尾',
|
|
28
|
+
filterBetweenInclusive: '介于首尾之间',
|
|
29
|
+
filterByColumn: '以 {column} 过滤',
|
|
30
|
+
filterContains: '包含',
|
|
31
|
+
filterEmpty: '是空字串',
|
|
32
|
+
filterEndsWith: '结尾为',
|
|
33
|
+
filterEquals: '等于',
|
|
34
|
+
filterEqualsString: '等于',
|
|
35
|
+
filterFuzzy: '模糊搜索',
|
|
36
|
+
filterGreaterThan: '大于',
|
|
37
|
+
filterGreaterThanOrEqualTo: '大于等于',
|
|
38
|
+
filterInNumberRange: '介于',
|
|
39
|
+
filterIncludesString: '包含',
|
|
40
|
+
filterIncludesStringSensitive: '包含',
|
|
41
|
+
filterLessThan: '小于',
|
|
42
|
+
filterLessThanOrEqualTo: '小于等于',
|
|
43
|
+
filterMode: '过滤模式:{filterType}',
|
|
44
|
+
filterNotEmpty: '非空字串',
|
|
45
|
+
filterNotEquals: '不等于',
|
|
46
|
+
filterStartsWith: '开首为',
|
|
47
|
+
filterWeakEquals: '等于',
|
|
48
|
+
filteringByColumn: '以 {column} 过滤:{filterType} {filterValue}',
|
|
49
|
+
goToFirstPage: '到第一页',
|
|
50
|
+
goToLastPage: '到最后一页',
|
|
51
|
+
goToNextPage: '下一页',
|
|
52
|
+
goToPreviousPage: '上一页',
|
|
53
|
+
grab: '拖曳',
|
|
54
|
+
groupByColumn: '按 {column} 分组',
|
|
55
|
+
groupedBy: '分组依据 ',
|
|
56
|
+
hideAll: '隐藏全部',
|
|
57
|
+
hideColumn: '隐藏 {column} 列',
|
|
58
|
+
max: '最大',
|
|
59
|
+
min: '最小',
|
|
60
|
+
move: '移动',
|
|
61
|
+
noRecordsToDisplay: '无记录可显示',
|
|
62
|
+
noResultsFound: '未找到结果',
|
|
63
|
+
of: '/',
|
|
64
|
+
or: '或',
|
|
65
|
+
pin: '固定',
|
|
66
|
+
pinToLeft: '固定至左边',
|
|
67
|
+
pinToRight: '固定至右边',
|
|
68
|
+
resetColumnSize: '重置列大小',
|
|
69
|
+
resetOrder: '重置排序',
|
|
70
|
+
rowActions: '行操作',
|
|
71
|
+
rowNumber: '#',
|
|
72
|
+
rowNumbers: '行号码',
|
|
73
|
+
rowsPerPage: '每页行数',
|
|
74
|
+
save: '保存',
|
|
75
|
+
search: '搜索',
|
|
76
|
+
selectedCountOfRowCountRowsSelected: '已选择行:{selectedCount}/{rowCount}',
|
|
77
|
+
select: '选择',
|
|
78
|
+
showAll: '显示全部',
|
|
79
|
+
showAllColumns: '显示全部列',
|
|
80
|
+
showHideColumns: '显示/隐藏 列',
|
|
81
|
+
showHideFilters: '显示/隐藏 过滤条件',
|
|
82
|
+
showHideSearch: '显示/隐藏 搜索条件',
|
|
83
|
+
sortByColumnAsc: '按 {column} 升序排序',
|
|
84
|
+
sortByColumnDesc: '按 {column} 倒序排序',
|
|
85
|
+
sortedByColumnAsc: '已按 {column} 升序排序',
|
|
86
|
+
sortedByColumnDesc: '已按 {column} 倒序排序',
|
|
87
|
+
thenBy: ',然后以',
|
|
88
|
+
toggleDensity: '切换间距',
|
|
89
|
+
toggleFullScreen: '切换全屏',
|
|
90
|
+
toggleSelectAll: '切换选择全部',
|
|
91
|
+
toggleSelectRow: '切换选择行',
|
|
92
|
+
toggleVisibility: '切换可见度',
|
|
93
|
+
ungroupByColumn: '取消按 {column} 分组',
|
|
94
|
+
unpin: '取消固定',
|
|
95
|
+
unpinAll: '全部取消固定',
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
exports.MRT_Localization_ZH_HANS = MRT_Localization_ZH_HANS;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
const MRT_Localization_ZH_HANT = {
|
|
2
|
+
language: 'zh-Hant',
|
|
3
|
+
actions: '動作',
|
|
4
|
+
and: '與',
|
|
5
|
+
cancel: '取消',
|
|
6
|
+
changeFilterMode: '更改過濾模式',
|
|
7
|
+
changeSearchMode: '更改搜尋模式',
|
|
8
|
+
clearFilter: '清除過濾',
|
|
9
|
+
clearSearch: '清除搜尋',
|
|
10
|
+
clearSelection: '清除選擇',
|
|
11
|
+
clearSort: '清除排序',
|
|
12
|
+
clickToCopy: '點擊以複製',
|
|
13
|
+
copy: '複製',
|
|
14
|
+
collapse: '折疊',
|
|
15
|
+
collapseAll: '全部折疊',
|
|
16
|
+
columnActions: '欄位動作',
|
|
17
|
+
copiedToClipboard: '已複製至剪貼簿',
|
|
18
|
+
dropToGroupBy: '拖放以按 {column} 分組',
|
|
19
|
+
edit: '編輯',
|
|
20
|
+
expand: '展開',
|
|
21
|
+
expandAll: '全部展開',
|
|
22
|
+
filterArrIncludes: '包括',
|
|
23
|
+
filterArrIncludesAll: '包括所有',
|
|
24
|
+
filterArrIncludesSome: '包括',
|
|
25
|
+
filterBetween: '介於首尾',
|
|
26
|
+
filterBetweenInclusive: '介於首尾之間',
|
|
27
|
+
filterByColumn: '以 {column} 過濾',
|
|
28
|
+
filterContains: '包含',
|
|
29
|
+
filterEmpty: '是空字串',
|
|
30
|
+
filterEndsWith: '結尾為',
|
|
31
|
+
filterEquals: '等於',
|
|
32
|
+
filterEqualsString: '等於',
|
|
33
|
+
filterFuzzy: '模糊搜索',
|
|
34
|
+
filterGreaterThan: '大於',
|
|
35
|
+
filterGreaterThanOrEqualTo: '大於等於',
|
|
36
|
+
filterInNumberRange: '介於',
|
|
37
|
+
filterIncludesString: '包含',
|
|
38
|
+
filterIncludesStringSensitive: '包含',
|
|
39
|
+
filterLessThan: '小於',
|
|
40
|
+
filterLessThanOrEqualTo: '小於等於',
|
|
41
|
+
filterMode: '過濾模式:{filterType}',
|
|
42
|
+
filterNotEmpty: '非空字串',
|
|
43
|
+
filterNotEquals: '不等於',
|
|
44
|
+
filterStartsWith: '開首為',
|
|
45
|
+
filterWeakEquals: '等於',
|
|
46
|
+
filteringByColumn: '正以 {column} 過濾:{filterType} {filterValue}',
|
|
47
|
+
goToFirstPage: '到第一頁',
|
|
48
|
+
goToLastPage: '到最後一頁',
|
|
49
|
+
goToNextPage: '下一頁',
|
|
50
|
+
goToPreviousPage: '上一頁',
|
|
51
|
+
grab: '拖曳',
|
|
52
|
+
groupByColumn: '按 {column} 分組',
|
|
53
|
+
groupedBy: '分組依據 ',
|
|
54
|
+
hideAll: '隱藏全部',
|
|
55
|
+
hideColumn: '隱藏 {column} 欄位',
|
|
56
|
+
max: '最大',
|
|
57
|
+
min: '最小',
|
|
58
|
+
move: '移動',
|
|
59
|
+
noRecordsToDisplay: '無紀錄可顯示',
|
|
60
|
+
noResultsFound: '未找到結果',
|
|
61
|
+
of: '/',
|
|
62
|
+
or: '或',
|
|
63
|
+
pin: '固定',
|
|
64
|
+
pinToLeft: '固定至左邊',
|
|
65
|
+
pinToRight: '固定至右邊',
|
|
66
|
+
resetColumnSize: '重置欄位大小',
|
|
67
|
+
resetOrder: '重置排序',
|
|
68
|
+
rowActions: '橫列動作',
|
|
69
|
+
rowNumber: '#',
|
|
70
|
+
rowNumbers: '橫列編號',
|
|
71
|
+
rowsPerPage: '每頁數量',
|
|
72
|
+
save: '儲存',
|
|
73
|
+
search: '搜尋',
|
|
74
|
+
selectedCountOfRowCountRowsSelected: '已選擇橫列:{selectedCount}/{rowCount}',
|
|
75
|
+
select: '選擇',
|
|
76
|
+
showAll: '顯示全部',
|
|
77
|
+
showAllColumns: '顯示全部欄位',
|
|
78
|
+
showHideColumns: '顯示/隱藏 欄位',
|
|
79
|
+
showHideFilters: '顯示/隱藏 過濾條件',
|
|
80
|
+
showHideSearch: '顯示/隱藏 搜尋條件',
|
|
81
|
+
sortByColumnAsc: '按 {column} 順序排序',
|
|
82
|
+
sortByColumnDesc: '按 {column} 倒序排序',
|
|
83
|
+
sortedByColumnAsc: '已按 {column} 順序排序',
|
|
84
|
+
sortedByColumnDesc: '已按 {column} 倒序排序',
|
|
85
|
+
thenBy: ',然後以',
|
|
86
|
+
toggleDensity: '切換密度',
|
|
87
|
+
toggleFullScreen: '切換全螢幕',
|
|
88
|
+
toggleSelectAll: '切換選擇全部',
|
|
89
|
+
toggleSelectRow: '切換選擇橫列',
|
|
90
|
+
toggleVisibility: '切換可見度',
|
|
91
|
+
ungroupByColumn: '取消按 {column} 分組',
|
|
92
|
+
unpin: '取消固定',
|
|
93
|
+
unpinAll: '全部取消固定',
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export { MRT_Localization_ZH_HANT };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const MRT_Localization_ZH_HANT = {
|
|
4
|
+
language: 'zh-Hant',
|
|
5
|
+
actions: '動作',
|
|
6
|
+
and: '與',
|
|
7
|
+
cancel: '取消',
|
|
8
|
+
changeFilterMode: '更改過濾模式',
|
|
9
|
+
changeSearchMode: '更改搜尋模式',
|
|
10
|
+
clearFilter: '清除過濾',
|
|
11
|
+
clearSearch: '清除搜尋',
|
|
12
|
+
clearSelection: '清除選擇',
|
|
13
|
+
clearSort: '清除排序',
|
|
14
|
+
clickToCopy: '點擊以複製',
|
|
15
|
+
copy: '複製',
|
|
16
|
+
collapse: '折疊',
|
|
17
|
+
collapseAll: '全部折疊',
|
|
18
|
+
columnActions: '欄位動作',
|
|
19
|
+
copiedToClipboard: '已複製至剪貼簿',
|
|
20
|
+
dropToGroupBy: '拖放以按 {column} 分組',
|
|
21
|
+
edit: '編輯',
|
|
22
|
+
expand: '展開',
|
|
23
|
+
expandAll: '全部展開',
|
|
24
|
+
filterArrIncludes: '包括',
|
|
25
|
+
filterArrIncludesAll: '包括所有',
|
|
26
|
+
filterArrIncludesSome: '包括',
|
|
27
|
+
filterBetween: '介於首尾',
|
|
28
|
+
filterBetweenInclusive: '介於首尾之間',
|
|
29
|
+
filterByColumn: '以 {column} 過濾',
|
|
30
|
+
filterContains: '包含',
|
|
31
|
+
filterEmpty: '是空字串',
|
|
32
|
+
filterEndsWith: '結尾為',
|
|
33
|
+
filterEquals: '等於',
|
|
34
|
+
filterEqualsString: '等於',
|
|
35
|
+
filterFuzzy: '模糊搜索',
|
|
36
|
+
filterGreaterThan: '大於',
|
|
37
|
+
filterGreaterThanOrEqualTo: '大於等於',
|
|
38
|
+
filterInNumberRange: '介於',
|
|
39
|
+
filterIncludesString: '包含',
|
|
40
|
+
filterIncludesStringSensitive: '包含',
|
|
41
|
+
filterLessThan: '小於',
|
|
42
|
+
filterLessThanOrEqualTo: '小於等於',
|
|
43
|
+
filterMode: '過濾模式:{filterType}',
|
|
44
|
+
filterNotEmpty: '非空字串',
|
|
45
|
+
filterNotEquals: '不等於',
|
|
46
|
+
filterStartsWith: '開首為',
|
|
47
|
+
filterWeakEquals: '等於',
|
|
48
|
+
filteringByColumn: '正以 {column} 過濾:{filterType} {filterValue}',
|
|
49
|
+
goToFirstPage: '到第一頁',
|
|
50
|
+
goToLastPage: '到最後一頁',
|
|
51
|
+
goToNextPage: '下一頁',
|
|
52
|
+
goToPreviousPage: '上一頁',
|
|
53
|
+
grab: '拖曳',
|
|
54
|
+
groupByColumn: '按 {column} 分組',
|
|
55
|
+
groupedBy: '分組依據 ',
|
|
56
|
+
hideAll: '隱藏全部',
|
|
57
|
+
hideColumn: '隱藏 {column} 欄位',
|
|
58
|
+
max: '最大',
|
|
59
|
+
min: '最小',
|
|
60
|
+
move: '移動',
|
|
61
|
+
noRecordsToDisplay: '無紀錄可顯示',
|
|
62
|
+
noResultsFound: '未找到結果',
|
|
63
|
+
of: '/',
|
|
64
|
+
or: '或',
|
|
65
|
+
pin: '固定',
|
|
66
|
+
pinToLeft: '固定至左邊',
|
|
67
|
+
pinToRight: '固定至右邊',
|
|
68
|
+
resetColumnSize: '重置欄位大小',
|
|
69
|
+
resetOrder: '重置排序',
|
|
70
|
+
rowActions: '橫列動作',
|
|
71
|
+
rowNumber: '#',
|
|
72
|
+
rowNumbers: '橫列編號',
|
|
73
|
+
rowsPerPage: '每頁數量',
|
|
74
|
+
save: '儲存',
|
|
75
|
+
search: '搜尋',
|
|
76
|
+
selectedCountOfRowCountRowsSelected: '已選擇橫列:{selectedCount}/{rowCount}',
|
|
77
|
+
select: '選擇',
|
|
78
|
+
showAll: '顯示全部',
|
|
79
|
+
showAllColumns: '顯示全部欄位',
|
|
80
|
+
showHideColumns: '顯示/隱藏 欄位',
|
|
81
|
+
showHideFilters: '顯示/隱藏 過濾條件',
|
|
82
|
+
showHideSearch: '顯示/隱藏 搜尋條件',
|
|
83
|
+
sortByColumnAsc: '按 {column} 順序排序',
|
|
84
|
+
sortByColumnDesc: '按 {column} 倒序排序',
|
|
85
|
+
sortedByColumnAsc: '已按 {column} 順序排序',
|
|
86
|
+
sortedByColumnDesc: '已按 {column} 倒序排序',
|
|
87
|
+
thenBy: ',然後以',
|
|
88
|
+
toggleDensity: '切換密度',
|
|
89
|
+
toggleFullScreen: '切換全螢幕',
|
|
90
|
+
toggleSelectAll: '切換選擇全部',
|
|
91
|
+
toggleSelectRow: '切換選擇橫列',
|
|
92
|
+
toggleVisibility: '切換可見度',
|
|
93
|
+
ungroupByColumn: '取消按 {column} 分組',
|
|
94
|
+
unpin: '取消固定',
|
|
95
|
+
unpinAll: '全部取消固定',
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
exports.MRT_Localization_ZH_HANT = MRT_Localization_ZH_HANT;
|
package/package.json
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@novastera-oss/material-react-table",
|
|
3
|
+
"version": "4.0.0-beta.11",
|
|
4
|
+
"description": "Material UI V9 Material React Table",
|
|
5
|
+
"author": "Novastera",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"material-ui",
|
|
9
|
+
"mui",
|
|
10
|
+
"react",
|
|
11
|
+
"table",
|
|
12
|
+
"datagrid"
|
|
13
|
+
],
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/novastera/material-react-table.git"
|
|
17
|
+
},
|
|
18
|
+
"sideEffects": false,
|
|
19
|
+
"type": "module",
|
|
20
|
+
"main": "./dist/index.cjs",
|
|
21
|
+
"module": "./dist/index.js",
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"import": "./dist/index.js",
|
|
27
|
+
"require": "./dist/index.cjs"
|
|
28
|
+
},
|
|
29
|
+
"./locales/*": {
|
|
30
|
+
"types": "./locales/*/index.d.ts",
|
|
31
|
+
"import": "./locales/*/index.esm.js",
|
|
32
|
+
"require": "./locales/*/index.js"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"dist",
|
|
37
|
+
"locales",
|
|
38
|
+
"src"
|
|
39
|
+
],
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@tanstack/match-sorter-utils": "^8.15.1",
|
|
42
|
+
"@tanstack/react-table": "^8.21.2",
|
|
43
|
+
"@tanstack/react-virtual": "^3.13.0",
|
|
44
|
+
"clsx": "^2.1.1",
|
|
45
|
+
"dayjs": "^1.11.13",
|
|
46
|
+
"highlight-words": "^1.1.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@emotion/react": "^11.14.0",
|
|
50
|
+
"@emotion/styled": "^11.14.0",
|
|
51
|
+
"@faker-js/faker": "^9.3.0",
|
|
52
|
+
"@mui/material": "^9.0.0",
|
|
53
|
+
"@mui/icons-material": "^9.0.0",
|
|
54
|
+
"@mui/x-date-pickers": "^9.0.0",
|
|
55
|
+
"@rollup/plugin-typescript": "^12.0.0",
|
|
56
|
+
"@size-limit/preset-small-lib": "^12.0.0",
|
|
57
|
+
"@storybook/react": "10.3.6",
|
|
58
|
+
"@storybook/react-vite": "10.3.6",
|
|
59
|
+
"@types/node": "^24.0.0",
|
|
60
|
+
"@types/react": "^19.0.2",
|
|
61
|
+
"@types/react-dom": "^19.0.2",
|
|
62
|
+
"@typescript-eslint/eslint-plugin": "^8.59.3",
|
|
63
|
+
"@typescript-eslint/parser": "^8.59.3",
|
|
64
|
+
"@vitejs/plugin-react": "^6.0.0",
|
|
65
|
+
"eslint": "^10.3.0",
|
|
66
|
+
"eslint-plugin-perfectionist": "^5.9.0",
|
|
67
|
+
"react": "^19.0.0",
|
|
68
|
+
"react-dom": "^19.0.0",
|
|
69
|
+
"react-is": "^19.0.0",
|
|
70
|
+
"rimraf": "^6.1.3",
|
|
71
|
+
"rollup": "^4.0.0",
|
|
72
|
+
"rollup-plugin-copy": "^3.5.0",
|
|
73
|
+
"rollup-plugin-delete": "^3.0.0",
|
|
74
|
+
"rollup-plugin-dts": "^6.1.1",
|
|
75
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
76
|
+
"size-limit": "^12.1.0",
|
|
77
|
+
"storybook": "10.3.6",
|
|
78
|
+
"storybook-dark-mode": "^5.0.0",
|
|
79
|
+
"typescript": "^6.0.0",
|
|
80
|
+
"vite": "^8.0.12"
|
|
81
|
+
},
|
|
82
|
+
"peerDependencies": {
|
|
83
|
+
"@emotion/react": ">=11.13",
|
|
84
|
+
"@emotion/styled": ">=11.13",
|
|
85
|
+
"@mui/material": ">=9.0",
|
|
86
|
+
"@mui/icons-material": ">=9.0",
|
|
87
|
+
"@mui/x-date-pickers": ">=9.0",
|
|
88
|
+
"react": ">=19.0",
|
|
89
|
+
"react-dom": ">=19.0"
|
|
90
|
+
},
|
|
91
|
+
"scripts": {
|
|
92
|
+
"dev": "vite",
|
|
93
|
+
"lib:build": "pnpm lib:build-lib && pnpm lib:build-locales",
|
|
94
|
+
"lib:build-lib": "rollup -c",
|
|
95
|
+
"lib:build-locales": "node build-locales.mjs",
|
|
96
|
+
"lib:dev": "rollup -c -w",
|
|
97
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
98
|
+
"size": "size-limit",
|
|
99
|
+
"storybook": "storybook dev -p 6006",
|
|
100
|
+
"storybook:build": "storybook build",
|
|
101
|
+
"type-check": "tsc --noEmit"
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useMaterialReactTable } from '../hooks/useMaterialReactTable';
|
|
2
|
+
import {
|
|
3
|
+
type MRT_RowData,
|
|
4
|
+
type MRT_TableInstance,
|
|
5
|
+
type MRT_TableOptions,
|
|
6
|
+
type Xor,
|
|
7
|
+
} from '../types';
|
|
8
|
+
import { MRT_TablePaper } from './table/MRT_TablePaper';
|
|
9
|
+
|
|
10
|
+
type TableInstanceProp<TData extends MRT_RowData> = {
|
|
11
|
+
table: MRT_TableInstance<TData>;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type MaterialReactTableProps<TData extends MRT_RowData> = Xor<
|
|
15
|
+
TableInstanceProp<TData>,
|
|
16
|
+
MRT_TableOptions<TData>
|
|
17
|
+
>;
|
|
18
|
+
|
|
19
|
+
const isTableInstanceProp = <TData extends MRT_RowData>(
|
|
20
|
+
props: MaterialReactTableProps<TData>,
|
|
21
|
+
): props is TableInstanceProp<TData> =>
|
|
22
|
+
(props as TableInstanceProp<TData>).table !== undefined;
|
|
23
|
+
|
|
24
|
+
export const MaterialReactTable = <TData extends MRT_RowData>(
|
|
25
|
+
props: MaterialReactTableProps<TData>,
|
|
26
|
+
) => {
|
|
27
|
+
let table: MRT_TableInstance<TData>;
|
|
28
|
+
|
|
29
|
+
if (isTableInstanceProp(props)) {
|
|
30
|
+
table = props.table;
|
|
31
|
+
} else {
|
|
32
|
+
table = useMaterialReactTable(props);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return <MRT_TablePaper table={table} />;
|
|
36
|
+
};
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { memo, useMemo } from 'react';
|
|
2
|
+
import { type VirtualItem } from '@tanstack/react-virtual';
|
|
3
|
+
import TableBody, { type TableBodyProps } from '@mui/material/TableBody';
|
|
4
|
+
import Typography from '@mui/material/Typography';
|
|
5
|
+
import { MRT_TableBodyRow, Memo_MRT_TableBodyRow } from './MRT_TableBodyRow';
|
|
6
|
+
import { useMRT_RowVirtualizer } from '../../hooks/useMRT_RowVirtualizer';
|
|
7
|
+
import { useMRT_Rows } from '../../hooks/useMRT_Rows';
|
|
8
|
+
import {
|
|
9
|
+
type MRT_ColumnVirtualizer,
|
|
10
|
+
type MRT_Row,
|
|
11
|
+
type MRT_RowData,
|
|
12
|
+
type MRT_TableInstance,
|
|
13
|
+
} from '../../types';
|
|
14
|
+
import { parseFromValuesOrFunc } from '../../utils/utils';
|
|
15
|
+
|
|
16
|
+
export interface MRT_TableBodyProps<TData extends MRT_RowData>
|
|
17
|
+
extends TableBodyProps {
|
|
18
|
+
columnVirtualizer?: MRT_ColumnVirtualizer;
|
|
19
|
+
table: MRT_TableInstance<TData>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const MRT_TableBody = <TData extends MRT_RowData>({
|
|
23
|
+
columnVirtualizer,
|
|
24
|
+
table,
|
|
25
|
+
...rest
|
|
26
|
+
}: MRT_TableBodyProps<TData>) => {
|
|
27
|
+
const {
|
|
28
|
+
getBottomRows,
|
|
29
|
+
getIsSomeRowsPinned,
|
|
30
|
+
getRowModel,
|
|
31
|
+
getState,
|
|
32
|
+
getTopRows,
|
|
33
|
+
options: {
|
|
34
|
+
enableStickyFooter,
|
|
35
|
+
enableStickyHeader,
|
|
36
|
+
layoutMode,
|
|
37
|
+
localization,
|
|
38
|
+
memoMode,
|
|
39
|
+
muiTableBodyProps,
|
|
40
|
+
renderDetailPanel,
|
|
41
|
+
renderEmptyRowsFallback,
|
|
42
|
+
rowPinningDisplayMode,
|
|
43
|
+
},
|
|
44
|
+
refs: { tableFooterRef, tableHeadRef, tablePaperRef },
|
|
45
|
+
} = table;
|
|
46
|
+
const { columnFilters, globalFilter, isFullScreen, rowPinning } = getState();
|
|
47
|
+
|
|
48
|
+
const tableBodyProps = {
|
|
49
|
+
...parseFromValuesOrFunc(muiTableBodyProps, { table }),
|
|
50
|
+
...rest,
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const tableHeadHeight =
|
|
54
|
+
((enableStickyHeader || isFullScreen) &&
|
|
55
|
+
tableHeadRef.current?.clientHeight) ||
|
|
56
|
+
0;
|
|
57
|
+
const tableFooterHeight =
|
|
58
|
+
(enableStickyFooter && tableFooterRef.current?.clientHeight) || 0;
|
|
59
|
+
|
|
60
|
+
const pinnedRowIds = useMemo(() => {
|
|
61
|
+
if (!rowPinning.bottom?.length && !rowPinning.top?.length) return [];
|
|
62
|
+
return getRowModel()
|
|
63
|
+
.rows.filter((row) => row.getIsPinned())
|
|
64
|
+
.map((r) => r.id);
|
|
65
|
+
}, [rowPinning, getRowModel().rows]);
|
|
66
|
+
|
|
67
|
+
const rows = useMRT_Rows(table);
|
|
68
|
+
|
|
69
|
+
const rowVirtualizer = useMRT_RowVirtualizer(table, rows);
|
|
70
|
+
|
|
71
|
+
const { virtualRows } = rowVirtualizer ?? {};
|
|
72
|
+
|
|
73
|
+
const commonRowProps = {
|
|
74
|
+
columnVirtualizer,
|
|
75
|
+
numRows: rows.length,
|
|
76
|
+
table,
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<>
|
|
81
|
+
{!rowPinningDisplayMode?.includes('sticky') &&
|
|
82
|
+
getIsSomeRowsPinned('top') && (
|
|
83
|
+
<TableBody
|
|
84
|
+
{...tableBodyProps}
|
|
85
|
+
sx={[
|
|
86
|
+
{
|
|
87
|
+
display: layoutMode?.startsWith('grid') ? 'grid' : undefined,
|
|
88
|
+
position: 'sticky',
|
|
89
|
+
top: tableHeadHeight - 1,
|
|
90
|
+
zIndex: 1,
|
|
91
|
+
},
|
|
92
|
+
...(Array.isArray(tableBodyProps?.sx)
|
|
93
|
+
? tableBodyProps.sx
|
|
94
|
+
: [tableBodyProps?.sx]),
|
|
95
|
+
]}
|
|
96
|
+
>
|
|
97
|
+
{getTopRows().map((row, staticRowIndex) => {
|
|
98
|
+
const props = {
|
|
99
|
+
...commonRowProps,
|
|
100
|
+
row,
|
|
101
|
+
staticRowIndex,
|
|
102
|
+
};
|
|
103
|
+
return memoMode === 'rows' ? (
|
|
104
|
+
<Memo_MRT_TableBodyRow key={row.id} {...props} />
|
|
105
|
+
) : (
|
|
106
|
+
<MRT_TableBodyRow key={row.id} {...props} />
|
|
107
|
+
);
|
|
108
|
+
})}
|
|
109
|
+
</TableBody>
|
|
110
|
+
)}
|
|
111
|
+
<TableBody
|
|
112
|
+
{...tableBodyProps}
|
|
113
|
+
sx={[
|
|
114
|
+
{
|
|
115
|
+
display: layoutMode?.startsWith('grid') ? 'grid' : undefined,
|
|
116
|
+
height: rowVirtualizer
|
|
117
|
+
? `${rowVirtualizer.getTotalSize()}px`
|
|
118
|
+
: undefined,
|
|
119
|
+
minHeight: !rows.length ? '100px' : undefined,
|
|
120
|
+
position: 'relative',
|
|
121
|
+
},
|
|
122
|
+
...(Array.isArray(tableBodyProps?.sx)
|
|
123
|
+
? tableBodyProps.sx
|
|
124
|
+
: [tableBodyProps?.sx]),
|
|
125
|
+
]}
|
|
126
|
+
>
|
|
127
|
+
{tableBodyProps?.children ??
|
|
128
|
+
(!rows.length ? (
|
|
129
|
+
<tr
|
|
130
|
+
style={{
|
|
131
|
+
display: layoutMode?.startsWith('grid') ? 'grid' : undefined,
|
|
132
|
+
}}
|
|
133
|
+
>
|
|
134
|
+
<td
|
|
135
|
+
colSpan={table.getVisibleLeafColumns().length}
|
|
136
|
+
style={{
|
|
137
|
+
display: layoutMode?.startsWith('grid') ? 'grid' : undefined,
|
|
138
|
+
}}
|
|
139
|
+
>
|
|
140
|
+
{renderEmptyRowsFallback?.({ table }) ?? (
|
|
141
|
+
<Typography
|
|
142
|
+
sx={{
|
|
143
|
+
color: 'text.secondary',
|
|
144
|
+
fontStyle: 'italic',
|
|
145
|
+
maxWidth: `min(100vw, ${
|
|
146
|
+
tablePaperRef.current?.clientWidth ? tablePaperRef.current?.clientWidth + "px" : "100%"
|
|
147
|
+
})`,
|
|
148
|
+
py: '2rem',
|
|
149
|
+
textAlign: 'center',
|
|
150
|
+
width: '100%',
|
|
151
|
+
}}
|
|
152
|
+
>
|
|
153
|
+
{globalFilter || columnFilters.length
|
|
154
|
+
? localization.noResultsFound
|
|
155
|
+
: localization.noRecordsToDisplay}
|
|
156
|
+
</Typography>
|
|
157
|
+
)}
|
|
158
|
+
</td>
|
|
159
|
+
</tr>
|
|
160
|
+
) : (
|
|
161
|
+
<>
|
|
162
|
+
{(virtualRows ?? rows).map((rowOrVirtualRow, staticRowIndex) => {
|
|
163
|
+
let row = rowOrVirtualRow as MRT_Row<TData>;
|
|
164
|
+
if (rowVirtualizer) {
|
|
165
|
+
if (renderDetailPanel) {
|
|
166
|
+
if (rowOrVirtualRow.index % 2 === 1) {
|
|
167
|
+
return null;
|
|
168
|
+
} else {
|
|
169
|
+
staticRowIndex = rowOrVirtualRow.index / 2;
|
|
170
|
+
}
|
|
171
|
+
} else {
|
|
172
|
+
staticRowIndex = rowOrVirtualRow.index;
|
|
173
|
+
}
|
|
174
|
+
row = rows[staticRowIndex];
|
|
175
|
+
}
|
|
176
|
+
const props = {
|
|
177
|
+
...commonRowProps,
|
|
178
|
+
pinnedRowIds,
|
|
179
|
+
row,
|
|
180
|
+
rowVirtualizer,
|
|
181
|
+
staticRowIndex,
|
|
182
|
+
virtualRow: rowVirtualizer
|
|
183
|
+
? (rowOrVirtualRow as VirtualItem)
|
|
184
|
+
: undefined,
|
|
185
|
+
};
|
|
186
|
+
const key = `${row.id}-${row.index}`;
|
|
187
|
+
return memoMode === 'rows' ? (
|
|
188
|
+
<Memo_MRT_TableBodyRow key={key} {...props} />
|
|
189
|
+
) : (
|
|
190
|
+
<MRT_TableBodyRow key={key} {...props} />
|
|
191
|
+
);
|
|
192
|
+
})}
|
|
193
|
+
</>
|
|
194
|
+
))}
|
|
195
|
+
</TableBody>
|
|
196
|
+
{!rowPinningDisplayMode?.includes('sticky') &&
|
|
197
|
+
getIsSomeRowsPinned('bottom') && (
|
|
198
|
+
<TableBody
|
|
199
|
+
{...tableBodyProps}
|
|
200
|
+
sx={[
|
|
201
|
+
{
|
|
202
|
+
bottom: tableFooterHeight - 1,
|
|
203
|
+
display: layoutMode?.startsWith('grid') ? 'grid' : undefined,
|
|
204
|
+
position: 'sticky',
|
|
205
|
+
zIndex: 1,
|
|
206
|
+
},
|
|
207
|
+
...(Array.isArray(tableBodyProps?.sx)
|
|
208
|
+
? tableBodyProps.sx
|
|
209
|
+
: [tableBodyProps?.sx]),
|
|
210
|
+
]}
|
|
211
|
+
>
|
|
212
|
+
{getBottomRows().map((row, staticRowIndex) => {
|
|
213
|
+
const props = {
|
|
214
|
+
...commonRowProps,
|
|
215
|
+
row,
|
|
216
|
+
staticRowIndex,
|
|
217
|
+
};
|
|
218
|
+
return memoMode === 'rows' ? (
|
|
219
|
+
<Memo_MRT_TableBodyRow key={row.id} {...props} />
|
|
220
|
+
) : (
|
|
221
|
+
<MRT_TableBodyRow key={row.id} {...props} />
|
|
222
|
+
);
|
|
223
|
+
})}
|
|
224
|
+
</TableBody>
|
|
225
|
+
)}
|
|
226
|
+
</>
|
|
227
|
+
);
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
export const Memo_MRT_TableBody = memo(
|
|
231
|
+
MRT_TableBody,
|
|
232
|
+
(prev, next) => prev.table.options.data === next.table.options.data,
|
|
233
|
+
) as typeof MRT_TableBody;
|