@cutting/material-react-table 4.0.5 → 5.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1825 -1737
- package/dist/index.js +5332 -4317
- package/dist/index.js.map +1 -1
- package/locales/ar/index.mjs +97 -0
- package/locales/ar/package.json +3 -3
- package/locales/az/index.mjs +97 -0
- package/locales/az/package.json +3 -3
- package/locales/bg/index.mjs +97 -0
- package/locales/bg/package.json +3 -3
- package/locales/cs/index.mjs +97 -0
- package/locales/cs/package.json +3 -3
- package/locales/da/index.mjs +97 -0
- package/locales/da/package.json +3 -3
- package/locales/de/index.mjs +97 -0
- package/locales/de/package.json +3 -3
- package/locales/el/index.mjs +97 -0
- package/locales/el/package.json +3 -3
- package/locales/en/index.mjs +97 -0
- package/locales/en/package.json +3 -3
- package/locales/es/index.mjs +97 -0
- package/locales/es/package.json +3 -3
- package/locales/et/index.mjs +97 -0
- package/locales/et/package.json +3 -3
- package/locales/fa/index.mjs +97 -0
- package/locales/fa/package.json +3 -3
- package/locales/fi/index.mjs +97 -0
- package/locales/fi/package.json +3 -3
- package/locales/fr/index.mjs +97 -0
- package/locales/fr/package.json +3 -3
- package/locales/he/index.mjs +97 -0
- package/locales/he/package.json +3 -3
- package/locales/hr/index.mjs +97 -0
- package/locales/hr/package.json +3 -3
- package/locales/hu/index.mjs +97 -0
- package/locales/hu/package.json +3 -3
- package/locales/hy/index.mjs +97 -0
- package/locales/hy/package.json +3 -3
- package/locales/id/index.mjs +97 -0
- package/locales/id/package.json +3 -3
- package/locales/it/index.mjs +97 -0
- package/locales/it/package.json +3 -3
- package/locales/ja/index.mjs +97 -0
- package/locales/ja/package.json +3 -3
- package/locales/ko/index.mjs +97 -0
- package/locales/ko/package.json +3 -3
- package/locales/nl/index.mjs +97 -0
- package/locales/nl/package.json +3 -3
- package/locales/no/index.mjs +97 -0
- package/locales/no/package.json +3 -3
- package/locales/np/index.mjs +97 -0
- package/locales/np/package.json +3 -3
- package/locales/pl/index.mjs +97 -0
- package/locales/pl/package.json +3 -3
- package/locales/pt/index.mjs +97 -0
- package/locales/pt/package.json +3 -3
- package/locales/pt-BR/index.mjs +97 -0
- package/locales/pt-BR/package.json +3 -3
- package/locales/ro/index.mjs +97 -0
- package/locales/ro/package.json +3 -3
- package/locales/ru/index.mjs +97 -0
- package/locales/ru/package.json +3 -3
- package/locales/sk/index.mjs +97 -0
- package/locales/sk/package.json +3 -3
- package/locales/sr-Cyrl-RS/index.mjs +97 -0
- package/locales/sr-Cyrl-RS/package.json +3 -3
- package/locales/sr-Latn-RS/index.mjs +97 -0
- package/locales/sr-Latn-RS/package.json +3 -3
- package/locales/sv/index.mjs +97 -0
- package/locales/sv/package.json +3 -3
- package/locales/tr/index.mjs +97 -0
- package/locales/tr/package.json +3 -3
- package/locales/uk/index.mjs +97 -0
- package/locales/uk/package.json +3 -3
- package/locales/vi/index.mjs +97 -0
- package/locales/vi/package.json +3 -3
- package/locales/zh-Hans/index.mjs +97 -0
- package/locales/zh-Hans/package.json +3 -3
- package/locales/zh-Hant/index.mjs +97 -0
- package/locales/zh-Hant/package.json +3 -3
- package/package.json +57 -53
- package/src/components/body/MRT_TableBody.tsx +1 -2
- package/src/components/body/MRT_TableBodyCell.tsx +4 -5
- package/src/components/body/MRT_TableBodyCellValue.tsx +1 -2
- package/src/components/body/MRT_TableBodyRow.tsx +1 -2
- package/src/components/body/MRT_TableBodyRowGrabHandle.test.tsx +42 -0
- package/src/components/body/MRT_TableBodyRowPinButton.tsx +1 -2
- package/src/components/body/MRT_TableDetailPanel.test.tsx +40 -0
- package/src/components/body/MRT_TableDetailPanel.tsx +1 -2
- package/src/components/buttons/MRT_ColumnPinningButtons.test.tsx +69 -0
- package/src/components/buttons/MRT_ColumnPinningButtons.tsx +3 -3
- package/src/components/buttons/MRT_EditActionButtons.test.tsx +50 -0
- package/src/components/buttons/MRT_EditActionButtons.tsx +1 -3
- package/src/components/buttons/MRT_ExpandAllButton.tsx +1 -2
- package/src/components/buttons/MRT_ExpandButton.tsx +1 -2
- package/src/components/buttons/MRT_ToggleDensePaddingButton.test.tsx +38 -0
- package/src/components/buttons/MRT_ToggleDensePaddingButton.tsx +1 -2
- package/src/components/buttons/MRT_ToggleFiltersButton.test.tsx +38 -0
- package/src/components/buttons/MRT_ToggleFiltersButton.tsx +1 -2
- package/src/components/buttons/MRT_ToggleFullScreenButton.test.tsx +36 -0
- package/src/components/buttons/MRT_ToggleFullScreenButton.tsx +1 -2
- package/src/components/buttons/MRT_ToggleGlobalFilterButton.tsx +1 -2
- package/src/components/buttons/MRT_ToggleRowActionMenuButton.tsx +2 -3
- package/src/components/footer/MRT_TableFooter.tsx +1 -2
- package/src/components/footer/MRT_TableFooterCell.tsx +1 -2
- package/src/components/head/MRT_TableHead.tsx +1 -2
- package/src/components/head/MRT_TableHeadCell.tsx +9 -9
- package/src/components/head/MRT_TableHeadCellFilterContainer.tsx +1 -2
- package/src/components/head/MRT_TableHeadCellGrabHandle.test.tsx +61 -0
- package/src/components/head/MRT_TableHeadCellGrabHandle.tsx +4 -5
- package/src/components/head/MRT_TableHeadCellResizeHandle.test.tsx +45 -0
- package/src/components/head/MRT_TableHeadCellResizeHandle.tsx +4 -5
- package/src/components/head/MRT_TableHeadCellSortLabel.tsx +1 -2
- package/src/components/inputs/MRT_EditCellTextField.test.tsx +36 -0
- package/src/components/inputs/MRT_EditCellTextField.tsx +1 -3
- package/src/components/inputs/MRT_FilterCheckbox.tsx +1 -2
- package/src/components/inputs/MRT_FilterRangeSlider.tsx +2 -1
- package/src/components/inputs/MRT_FilterTextField.test.tsx +75 -0
- package/src/components/inputs/MRT_GlobalFilterTextField.tsx +1 -2
- package/src/components/inputs/MRT_SelectCheckbox.test.tsx +69 -0
- package/src/components/inputs/MRT_SelectCheckbox.tsx +1 -2
- package/src/components/menus/MRT_CellActionMenu.tsx +1 -2
- package/src/components/menus/MRT_ColumnActionMenu.tsx +12 -13
- package/src/components/menus/MRT_FilterOptionMenu.tsx +1 -2
- package/src/components/menus/MRT_RowActionMenu.tsx +1 -2
- package/src/components/menus/MRT_ShowHideColumnsMenu.tsx +1 -2
- package/src/components/menus/MRT_ShowHideColumnsMenuItems.tsx +4 -5
- package/src/components/modals/MRT_EditRowModal.test.tsx +54 -0
- package/src/components/modals/MRT_EditRowModal.tsx +1 -2
- package/src/components/table/MRT_Table.tsx +4 -5
- package/src/components/table/MRT_TableContainer.tsx +1 -2
- package/src/components/table/MRT_TablePaper.tsx +1 -2
- package/src/components/toolbar/MRT_BottomToolbar.tsx +2 -3
- package/src/components/toolbar/MRT_LinearProgressBar.tsx +1 -2
- package/src/components/toolbar/MRT_TablePagination.tsx +1 -2
- package/src/components/toolbar/MRT_ToolbarAlertBanner.tsx +3 -4
- package/src/components/toolbar/MRT_ToolbarDropZone.test.tsx +42 -0
- package/src/components/toolbar/MRT_ToolbarDropZone.tsx +1 -2
- package/src/components/toolbar/MRT_TopToolbar.tsx +1 -2
- package/src/fns/aggregationFns.test.tsx +57 -0
- package/src/fns/filterFns.test.tsx +156 -0
- package/src/fns/filterFns.ts +36 -22
- package/src/fns/sortingFns.ts +14 -5
- package/src/fns/tableFeatures.test.tsx +106 -0
- package/src/fns/tableFeatures.ts +103 -0
- package/src/hooks/display-columns/getMRT_RowExpandColumnDef.tsx +2 -2
- package/src/hooks/useMRT_ColumnVirtualizer.ts +6 -5
- package/src/hooks/useMRT_Effects.ts +3 -4
- package/src/hooks/useMRT_RowVirtualizer.ts +1 -2
- package/src/hooks/useMRT_Rows.ts +1 -2
- package/src/hooks/useMRT_TableInstance.ts +82 -63
- package/src/hooks/useMRT_TableOptions.ts +5 -37
- package/src/icons.ts +1 -1
- package/src/types.ts +162 -134
- package/src/utils/column.utils.ts +31 -24
- package/src/utils/row.utils.ts +7 -10
- package/src/utils/style.utils.ts +9 -10
- package/src/utils/tanstack.helpers.ts +2 -2
- package/dist/index.esm.js +0 -4384
- package/dist/index.esm.js.map +0 -1
- package/locales/ar/index.esm.d.ts +0 -3
- package/locales/ar/index.esm.js +0 -96
- package/locales/ar/index.js +0 -98
- package/locales/az/index.esm.d.ts +0 -3
- package/locales/az/index.esm.js +0 -96
- package/locales/az/index.js +0 -98
- package/locales/bg/index.esm.d.ts +0 -3
- package/locales/bg/index.esm.js +0 -96
- package/locales/bg/index.js +0 -98
- package/locales/cs/index.esm.d.ts +0 -3
- package/locales/cs/index.esm.js +0 -96
- package/locales/cs/index.js +0 -98
- package/locales/da/index.esm.d.ts +0 -3
- package/locales/da/index.esm.js +0 -96
- package/locales/da/index.js +0 -98
- package/locales/de/index.esm.d.ts +0 -3
- package/locales/de/index.esm.js +0 -96
- package/locales/de/index.js +0 -98
- package/locales/el/index.esm.d.ts +0 -3
- package/locales/el/index.esm.js +0 -96
- package/locales/el/index.js +0 -98
- package/locales/en/index.esm.d.ts +0 -3
- package/locales/en/index.esm.js +0 -96
- package/locales/en/index.js +0 -98
- package/locales/es/index.esm.d.ts +0 -3
- package/locales/es/index.esm.js +0 -96
- package/locales/es/index.js +0 -98
- package/locales/et/index.esm.d.ts +0 -3
- package/locales/et/index.esm.js +0 -96
- package/locales/et/index.js +0 -98
- package/locales/fa/index.esm.d.ts +0 -3
- package/locales/fa/index.esm.js +0 -96
- package/locales/fa/index.js +0 -98
- package/locales/fi/index.esm.d.ts +0 -3
- package/locales/fi/index.esm.js +0 -96
- package/locales/fi/index.js +0 -98
- package/locales/fr/index.esm.d.ts +0 -3
- package/locales/fr/index.esm.js +0 -96
- package/locales/fr/index.js +0 -98
- package/locales/he/index.esm.d.ts +0 -3
- package/locales/he/index.esm.js +0 -96
- package/locales/he/index.js +0 -98
- package/locales/hr/index.esm.d.ts +0 -3
- package/locales/hr/index.esm.js +0 -96
- package/locales/hr/index.js +0 -98
- package/locales/hu/index.esm.d.ts +0 -3
- package/locales/hu/index.esm.js +0 -96
- package/locales/hu/index.js +0 -98
- package/locales/hy/index.esm.d.ts +0 -3
- package/locales/hy/index.esm.js +0 -96
- package/locales/hy/index.js +0 -98
- package/locales/id/index.esm.d.ts +0 -3
- package/locales/id/index.esm.js +0 -96
- package/locales/id/index.js +0 -98
- package/locales/it/index.esm.d.ts +0 -3
- package/locales/it/index.esm.js +0 -96
- package/locales/it/index.js +0 -98
- package/locales/ja/index.esm.d.ts +0 -3
- package/locales/ja/index.esm.js +0 -96
- package/locales/ja/index.js +0 -98
- package/locales/ko/index.esm.d.ts +0 -3
- package/locales/ko/index.esm.js +0 -96
- package/locales/ko/index.js +0 -98
- package/locales/nl/index.esm.d.ts +0 -3
- package/locales/nl/index.esm.js +0 -96
- package/locales/nl/index.js +0 -98
- package/locales/no/index.esm.d.ts +0 -3
- package/locales/no/index.esm.js +0 -96
- package/locales/no/index.js +0 -98
- package/locales/np/index.esm.d.ts +0 -3
- package/locales/np/index.esm.js +0 -96
- package/locales/np/index.js +0 -98
- package/locales/pl/index.esm.d.ts +0 -3
- package/locales/pl/index.esm.js +0 -96
- package/locales/pl/index.js +0 -98
- package/locales/pt/index.esm.d.ts +0 -3
- package/locales/pt/index.esm.js +0 -96
- package/locales/pt/index.js +0 -98
- package/locales/pt-BR/index.esm.d.ts +0 -3
- package/locales/pt-BR/index.esm.js +0 -96
- package/locales/pt-BR/index.js +0 -98
- package/locales/ro/index.esm.d.ts +0 -3
- package/locales/ro/index.esm.js +0 -96
- package/locales/ro/index.js +0 -98
- package/locales/ru/index.esm.d.ts +0 -3
- package/locales/ru/index.esm.js +0 -96
- package/locales/ru/index.js +0 -98
- package/locales/sk/index.esm.d.ts +0 -3
- package/locales/sk/index.esm.js +0 -96
- package/locales/sk/index.js +0 -98
- package/locales/sr-Cyrl-RS/index.esm.d.ts +0 -3
- package/locales/sr-Cyrl-RS/index.esm.js +0 -96
- package/locales/sr-Cyrl-RS/index.js +0 -98
- package/locales/sr-Latn-RS/index.esm.d.ts +0 -3
- package/locales/sr-Latn-RS/index.esm.js +0 -96
- package/locales/sr-Latn-RS/index.js +0 -98
- package/locales/sv/index.esm.d.ts +0 -3
- package/locales/sv/index.esm.js +0 -96
- package/locales/sv/index.js +0 -98
- package/locales/tr/index.esm.d.ts +0 -3
- package/locales/tr/index.esm.js +0 -96
- package/locales/tr/index.js +0 -98
- package/locales/uk/index.esm.d.ts +0 -3
- package/locales/uk/index.esm.js +0 -96
- package/locales/uk/index.js +0 -98
- package/locales/vi/index.esm.d.ts +0 -3
- package/locales/vi/index.esm.js +0 -96
- package/locales/vi/index.js +0 -98
- package/locales/zh-Hans/index.esm.d.ts +0 -3
- package/locales/zh-Hans/index.esm.js +0 -96
- package/locales/zh-Hans/index.js +0 -98
- package/locales/zh-Hant/index.esm.d.ts +0 -3
- package/locales/zh-Hant/index.esm.js +0 -96
- package/locales/zh-Hant/index.js +0 -98
- /package/locales/ar/{index.d.ts → index.d.mts} +0 -0
- /package/locales/az/{index.d.ts → index.d.mts} +0 -0
- /package/locales/bg/{index.d.ts → index.d.mts} +0 -0
- /package/locales/cs/{index.d.ts → index.d.mts} +0 -0
- /package/locales/da/{index.d.ts → index.d.mts} +0 -0
- /package/locales/de/{index.d.ts → index.d.mts} +0 -0
- /package/locales/el/{index.d.ts → index.d.mts} +0 -0
- /package/locales/en/{index.d.ts → index.d.mts} +0 -0
- /package/locales/es/{index.d.ts → index.d.mts} +0 -0
- /package/locales/et/{index.d.ts → index.d.mts} +0 -0
- /package/locales/fa/{index.d.ts → index.d.mts} +0 -0
- /package/locales/fi/{index.d.ts → index.d.mts} +0 -0
- /package/locales/fr/{index.d.ts → index.d.mts} +0 -0
- /package/locales/he/{index.d.ts → index.d.mts} +0 -0
- /package/locales/hr/{index.d.ts → index.d.mts} +0 -0
- /package/locales/hu/{index.d.ts → index.d.mts} +0 -0
- /package/locales/hy/{index.d.ts → index.d.mts} +0 -0
- /package/locales/id/{index.d.ts → index.d.mts} +0 -0
- /package/locales/it/{index.d.ts → index.d.mts} +0 -0
- /package/locales/ja/{index.d.ts → index.d.mts} +0 -0
- /package/locales/ko/{index.d.ts → index.d.mts} +0 -0
- /package/locales/nl/{index.d.ts → index.d.mts} +0 -0
- /package/locales/no/{index.d.ts → index.d.mts} +0 -0
- /package/locales/np/{index.d.ts → index.d.mts} +0 -0
- /package/locales/pl/{index.d.ts → index.d.mts} +0 -0
- /package/locales/pt/{index.d.ts → index.d.mts} +0 -0
- /package/locales/pt-BR/{index.d.ts → index.d.mts} +0 -0
- /package/locales/ro/{index.d.ts → index.d.mts} +0 -0
- /package/locales/ru/{index.d.ts → index.d.mts} +0 -0
- /package/locales/sk/{index.d.ts → index.d.mts} +0 -0
- /package/locales/sr-Cyrl-RS/{index.d.ts → index.d.mts} +0 -0
- /package/locales/sr-Latn-RS/{index.d.ts → index.d.mts} +0 -0
- /package/locales/sv/{index.d.ts → index.d.mts} +0 -0
- /package/locales/tr/{index.d.ts → index.d.mts} +0 -0
- /package/locales/uk/{index.d.ts → index.d.mts} +0 -0
- /package/locales/vi/{index.d.ts → index.d.mts} +0 -0
- /package/locales/zh-Hans/{index.d.ts → index.d.mts} +0 -0
- /package/locales/zh-Hant/{index.d.ts → index.d.mts} +0 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
//#region src/locales/zh-Hans.ts
|
|
2
|
+
const MRT_Localization_ZH_HANS = {
|
|
3
|
+
language: "zh-Hans",
|
|
4
|
+
actions: "操作",
|
|
5
|
+
and: "与",
|
|
6
|
+
cancel: "取消",
|
|
7
|
+
changeFilterMode: "更改过滤模式",
|
|
8
|
+
changeSearchMode: "更改搜索模式",
|
|
9
|
+
clearFilter: "清除过滤",
|
|
10
|
+
clearSearch: "清除搜索",
|
|
11
|
+
clearSelection: "清除选择",
|
|
12
|
+
clearSort: "清除排序",
|
|
13
|
+
clickToCopy: "点击以复制",
|
|
14
|
+
copy: "复制",
|
|
15
|
+
collapse: "折叠",
|
|
16
|
+
collapseAll: "全部折叠",
|
|
17
|
+
columnActions: "列操作",
|
|
18
|
+
copiedToClipboard: "已复制至剪贴板",
|
|
19
|
+
dropToGroupBy: "拖放以按 {column} 分组",
|
|
20
|
+
edit: "编辑",
|
|
21
|
+
expand: "展开",
|
|
22
|
+
expandAll: "全部展开",
|
|
23
|
+
filterArrIncludes: "包括",
|
|
24
|
+
filterArrIncludesAll: "包括所有",
|
|
25
|
+
filterArrIncludesSome: "包括",
|
|
26
|
+
filterBetween: "介于首尾",
|
|
27
|
+
filterBetweenInclusive: "介于首尾之间",
|
|
28
|
+
filterByColumn: "以 {column} 过滤",
|
|
29
|
+
filterContains: "包含",
|
|
30
|
+
filterEmpty: "是空字串",
|
|
31
|
+
filterEndsWith: "结尾为",
|
|
32
|
+
filterEquals: "等于",
|
|
33
|
+
filterEqualsString: "等于",
|
|
34
|
+
filterFuzzy: "模糊搜索",
|
|
35
|
+
filterGreaterThan: "大于",
|
|
36
|
+
filterGreaterThanOrEqualTo: "大于等于",
|
|
37
|
+
filterInNumberRange: "介于",
|
|
38
|
+
filterIncludesString: "包含",
|
|
39
|
+
filterIncludesStringSensitive: "包含",
|
|
40
|
+
filterLessThan: "小于",
|
|
41
|
+
filterLessThanOrEqualTo: "小于等于",
|
|
42
|
+
filterMode: "过滤模式:{filterType}",
|
|
43
|
+
filterNotEmpty: "非空字串",
|
|
44
|
+
filterNotEquals: "不等于",
|
|
45
|
+
filterStartsWith: "开首为",
|
|
46
|
+
filterWeakEquals: "等于",
|
|
47
|
+
filteringByColumn: "以 {column} 过滤:{filterType} {filterValue}",
|
|
48
|
+
goToFirstPage: "到第一页",
|
|
49
|
+
goToLastPage: "到最后一页",
|
|
50
|
+
goToNextPage: "下一页",
|
|
51
|
+
goToPreviousPage: "上一页",
|
|
52
|
+
grab: "拖曳",
|
|
53
|
+
groupByColumn: "按 {column} 分组",
|
|
54
|
+
groupedBy: "分组依据 ",
|
|
55
|
+
hideAll: "隐藏全部",
|
|
56
|
+
hideColumn: "隐藏 {column} 列",
|
|
57
|
+
max: "最大",
|
|
58
|
+
min: "最小",
|
|
59
|
+
move: "移动",
|
|
60
|
+
noRecordsToDisplay: "无记录可显示",
|
|
61
|
+
noResultsFound: "未找到结果",
|
|
62
|
+
of: "/",
|
|
63
|
+
or: "或",
|
|
64
|
+
pin: "固定",
|
|
65
|
+
pinToLeft: "固定至左边",
|
|
66
|
+
pinToRight: "固定至右边",
|
|
67
|
+
resetColumnSize: "重置列大小",
|
|
68
|
+
resetOrder: "重置排序",
|
|
69
|
+
rowActions: "行操作",
|
|
70
|
+
rowNumber: "#",
|
|
71
|
+
rowNumbers: "行号码",
|
|
72
|
+
rowsPerPage: "每页行数",
|
|
73
|
+
save: "保存",
|
|
74
|
+
search: "搜索",
|
|
75
|
+
selectedCountOfRowCountRowsSelected: "已选择行:{selectedCount}/{rowCount}",
|
|
76
|
+
select: "选择",
|
|
77
|
+
showAll: "显示全部",
|
|
78
|
+
showAllColumns: "显示全部列",
|
|
79
|
+
showHideColumns: "显示/隐藏 列",
|
|
80
|
+
showHideFilters: "显示/隐藏 过滤条件",
|
|
81
|
+
showHideSearch: "显示/隐藏 搜索条件",
|
|
82
|
+
sortByColumnAsc: "按 {column} 升序排序",
|
|
83
|
+
sortByColumnDesc: "按 {column} 倒序排序",
|
|
84
|
+
sortedByColumnAsc: "已按 {column} 升序排序",
|
|
85
|
+
sortedByColumnDesc: "已按 {column} 倒序排序",
|
|
86
|
+
thenBy: ",然后以",
|
|
87
|
+
toggleDensity: "切换间距",
|
|
88
|
+
toggleFullScreen: "切换全屏",
|
|
89
|
+
toggleSelectAll: "切换选择全部",
|
|
90
|
+
toggleSelectRow: "切换选择行",
|
|
91
|
+
toggleVisibility: "切换可见度",
|
|
92
|
+
ungroupByColumn: "取消按 {column} 分组",
|
|
93
|
+
unpin: "取消固定",
|
|
94
|
+
unpinAll: "全部取消固定"
|
|
95
|
+
};
|
|
96
|
+
//#endregion
|
|
97
|
+
export { MRT_Localization_ZH_HANS };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
//#region src/locales/zh-Hant.ts
|
|
2
|
+
const MRT_Localization_ZH_HANT = {
|
|
3
|
+
language: "zh-Hant",
|
|
4
|
+
actions: "動作",
|
|
5
|
+
and: "與",
|
|
6
|
+
cancel: "取消",
|
|
7
|
+
changeFilterMode: "更改過濾模式",
|
|
8
|
+
changeSearchMode: "更改搜尋模式",
|
|
9
|
+
clearFilter: "清除過濾",
|
|
10
|
+
clearSearch: "清除搜尋",
|
|
11
|
+
clearSelection: "清除選擇",
|
|
12
|
+
clearSort: "清除排序",
|
|
13
|
+
clickToCopy: "點擊以複製",
|
|
14
|
+
copy: "複製",
|
|
15
|
+
collapse: "折疊",
|
|
16
|
+
collapseAll: "全部折疊",
|
|
17
|
+
columnActions: "欄位動作",
|
|
18
|
+
copiedToClipboard: "已複製至剪貼簿",
|
|
19
|
+
dropToGroupBy: "拖放以按 {column} 分組",
|
|
20
|
+
edit: "編輯",
|
|
21
|
+
expand: "展開",
|
|
22
|
+
expandAll: "全部展開",
|
|
23
|
+
filterArrIncludes: "包括",
|
|
24
|
+
filterArrIncludesAll: "包括所有",
|
|
25
|
+
filterArrIncludesSome: "包括",
|
|
26
|
+
filterBetween: "介於首尾",
|
|
27
|
+
filterBetweenInclusive: "介於首尾之間",
|
|
28
|
+
filterByColumn: "以 {column} 過濾",
|
|
29
|
+
filterContains: "包含",
|
|
30
|
+
filterEmpty: "是空字串",
|
|
31
|
+
filterEndsWith: "結尾為",
|
|
32
|
+
filterEquals: "等於",
|
|
33
|
+
filterEqualsString: "等於",
|
|
34
|
+
filterFuzzy: "模糊搜索",
|
|
35
|
+
filterGreaterThan: "大於",
|
|
36
|
+
filterGreaterThanOrEqualTo: "大於等於",
|
|
37
|
+
filterInNumberRange: "介於",
|
|
38
|
+
filterIncludesString: "包含",
|
|
39
|
+
filterIncludesStringSensitive: "包含",
|
|
40
|
+
filterLessThan: "小於",
|
|
41
|
+
filterLessThanOrEqualTo: "小於等於",
|
|
42
|
+
filterMode: "過濾模式:{filterType}",
|
|
43
|
+
filterNotEmpty: "非空字串",
|
|
44
|
+
filterNotEquals: "不等於",
|
|
45
|
+
filterStartsWith: "開首為",
|
|
46
|
+
filterWeakEquals: "等於",
|
|
47
|
+
filteringByColumn: "正以 {column} 過濾:{filterType} {filterValue}",
|
|
48
|
+
goToFirstPage: "到第一頁",
|
|
49
|
+
goToLastPage: "到最後一頁",
|
|
50
|
+
goToNextPage: "下一頁",
|
|
51
|
+
goToPreviousPage: "上一頁",
|
|
52
|
+
grab: "拖曳",
|
|
53
|
+
groupByColumn: "按 {column} 分組",
|
|
54
|
+
groupedBy: "分組依據 ",
|
|
55
|
+
hideAll: "隱藏全部",
|
|
56
|
+
hideColumn: "隱藏 {column} 欄位",
|
|
57
|
+
max: "最大",
|
|
58
|
+
min: "最小",
|
|
59
|
+
move: "移動",
|
|
60
|
+
noRecordsToDisplay: "無紀錄可顯示",
|
|
61
|
+
noResultsFound: "未找到結果",
|
|
62
|
+
of: "/",
|
|
63
|
+
or: "或",
|
|
64
|
+
pin: "固定",
|
|
65
|
+
pinToLeft: "固定至左邊",
|
|
66
|
+
pinToRight: "固定至右邊",
|
|
67
|
+
resetColumnSize: "重置欄位大小",
|
|
68
|
+
resetOrder: "重置排序",
|
|
69
|
+
rowActions: "橫列動作",
|
|
70
|
+
rowNumber: "#",
|
|
71
|
+
rowNumbers: "橫列編號",
|
|
72
|
+
rowsPerPage: "每頁數量",
|
|
73
|
+
save: "儲存",
|
|
74
|
+
search: "搜尋",
|
|
75
|
+
selectedCountOfRowCountRowsSelected: "已選擇橫列:{selectedCount}/{rowCount}",
|
|
76
|
+
select: "選擇",
|
|
77
|
+
showAll: "顯示全部",
|
|
78
|
+
showAllColumns: "顯示全部欄位",
|
|
79
|
+
showHideColumns: "顯示/隱藏 欄位",
|
|
80
|
+
showHideFilters: "顯示/隱藏 過濾條件",
|
|
81
|
+
showHideSearch: "顯示/隱藏 搜尋條件",
|
|
82
|
+
sortByColumnAsc: "按 {column} 順序排序",
|
|
83
|
+
sortByColumnDesc: "按 {column} 倒序排序",
|
|
84
|
+
sortedByColumnAsc: "已按 {column} 順序排序",
|
|
85
|
+
sortedByColumnDesc: "已按 {column} 倒序排序",
|
|
86
|
+
thenBy: ",然後以",
|
|
87
|
+
toggleDensity: "切換密度",
|
|
88
|
+
toggleFullScreen: "切換全螢幕",
|
|
89
|
+
toggleSelectAll: "切換選擇全部",
|
|
90
|
+
toggleSelectRow: "切換選擇橫列",
|
|
91
|
+
toggleVisibility: "切換可見度",
|
|
92
|
+
ungroupByColumn: "取消按 {column} 分組",
|
|
93
|
+
unpin: "取消固定",
|
|
94
|
+
unpinAll: "全部取消固定"
|
|
95
|
+
};
|
|
96
|
+
//#endregion
|
|
97
|
+
export { MRT_Localization_ZH_HANT };
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "
|
|
2
|
+
"version": "5.0.0-beta.1",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"name": "@cutting/material-react-table",
|
|
5
5
|
"description": "Maintenance fork of material-react-table updated for Material UI v9. A fully featured Material UI implementation of TanStack React Table V8.",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"sideEffects": false,
|
|
32
|
-
"
|
|
33
|
-
"module": "dist/index.
|
|
34
|
-
"
|
|
32
|
+
"type": "module",
|
|
33
|
+
"module": "dist/index.js",
|
|
34
|
+
"types": "dist/index.d.ts",
|
|
35
35
|
"files": [
|
|
36
36
|
"dist",
|
|
37
37
|
"locales",
|
|
@@ -40,62 +40,54 @@
|
|
|
40
40
|
"size-limit": [
|
|
41
41
|
{
|
|
42
42
|
"path": "dist/index.js",
|
|
43
|
-
"limit": "
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
"path": "dist/index.esm.js",
|
|
47
|
-
"limit": "53 KB"
|
|
43
|
+
"limit": "65 KB"
|
|
48
44
|
}
|
|
49
45
|
],
|
|
50
46
|
"engines": {
|
|
51
|
-
"node": ">=
|
|
47
|
+
"node": ">=22"
|
|
52
48
|
},
|
|
53
49
|
"devDependencies": {
|
|
54
50
|
"@emotion/react": "^11.14.0",
|
|
55
51
|
"@emotion/styled": "^11.14.1",
|
|
56
|
-
"@eslint/eslintrc": "^3.3.
|
|
52
|
+
"@eslint/eslintrc": "^3.3.7",
|
|
57
53
|
"@eslint/js": "^10.0.1",
|
|
58
|
-
"@faker-js/faker": "^10.
|
|
59
|
-
"@mui/icons-material": "^9.
|
|
60
|
-
"@mui/material": "^9.
|
|
61
|
-
"@mui/x-date-pickers": "^9.
|
|
62
|
-
"@
|
|
63
|
-
"@
|
|
64
|
-
"@storybook/addon-
|
|
65
|
-
"@storybook/addon-
|
|
66
|
-
"@storybook/
|
|
67
|
-
"@
|
|
68
|
-
"@testing-library/
|
|
69
|
-
"@testing-library/
|
|
70
|
-
"@
|
|
71
|
-
"@types/
|
|
72
|
-
"@types/react": "^19.2.
|
|
73
|
-
"@
|
|
74
|
-
"@typescript-eslint/
|
|
75
|
-
"@
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"eslint": "^10.5.0",
|
|
54
|
+
"@faker-js/faker": "^10.6.0",
|
|
55
|
+
"@mui/icons-material": "^9.4.0",
|
|
56
|
+
"@mui/material": "^9.4.0",
|
|
57
|
+
"@mui/x-date-pickers": "^9.13.0",
|
|
58
|
+
"@size-limit/preset-small-lib": "^13.0.3",
|
|
59
|
+
"@storybook/addon-a11y": "^10.6.0",
|
|
60
|
+
"@storybook/addon-docs": "^10.6.0",
|
|
61
|
+
"@storybook/addon-links": "^10.6.0",
|
|
62
|
+
"@storybook/react-vite": "^10.6.0",
|
|
63
|
+
"@testing-library/jest-dom": "^7.0.1",
|
|
64
|
+
"@testing-library/react": "^16.3.3",
|
|
65
|
+
"@testing-library/user-event": "^14.6.7",
|
|
66
|
+
"@types/node": "^26.5.0",
|
|
67
|
+
"@types/react": "^19.2.18",
|
|
68
|
+
"@types/react-dom": "^19.2.7",
|
|
69
|
+
"@typescript-eslint/eslint-plugin": "^8.70.0",
|
|
70
|
+
"@typescript-eslint/parser": "^8.70.0",
|
|
71
|
+
"@vitejs/plugin-react": "^6.1.1",
|
|
72
|
+
"dayjs": "^1.11.23",
|
|
73
|
+
"eslint": "^10.10.0",
|
|
79
74
|
"eslint-plugin-mui-path-imports": "^0.0.15",
|
|
80
|
-
"eslint-plugin-perfectionist": "^5.
|
|
81
|
-
"eslint-plugin-storybook": "^10.
|
|
82
|
-
"globals": "^17.
|
|
83
|
-
"jsdom": "^
|
|
84
|
-
"react": "^19.2.
|
|
85
|
-
"react-dom": "^19.2.
|
|
86
|
-
"react-is": "^19.2.
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
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.6",
|
|
75
|
+
"eslint-plugin-perfectionist": "^5.11.0",
|
|
76
|
+
"eslint-plugin-storybook": "^10.6.0",
|
|
77
|
+
"globals": "^17.12.0",
|
|
78
|
+
"jsdom": "^30.0.1",
|
|
79
|
+
"react": "^19.2.8",
|
|
80
|
+
"react-dom": "^19.2.8",
|
|
81
|
+
"react-is": "^19.2.8",
|
|
82
|
+
"rolldown": "^1.2.7",
|
|
83
|
+
"size-limit": "^13.0.3",
|
|
84
|
+
"storybook": "^10.6.0",
|
|
94
85
|
"storybook-dark-mode": "^5.0.0",
|
|
86
|
+
"tsdown": "^0.23.0",
|
|
95
87
|
"tslib": "^2.8.1",
|
|
96
88
|
"typescript": "6.0.3",
|
|
97
|
-
"vite": "^8.
|
|
98
|
-
"vitest": "^
|
|
89
|
+
"vite": "^8.2.2",
|
|
90
|
+
"vitest": "^5.0.0"
|
|
99
91
|
},
|
|
100
92
|
"peerDependencies": {
|
|
101
93
|
"@emotion/react": ">=11.13",
|
|
@@ -107,11 +99,23 @@
|
|
|
107
99
|
"react-dom": ">=19.0"
|
|
108
100
|
},
|
|
109
101
|
"dependencies": {
|
|
110
|
-
"@tanstack/match-sorter-utils": "
|
|
111
|
-
"@tanstack/react-table": "
|
|
112
|
-
"@tanstack/react-virtual": "3.14.
|
|
102
|
+
"@tanstack/match-sorter-utils": "9.1.2",
|
|
103
|
+
"@tanstack/react-table": "9.2.4",
|
|
104
|
+
"@tanstack/react-virtual": "3.14.11",
|
|
105
|
+
"@tanstack/table-core": "9.2.4",
|
|
113
106
|
"highlight-words": "2.0.0"
|
|
114
107
|
},
|
|
108
|
+
"exports": {
|
|
109
|
+
".": {
|
|
110
|
+
"types": "./dist/index.d.ts",
|
|
111
|
+
"default": "./dist/index.js"
|
|
112
|
+
},
|
|
113
|
+
"./locales/*": {
|
|
114
|
+
"types": "./locales/*/index.d.mts",
|
|
115
|
+
"default": "./locales/*/index.mjs"
|
|
116
|
+
},
|
|
117
|
+
"./package.json": "./package.json"
|
|
118
|
+
},
|
|
115
119
|
"scripts": {
|
|
116
120
|
"build": "pnpm lib:build",
|
|
117
121
|
"build-locales": "pnpm lib:build-locales",
|
|
@@ -119,8 +123,8 @@
|
|
|
119
123
|
"dev": "pnpm lib:dev",
|
|
120
124
|
"lib:build": "pnpm build-lib && pnpm build-locales",
|
|
121
125
|
"lib:build-locales": "node build-locales.mjs",
|
|
122
|
-
"lib:build-lib": "
|
|
123
|
-
"lib:dev": "
|
|
126
|
+
"lib:build-lib": "tsdown && size-limit",
|
|
127
|
+
"lib:dev": "tsdown --watch",
|
|
124
128
|
"lint": "eslint .",
|
|
125
129
|
"size": "size-limit",
|
|
126
130
|
"test": "vitest run",
|
|
@@ -29,7 +29,6 @@ export const MRT_TableBody = <TData extends MRT_RowData>({
|
|
|
29
29
|
getBottomRows,
|
|
30
30
|
getIsSomeRowsPinned,
|
|
31
31
|
getRowModel,
|
|
32
|
-
getState,
|
|
33
32
|
getTopRows,
|
|
34
33
|
options: {
|
|
35
34
|
enableStickyFooter,
|
|
@@ -44,7 +43,7 @@ export const MRT_TableBody = <TData extends MRT_RowData>({
|
|
|
44
43
|
},
|
|
45
44
|
refs: { tableFooterRef, tableHeadRef, tablePaperRef },
|
|
46
45
|
} = table;
|
|
47
|
-
const { columnFilters, globalFilter, isFullScreen, rowPinning } =
|
|
46
|
+
const { columnFilters, globalFilter, isFullScreen, rowPinning } = table.state;
|
|
48
47
|
|
|
49
48
|
const tableBodyProps = {
|
|
50
49
|
...parseFromValuesOrFunc(muiTableBodyProps, { table }),
|
|
@@ -48,7 +48,6 @@ export const MRT_TableBodyCell = <TData extends MRT_RowData>({
|
|
|
48
48
|
}: MRT_TableBodyCellProps<TData>) => {
|
|
49
49
|
const theme = useTheme();
|
|
50
50
|
const {
|
|
51
|
-
getState,
|
|
52
51
|
options: {
|
|
53
52
|
columnResizeDirection,
|
|
54
53
|
columnResizeMode,
|
|
@@ -69,7 +68,7 @@ export const MRT_TableBodyCell = <TData extends MRT_RowData>({
|
|
|
69
68
|
} = table;
|
|
70
69
|
const {
|
|
71
70
|
actionCell,
|
|
72
|
-
|
|
71
|
+
columnResizing,
|
|
73
72
|
creatingRow,
|
|
74
73
|
density,
|
|
75
74
|
draggingColumn,
|
|
@@ -80,7 +79,7 @@ export const MRT_TableBodyCell = <TData extends MRT_RowData>({
|
|
|
80
79
|
hoveredRow,
|
|
81
80
|
isLoading,
|
|
82
81
|
showSkeletons,
|
|
83
|
-
} =
|
|
82
|
+
} = table.state;
|
|
84
83
|
const { column, row } = cell;
|
|
85
84
|
const { columnDef } = column;
|
|
86
85
|
const { columnDefType } = columnDef;
|
|
@@ -118,7 +117,7 @@ export const MRT_TableBodyCell = <TData extends MRT_RowData>({
|
|
|
118
117
|
const isFirstColumn = column.getIsFirstColumn();
|
|
119
118
|
const isLastColumn = column.getIsLastColumn();
|
|
120
119
|
const isLastRow = numRows && staticRowIndex === numRows - 1;
|
|
121
|
-
const isResizingColumn =
|
|
120
|
+
const isResizingColumn = columnResizing.isResizingColumn === column.id;
|
|
122
121
|
const showResizeBorder =
|
|
123
122
|
isResizingColumn && columnResizeMode === 'onChange';
|
|
124
123
|
|
|
@@ -158,7 +157,7 @@ export const MRT_TableBodyCell = <TData extends MRT_RowData>({
|
|
|
158
157
|
}
|
|
159
158
|
: undefined;
|
|
160
159
|
}, [
|
|
161
|
-
|
|
160
|
+
columnResizing.isResizingColumn,
|
|
162
161
|
draggingColumn,
|
|
163
162
|
draggingRow,
|
|
164
163
|
hoveredColumn,
|
|
@@ -26,7 +26,6 @@ export const MRT_TableBodyCellValue = <TData extends MRT_RowData>({
|
|
|
26
26
|
table,
|
|
27
27
|
}: MRT_TableBodyCellValueProps<TData>) => {
|
|
28
28
|
const {
|
|
29
|
-
getState,
|
|
30
29
|
options: {
|
|
31
30
|
enableFilterMatchHighlighting,
|
|
32
31
|
mrtTheme: { matchHighlightColor },
|
|
@@ -34,7 +33,7 @@ export const MRT_TableBodyCellValue = <TData extends MRT_RowData>({
|
|
|
34
33
|
} = table;
|
|
35
34
|
const { column, row } = cell;
|
|
36
35
|
const { columnDef } = column;
|
|
37
|
-
const { globalFilter, globalFilterFn } =
|
|
36
|
+
const { globalFilter, globalFilterFn } = table.state;
|
|
38
37
|
const filterValue = column.getFilterValue();
|
|
39
38
|
|
|
40
39
|
let renderedCellValue =
|
|
@@ -47,7 +47,6 @@ export const MRT_TableBodyRow = <TData extends MRT_RowData>({
|
|
|
47
47
|
const theme = useTheme();
|
|
48
48
|
|
|
49
49
|
const {
|
|
50
|
-
getState,
|
|
51
50
|
options: {
|
|
52
51
|
enableRowOrdering,
|
|
53
52
|
enableRowPinning,
|
|
@@ -76,7 +75,7 @@ export const MRT_TableBodyRow = <TData extends MRT_RowData>({
|
|
|
76
75
|
hoveredRow,
|
|
77
76
|
isFullScreen,
|
|
78
77
|
rowPinning,
|
|
79
|
-
} =
|
|
78
|
+
} = table.state;
|
|
80
79
|
|
|
81
80
|
const visibleCells = row.getVisibleCells();
|
|
82
81
|
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { fireEvent, render } from '@testing-library/react';
|
|
2
|
+
import { describe, expect, test, vi } from 'vitest';
|
|
3
|
+
|
|
4
|
+
import { type MRT_ColumnDef } from '../../types';
|
|
5
|
+
import { MaterialReactTable } from '../MaterialReactTable';
|
|
6
|
+
|
|
7
|
+
interface Person {
|
|
8
|
+
name: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const data: Person[] = [{ name: 'Alice' }, { name: 'Bob' }];
|
|
12
|
+
|
|
13
|
+
const columns = (): MRT_ColumnDef<Person>[] => [
|
|
14
|
+
{ accessorKey: 'name', header: 'Name' },
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
describe('row ordering', () => {
|
|
18
|
+
test('dragging a row over another reports both rows to the drop handler', () => {
|
|
19
|
+
const muiRowDragHandleProps = { onDragEnd: vi.fn() };
|
|
20
|
+
const { container } = render(
|
|
21
|
+
<MaterialReactTable
|
|
22
|
+
columns={columns()}
|
|
23
|
+
data={data}
|
|
24
|
+
enableRowOrdering
|
|
25
|
+
muiRowDragHandleProps={muiRowDragHandleProps}
|
|
26
|
+
/>,
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const handles = container.querySelectorAll<HTMLElement>(
|
|
30
|
+
'tbody button[aria-label="Move"]',
|
|
31
|
+
);
|
|
32
|
+
const rows = container.querySelectorAll<HTMLElement>('tbody tr');
|
|
33
|
+
|
|
34
|
+
fireEvent.dragStart(handles[0], {
|
|
35
|
+
dataTransfer: { setDragImage: () => {} },
|
|
36
|
+
});
|
|
37
|
+
fireEvent.dragEnter(rows[1]);
|
|
38
|
+
fireEvent.dragEnd(handles[0]);
|
|
39
|
+
|
|
40
|
+
expect(muiRowDragHandleProps.onDragEnd).toHaveBeenCalled();
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -21,10 +21,9 @@ export const MRT_TableBodyRowPinButton = <TData extends MRT_RowData>({
|
|
|
21
21
|
...rest
|
|
22
22
|
}: MRT_TableBodyRowPinButtonProps<TData>) => {
|
|
23
23
|
const {
|
|
24
|
-
getState,
|
|
25
24
|
options: { enableRowPinning, rowPinningDisplayMode },
|
|
26
25
|
} = table;
|
|
27
|
-
const { density } =
|
|
26
|
+
const { density } = table.state;
|
|
28
27
|
|
|
29
28
|
const canPin = parseFromValuesOrFunc(enableRowPinning, row as any);
|
|
30
29
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { render } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { describe, expect, test } from 'vitest';
|
|
4
|
+
|
|
5
|
+
import { type MRT_ColumnDef } from '../../types';
|
|
6
|
+
import { MaterialReactTable } from '../MaterialReactTable';
|
|
7
|
+
|
|
8
|
+
interface Person {
|
|
9
|
+
city: string;
|
|
10
|
+
name: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const data: Person[] = [{ city: 'Glasgow', name: 'Alice' }];
|
|
14
|
+
|
|
15
|
+
const columns = (): MRT_ColumnDef<Person>[] => [
|
|
16
|
+
{ accessorKey: 'name', header: 'Name' },
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
describe('detail panel', () => {
|
|
20
|
+
test('reveals the panel content when the expand button is clicked', async () => {
|
|
21
|
+
const user = userEvent.setup();
|
|
22
|
+
const { container } = render(
|
|
23
|
+
<MaterialReactTable
|
|
24
|
+
columns={columns()}
|
|
25
|
+
data={data}
|
|
26
|
+
renderDetailPanel={({ row }) => (
|
|
27
|
+
<span>Lives in {row.original.city}</span>
|
|
28
|
+
)}
|
|
29
|
+
/>,
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
expect(container.textContent).not.toContain('Lives in Glasgow');
|
|
33
|
+
|
|
34
|
+
await user.click(
|
|
35
|
+
container.querySelector('tbody button[aria-label="Expand"]') as HTMLElement,
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
expect(container.textContent).toContain('Lives in Glasgow');
|
|
39
|
+
});
|
|
40
|
+
});
|
|
@@ -32,7 +32,6 @@ export const MRT_TableDetailPanel = <TData extends MRT_RowData>({
|
|
|
32
32
|
...rest
|
|
33
33
|
}: MRT_TableDetailPanelProps<TData>) => {
|
|
34
34
|
const {
|
|
35
|
-
getState,
|
|
36
35
|
getVisibleLeafColumns,
|
|
37
36
|
options: {
|
|
38
37
|
layoutMode,
|
|
@@ -42,7 +41,7 @@ export const MRT_TableDetailPanel = <TData extends MRT_RowData>({
|
|
|
42
41
|
renderDetailPanel,
|
|
43
42
|
},
|
|
44
43
|
} = table;
|
|
45
|
-
const { isLoading } =
|
|
44
|
+
const { isLoading } = table.state;
|
|
46
45
|
|
|
47
46
|
const tableRowProps = parseFromValuesOrFunc(muiTableBodyRowProps, {
|
|
48
47
|
isDetailPanel: true,
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { render } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { describe, expect, test } from 'vitest';
|
|
4
|
+
|
|
5
|
+
import { type MRT_ColumnDef } from '../../types';
|
|
6
|
+
import { MaterialReactTable } from '../MaterialReactTable';
|
|
7
|
+
|
|
8
|
+
interface Person {
|
|
9
|
+
city: string;
|
|
10
|
+
name: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const data: Person[] = [{ city: 'Glasgow', name: 'Alice' }];
|
|
14
|
+
|
|
15
|
+
const columns = (): MRT_ColumnDef<Person>[] => [
|
|
16
|
+
{ accessorKey: 'name', header: 'Name' },
|
|
17
|
+
{ accessorKey: 'city', header: 'City' },
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
const headerOrder = (container: HTMLElement) =>
|
|
21
|
+
Array.from(container.querySelectorAll('thead th')).map((th) =>
|
|
22
|
+
th.textContent?.replace(/[^A-Za-z]/g, ''),
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
describe('column pinning', () => {
|
|
26
|
+
test('pinning to start moves the column to the front', async () => {
|
|
27
|
+
const user = userEvent.setup();
|
|
28
|
+
const { baseElement, container } = render(
|
|
29
|
+
<MaterialReactTable
|
|
30
|
+
columns={columns()}
|
|
31
|
+
data={data}
|
|
32
|
+
enableColumnPinning
|
|
33
|
+
/>,
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
expect(headerOrder(container)).toEqual(['Name', 'City']);
|
|
37
|
+
|
|
38
|
+
const cityHeader = Array.from(
|
|
39
|
+
container.querySelectorAll<HTMLElement>('thead th'),
|
|
40
|
+
).find((th) => th.textContent?.includes('City'));
|
|
41
|
+
|
|
42
|
+
await user.click(
|
|
43
|
+
cityHeader?.querySelector(
|
|
44
|
+
'button[aria-label="Column Actions"]',
|
|
45
|
+
) as HTMLElement,
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
await user.click(
|
|
49
|
+
Array.from(baseElement.querySelectorAll<HTMLElement>('li')).find((li) =>
|
|
50
|
+
li.textContent?.includes('Pin to left'),
|
|
51
|
+
) as HTMLElement,
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
expect(headerOrder(container)).toEqual(['City', 'Name']);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test('start and end pinning both apply from initial state', () => {
|
|
58
|
+
const { container } = render(
|
|
59
|
+
<MaterialReactTable
|
|
60
|
+
columns={columns()}
|
|
61
|
+
data={data}
|
|
62
|
+
enableColumnPinning
|
|
63
|
+
initialState={{ columnPinning: { end: ['name'], start: ['city'] } }}
|
|
64
|
+
/>,
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
expect(headerOrder(container)).toEqual(['City', 'Name']);
|
|
68
|
+
});
|
|
69
|
+
});
|