@cutting/material-react-table 4.0.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/LICENSE +21 -0
- package/README.md +215 -0
- package/dist/index.d.ts +1876 -0
- package/dist/index.esm.js +4434 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +4540 -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 +133 -0
- package/src/MaterialReactTable.smoke.test.tsx +56 -0
- package/src/components/MaterialReactTable.tsx +36 -0
- package/src/components/body/MRT_TableBody.tsx +222 -0
- package/src/components/body/MRT_TableBodyCell.tsx +352 -0
- package/src/components/body/MRT_TableBodyCellValue.tsx +131 -0
- package/src/components/body/MRT_TableBodyRow.tsx +283 -0
- package/src/components/body/MRT_TableBodyRowGrabHandle.tsx +62 -0
- package/src/components/body/MRT_TableBodyRowPinButton.tsx +59 -0
- package/src/components/body/MRT_TableDetailPanel.tsx +111 -0
- package/src/components/buttons/MRT_ColumnPinningButtons.tsx +73 -0
- package/src/components/buttons/MRT_CopyButton.tsx +88 -0
- package/src/components/buttons/MRT_EditActionButtons.tsx +135 -0
- package/src/components/buttons/MRT_ExpandAllButton.tsx +79 -0
- package/src/components/buttons/MRT_ExpandButton.tsx +103 -0
- package/src/components/buttons/MRT_GrabHandleButton.tsx +66 -0
- package/src/components/buttons/MRT_RowPinButton.tsx +85 -0
- package/src/components/buttons/MRT_ShowHideColumnsButton.tsx +51 -0
- package/src/components/buttons/MRT_ToggleDensePaddingButton.tsx +53 -0
- package/src/components/buttons/MRT_ToggleFiltersButton.tsx +41 -0
- package/src/components/buttons/MRT_ToggleFullScreenButton.tsx +52 -0
- package/src/components/buttons/MRT_ToggleGlobalFilterButton.tsx +47 -0
- package/src/components/buttons/MRT_ToggleRowActionMenuButton.tsx +127 -0
- package/src/components/footer/MRT_TableFooter.tsx +89 -0
- package/src/components/footer/MRT_TableFooterCell.tsx +108 -0
- package/src/components/footer/MRT_TableFooterRow.tsx +96 -0
- package/src/components/head/MRT_TableHead.tsx +92 -0
- package/src/components/head/MRT_TableHeadCell.tsx +352 -0
- package/src/components/head/MRT_TableHeadCellColumnActionsButton.tsx +97 -0
- package/src/components/head/MRT_TableHeadCellFilterContainer.tsx +53 -0
- package/src/components/head/MRT_TableHeadCellFilterLabel.tsx +179 -0
- package/src/components/head/MRT_TableHeadCellGrabHandle.tsx +92 -0
- package/src/components/head/MRT_TableHeadCellResizeHandle.tsx +97 -0
- package/src/components/head/MRT_TableHeadCellSortLabel.tsx +102 -0
- package/src/components/head/MRT_TableHeadRow.tsx +91 -0
- package/src/components/inputs/MRT_EditCellTextField.tsx +190 -0
- package/src/components/inputs/MRT_FilterCheckbox.tsx +91 -0
- package/src/components/inputs/MRT_FilterRangeFields.tsx +42 -0
- package/src/components/inputs/MRT_FilterRangeSlider.tsx +144 -0
- package/src/components/inputs/MRT_FilterTextField.tsx +599 -0
- package/src/components/inputs/MRT_GlobalFilterTextField.tsx +160 -0
- package/src/components/inputs/MRT_SelectCheckbox.tsx +136 -0
- package/src/components/menus/MRT_ActionMenuItem.tsx +63 -0
- package/src/components/menus/MRT_CellActionMenu.tsx +108 -0
- package/src/components/menus/MRT_ColumnActionMenu.tsx +353 -0
- package/src/components/menus/MRT_FilterOptionMenu.tsx +293 -0
- package/src/components/menus/MRT_RowActionMenu.tsx +89 -0
- package/src/components/menus/MRT_ShowHideColumnsMenu.tsx +180 -0
- package/src/components/menus/MRT_ShowHideColumnsMenuItems.tsx +204 -0
- package/src/components/modals/MRT_EditRowModal.tsx +115 -0
- package/src/components/table/MRT_Table.tsx +85 -0
- package/src/components/table/MRT_TableContainer.tsx +112 -0
- package/src/components/table/MRT_TableLoadingOverlay.tsx +59 -0
- package/src/components/table/MRT_TablePaper.tsx +90 -0
- package/src/components/toolbar/MRT_BottomToolbar.tsx +109 -0
- package/src/components/toolbar/MRT_LinearProgressBar.tsx +54 -0
- package/src/components/toolbar/MRT_TablePagination.tsx +244 -0
- package/src/components/toolbar/MRT_ToolbarAlertBanner.tsx +184 -0
- package/src/components/toolbar/MRT_ToolbarDropZone.tsx +81 -0
- package/src/components/toolbar/MRT_ToolbarInternalButtons.tsx +73 -0
- package/src/components/toolbar/MRT_TopToolbar.tsx +131 -0
- package/src/fns/aggregationFns.ts +3 -0
- package/src/fns/filterFns.ts +197 -0
- package/src/fns/sortingFns.ts +34 -0
- package/src/hooks/display-columns/getMRT_RowActionsColumnDef.tsx +28 -0
- package/src/hooks/display-columns/getMRT_RowDragColumnDef.tsx +30 -0
- package/src/hooks/display-columns/getMRT_RowExpandColumnDef.tsx +97 -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 +125 -0
- package/src/hooks/useMRT_Effects.ts +107 -0
- package/src/hooks/useMRT_RowVirtualizer.ts +89 -0
- package/src/hooks/useMRT_Rows.ts +45 -0
- package/src/hooks/useMRT_TableInstance.ts +318 -0
- package/src/hooks/useMRT_TableOptions.ts +271 -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 +1290 -0
- package/src/utils/cell.utils.ts +234 -0
- package/src/utils/column.utils.ts +210 -0
- package/src/utils/displayColumn.utils.ts +152 -0
- package/src/utils/row.utils.ts +261 -0
- package/src/utils/slotProps.utils.ts +25 -0
- package/src/utils/style.utils.ts +210 -0
- package/src/utils/tanstack.helpers.ts +65 -0
- package/src/utils/utils.ts +23 -0
- package/src/utils/virtualization.utils.ts +24 -0
- package/src/vitest.setup.ts +1 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
const MRT_Localization_ZH_HANS = {
|
|
2
|
+
language: 'zh-Hans',
|
|
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_HANS };
|
|
@@ -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,133 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "4.0.0",
|
|
3
|
+
"license": "MIT",
|
|
4
|
+
"name": "@cutting/material-react-table",
|
|
5
|
+
"description": "Maintenance fork of material-react-table updated for Material UI v9. A fully featured Material UI implementation of TanStack React Table V8.",
|
|
6
|
+
"author": "Paul Cowan <paul.cowan@cutting.scot>",
|
|
7
|
+
"contributors": [
|
|
8
|
+
{
|
|
9
|
+
"name": "Kevin Vandy",
|
|
10
|
+
"url": "https://github.com/KevinVandy"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"keywords": [
|
|
14
|
+
"react-table",
|
|
15
|
+
"material-ui",
|
|
16
|
+
"material-table",
|
|
17
|
+
"tanstack table",
|
|
18
|
+
"data table"
|
|
19
|
+
],
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/dagda1/material-react-table"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/dagda1/material-react-table#readme",
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://github.com/dagda1/material-react-table/issues"
|
|
27
|
+
},
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"sideEffects": false,
|
|
32
|
+
"main": "dist/index.js",
|
|
33
|
+
"module": "dist/index.esm.js",
|
|
34
|
+
"typings": "dist/index.d.ts",
|
|
35
|
+
"files": [
|
|
36
|
+
"dist",
|
|
37
|
+
"locales",
|
|
38
|
+
"src"
|
|
39
|
+
],
|
|
40
|
+
"size-limit": [
|
|
41
|
+
{
|
|
42
|
+
"path": "dist/index.js",
|
|
43
|
+
"limit": "55 KB"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"path": "dist/index.esm.js",
|
|
47
|
+
"limit": "52 KB"
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"engines": {
|
|
51
|
+
"node": ">=24"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@emotion/react": "^11.14.0",
|
|
55
|
+
"@emotion/styled": "^11.14.1",
|
|
56
|
+
"@eslint/eslintrc": "^3.3.5",
|
|
57
|
+
"@eslint/js": "^10.0.1",
|
|
58
|
+
"@faker-js/faker": "^10.4.0",
|
|
59
|
+
"@mui/icons-material": "^9.0.1",
|
|
60
|
+
"@mui/material": "^9.0.1",
|
|
61
|
+
"@mui/x-date-pickers": "^9.2.0",
|
|
62
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
63
|
+
"@size-limit/preset-small-lib": "^12.1.0",
|
|
64
|
+
"@storybook/addon-a11y": "^10.4.0",
|
|
65
|
+
"@storybook/addon-docs": "^10.4.0",
|
|
66
|
+
"@storybook/addon-links": "^10.4.0",
|
|
67
|
+
"@storybook/react-vite": "^10.4.0",
|
|
68
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
69
|
+
"@testing-library/react": "^16.3.2",
|
|
70
|
+
"@testing-library/user-event": "^14.6.1",
|
|
71
|
+
"@types/node": "^25.9.1",
|
|
72
|
+
"@types/react": "^19.2.15",
|
|
73
|
+
"@types/react-dom": "^19.2.3",
|
|
74
|
+
"@typescript-eslint/eslint-plugin": "^8.59.4",
|
|
75
|
+
"@typescript-eslint/parser": "^8.59.4",
|
|
76
|
+
"@vitejs/plugin-react": "^6.0.2",
|
|
77
|
+
"dayjs": "^1.11.20",
|
|
78
|
+
"eslint": "^10.4.0",
|
|
79
|
+
"eslint-plugin-mui-path-imports": "^0.0.15",
|
|
80
|
+
"eslint-plugin-perfectionist": "^5.9.0",
|
|
81
|
+
"eslint-plugin-storybook": "^10.4.0",
|
|
82
|
+
"globals": "^17.6.0",
|
|
83
|
+
"jsdom": "^29.1.1",
|
|
84
|
+
"react": "^19.2.6",
|
|
85
|
+
"react-dom": "^19.2.6",
|
|
86
|
+
"react-is": "^19.2.6",
|
|
87
|
+
"rollup": "^4.60.4",
|
|
88
|
+
"rollup-plugin-copy": "^3.5.0",
|
|
89
|
+
"rollup-plugin-delete": "^3.0.2",
|
|
90
|
+
"rollup-plugin-dts": "^6.4.1",
|
|
91
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
92
|
+
"size-limit": "^12.1.0",
|
|
93
|
+
"storybook": "^10.4.0",
|
|
94
|
+
"storybook-dark-mode": "^5.0.0",
|
|
95
|
+
"tslib": "^2.8.1",
|
|
96
|
+
"typescript": "6.0.3",
|
|
97
|
+
"vite": "^8.0.13",
|
|
98
|
+
"vitest": "^4.1.6"
|
|
99
|
+
},
|
|
100
|
+
"peerDependencies": {
|
|
101
|
+
"@emotion/react": ">=11.13",
|
|
102
|
+
"@emotion/styled": ">=11.13",
|
|
103
|
+
"@mui/icons-material": ">=9",
|
|
104
|
+
"@mui/material": ">=9",
|
|
105
|
+
"@mui/x-date-pickers": ">=9.2",
|
|
106
|
+
"react": ">=19.0",
|
|
107
|
+
"react-dom": ">=19.0"
|
|
108
|
+
},
|
|
109
|
+
"dependencies": {
|
|
110
|
+
"@tanstack/match-sorter-utils": "8.19.4",
|
|
111
|
+
"@tanstack/react-table": "8.21.3",
|
|
112
|
+
"@tanstack/react-virtual": "3.13.24",
|
|
113
|
+
"highlight-words": "2.0.0"
|
|
114
|
+
},
|
|
115
|
+
"scripts": {
|
|
116
|
+
"build": "pnpm lib:build",
|
|
117
|
+
"build-locales": "pnpm lib:build-locales",
|
|
118
|
+
"build-lib": "pnpm lib:build-lib",
|
|
119
|
+
"dev": "pnpm lib:dev",
|
|
120
|
+
"lib:build": "pnpm build-lib && pnpm build-locales",
|
|
121
|
+
"lib:build-locales": "node build-locales.mjs",
|
|
122
|
+
"lib:build-lib": "rm -rf dist && rollup -c rollup.config.mjs && size-limit",
|
|
123
|
+
"lib:dev": "rollup -c rollup.config.mjs --watch",
|
|
124
|
+
"lint": "eslint .",
|
|
125
|
+
"size": "size-limit",
|
|
126
|
+
"test": "vitest run",
|
|
127
|
+
"test:watch": "vitest",
|
|
128
|
+
"storybook": "storybook dev -p 6006",
|
|
129
|
+
"storybook:build": "storybook build",
|
|
130
|
+
"storybook:dev": "storybook dev -p 6006",
|
|
131
|
+
"build-storybook": "storybook build"
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { describe, expect, test } from 'vitest';
|
|
4
|
+
|
|
5
|
+
import { MaterialReactTable } from './components/MaterialReactTable';
|
|
6
|
+
import { type MRT_ColumnDef } from './types';
|
|
7
|
+
|
|
8
|
+
interface Person {
|
|
9
|
+
age: number;
|
|
10
|
+
name: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const data: Person[] = [
|
|
14
|
+
{ age: 30, name: 'John' },
|
|
15
|
+
{ age: 25, name: 'Sara' },
|
|
16
|
+
{ age: 42, name: 'Aaron' },
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
const columns: MRT_ColumnDef<Person>[] = [
|
|
20
|
+
{ accessorKey: 'name', header: 'Name' },
|
|
21
|
+
{ accessorKey: 'age', header: 'Age' },
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
describe('MaterialReactTable smoke', () => {
|
|
25
|
+
test('renders headers and rows from props', () => {
|
|
26
|
+
render(<MaterialReactTable columns={columns} data={data} />);
|
|
27
|
+
|
|
28
|
+
expect(
|
|
29
|
+
screen.getByRole('columnheader', { name: /name/i }),
|
|
30
|
+
).toBeInTheDocument();
|
|
31
|
+
expect(
|
|
32
|
+
screen.getByRole('columnheader', { name: /age/i }),
|
|
33
|
+
).toBeInTheDocument();
|
|
34
|
+
|
|
35
|
+
expect(screen.getByText('John')).toBeInTheDocument();
|
|
36
|
+
expect(screen.getByText('Sara')).toBeInTheDocument();
|
|
37
|
+
expect(screen.getByText('Aaron')).toBeInTheDocument();
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test('sorts rows when a sortable header is clicked', async () => {
|
|
41
|
+
const user = userEvent.setup();
|
|
42
|
+
|
|
43
|
+
render(<MaterialReactTable columns={columns} data={data} />);
|
|
44
|
+
|
|
45
|
+
const [sortButton] = screen.getAllByRole('button', {
|
|
46
|
+
name: /sort by name/i,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
await user.click(sortButton);
|
|
50
|
+
|
|
51
|
+
const firstBodyRow = document.querySelector<HTMLTableRowElement>(
|
|
52
|
+
'tr[data-index="0"]',
|
|
53
|
+
);
|
|
54
|
+
expect(firstBodyRow?.textContent).toContain('Aaron');
|
|
55
|
+
});
|
|
56
|
+
});
|
|
@@ -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
|
+
export type MaterialReactTableProps<TData extends MRT_RowData> = Xor<
|
|
11
|
+
TableInstanceProp<TData>,
|
|
12
|
+
MRT_TableOptions<TData>
|
|
13
|
+
>;
|
|
14
|
+
|
|
15
|
+
type TableInstanceProp<TData extends MRT_RowData> = {
|
|
16
|
+
table: MRT_TableInstance<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
|
+
};
|