@careharmony/mantine-react-table-ng 0.0.0-stage → 4.0.0-beta.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 +217 -3
- package/dist/index.cjs +4023 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1488 -0
- package/dist/index.esm.d.mts +1488 -0
- package/dist/index.esm.mjs +3909 -0
- package/dist/index.esm.mjs.map +1 -0
- package/locales/ar/index.cjs +97 -0
- package/locales/ar/index.d.cts +3 -0
- package/locales/ar/index.esm.d.mts +3 -0
- package/locales/ar/index.esm.mjs +95 -0
- package/locales/ar/package.json +19 -0
- package/locales/az/index.cjs +97 -0
- package/locales/az/index.d.cts +3 -0
- package/locales/az/index.esm.d.mts +3 -0
- package/locales/az/index.esm.mjs +95 -0
- package/locales/az/package.json +19 -0
- package/locales/bg/index.cjs +97 -0
- package/locales/bg/index.d.cts +3 -0
- package/locales/bg/index.esm.d.mts +3 -0
- package/locales/bg/index.esm.mjs +95 -0
- package/locales/bg/package.json +19 -0
- package/locales/cs/index.cjs +97 -0
- package/locales/cs/index.d.cts +3 -0
- package/locales/cs/index.esm.d.mts +3 -0
- package/locales/cs/index.esm.mjs +95 -0
- package/locales/cs/package.json +19 -0
- package/locales/da/index.cjs +97 -0
- package/locales/da/index.d.cts +3 -0
- package/locales/da/index.esm.d.mts +3 -0
- package/locales/da/index.esm.mjs +95 -0
- package/locales/da/package.json +19 -0
- package/locales/de/index.cjs +97 -0
- package/locales/de/index.d.cts +3 -0
- package/locales/de/index.esm.d.mts +3 -0
- package/locales/de/index.esm.mjs +95 -0
- package/locales/de/package.json +19 -0
- package/locales/el/index.cjs +97 -0
- package/locales/el/index.d.cts +3 -0
- package/locales/el/index.esm.d.mts +3 -0
- package/locales/el/index.esm.mjs +95 -0
- package/locales/el/package.json +19 -0
- package/locales/en/index.cjs +97 -0
- package/locales/en/index.d.cts +3 -0
- package/locales/en/index.esm.d.mts +3 -0
- package/locales/en/index.esm.mjs +95 -0
- package/locales/en/package.json +19 -0
- package/locales/es/index.cjs +97 -0
- package/locales/es/index.d.cts +3 -0
- package/locales/es/index.esm.d.mts +3 -0
- package/locales/es/index.esm.mjs +95 -0
- package/locales/es/package.json +19 -0
- package/locales/et/index.cjs +97 -0
- package/locales/et/index.d.cts +3 -0
- package/locales/et/index.esm.d.mts +3 -0
- package/locales/et/index.esm.mjs +95 -0
- package/locales/et/package.json +19 -0
- package/locales/fa/index.cjs +97 -0
- package/locales/fa/index.d.cts +3 -0
- package/locales/fa/index.esm.d.mts +3 -0
- package/locales/fa/index.esm.mjs +95 -0
- package/locales/fa/package.json +19 -0
- package/locales/fi/index.cjs +97 -0
- package/locales/fi/index.d.cts +3 -0
- package/locales/fi/index.esm.d.mts +3 -0
- package/locales/fi/index.esm.mjs +95 -0
- package/locales/fi/package.json +19 -0
- package/locales/fr/index.cjs +97 -0
- package/locales/fr/index.d.cts +3 -0
- package/locales/fr/index.esm.d.mts +3 -0
- package/locales/fr/index.esm.mjs +95 -0
- package/locales/fr/package.json +19 -0
- package/locales/he/index.cjs +97 -0
- package/locales/he/index.d.cts +3 -0
- package/locales/he/index.esm.d.mts +3 -0
- package/locales/he/index.esm.mjs +95 -0
- package/locales/he/package.json +19 -0
- package/locales/hr/index.cjs +97 -0
- package/locales/hr/index.d.cts +3 -0
- package/locales/hr/index.esm.d.mts +3 -0
- package/locales/hr/index.esm.mjs +95 -0
- package/locales/hr/package.json +19 -0
- package/locales/hu/index.cjs +97 -0
- package/locales/hu/index.d.cts +3 -0
- package/locales/hu/index.esm.d.mts +3 -0
- package/locales/hu/index.esm.mjs +95 -0
- package/locales/hu/package.json +19 -0
- package/locales/hy/index.cjs +97 -0
- package/locales/hy/index.d.cts +3 -0
- package/locales/hy/index.esm.d.mts +3 -0
- package/locales/hy/index.esm.mjs +95 -0
- package/locales/hy/package.json +19 -0
- package/locales/id/index.cjs +97 -0
- package/locales/id/index.d.cts +3 -0
- package/locales/id/index.esm.d.mts +3 -0
- package/locales/id/index.esm.mjs +95 -0
- package/locales/id/package.json +19 -0
- package/locales/it/index.cjs +97 -0
- package/locales/it/index.d.cts +3 -0
- package/locales/it/index.esm.d.mts +3 -0
- package/locales/it/index.esm.mjs +95 -0
- package/locales/it/package.json +19 -0
- package/locales/ja/index.cjs +97 -0
- package/locales/ja/index.d.cts +3 -0
- package/locales/ja/index.esm.d.mts +3 -0
- package/locales/ja/index.esm.mjs +95 -0
- package/locales/ja/package.json +19 -0
- package/locales/ko/index.cjs +97 -0
- package/locales/ko/index.d.cts +3 -0
- package/locales/ko/index.esm.d.mts +3 -0
- package/locales/ko/index.esm.mjs +95 -0
- package/locales/ko/package.json +19 -0
- package/locales/nl/index.cjs +97 -0
- package/locales/nl/index.d.cts +3 -0
- package/locales/nl/index.esm.d.mts +3 -0
- package/locales/nl/index.esm.mjs +95 -0
- package/locales/nl/package.json +19 -0
- package/locales/no/index.cjs +97 -0
- package/locales/no/index.d.cts +3 -0
- package/locales/no/index.esm.d.mts +3 -0
- package/locales/no/index.esm.mjs +95 -0
- package/locales/no/package.json +19 -0
- package/locales/np/index.cjs +97 -0
- package/locales/np/index.d.cts +3 -0
- package/locales/np/index.esm.d.mts +3 -0
- package/locales/np/index.esm.mjs +95 -0
- package/locales/np/package.json +19 -0
- package/locales/pl/index.cjs +97 -0
- package/locales/pl/index.d.cts +3 -0
- package/locales/pl/index.esm.d.mts +3 -0
- package/locales/pl/index.esm.mjs +95 -0
- package/locales/pl/package.json +19 -0
- package/locales/pt/index.cjs +97 -0
- package/locales/pt/index.d.cts +3 -0
- package/locales/pt/index.esm.d.mts +3 -0
- package/locales/pt/index.esm.mjs +95 -0
- package/locales/pt/package.json +19 -0
- package/locales/pt-BR/index.cjs +97 -0
- package/locales/pt-BR/index.d.cts +3 -0
- package/locales/pt-BR/index.esm.d.mts +3 -0
- package/locales/pt-BR/index.esm.mjs +95 -0
- package/locales/pt-BR/package.json +19 -0
- package/locales/ro/index.cjs +97 -0
- package/locales/ro/index.d.cts +3 -0
- package/locales/ro/index.esm.d.mts +3 -0
- package/locales/ro/index.esm.mjs +95 -0
- package/locales/ro/package.json +19 -0
- package/locales/ru/index.cjs +97 -0
- package/locales/ru/index.d.cts +3 -0
- package/locales/ru/index.esm.d.mts +3 -0
- package/locales/ru/index.esm.mjs +95 -0
- package/locales/ru/package.json +19 -0
- package/locales/sk/index.cjs +97 -0
- package/locales/sk/index.d.cts +3 -0
- package/locales/sk/index.esm.d.mts +3 -0
- package/locales/sk/index.esm.mjs +95 -0
- package/locales/sk/package.json +19 -0
- package/locales/sr-Cyrl-RS/index.cjs +97 -0
- package/locales/sr-Cyrl-RS/index.d.cts +3 -0
- package/locales/sr-Cyrl-RS/index.esm.d.mts +3 -0
- package/locales/sr-Cyrl-RS/index.esm.mjs +95 -0
- package/locales/sr-Cyrl-RS/package.json +19 -0
- package/locales/sr-Latn-RS/index.cjs +97 -0
- package/locales/sr-Latn-RS/index.d.cts +3 -0
- package/locales/sr-Latn-RS/index.esm.d.mts +3 -0
- package/locales/sr-Latn-RS/index.esm.mjs +95 -0
- package/locales/sr-Latn-RS/package.json +19 -0
- package/locales/sv/index.cjs +97 -0
- package/locales/sv/index.d.cts +3 -0
- package/locales/sv/index.esm.d.mts +3 -0
- package/locales/sv/index.esm.mjs +95 -0
- package/locales/sv/package.json +19 -0
- package/locales/th/index.cjs +97 -0
- package/locales/th/index.d.cts +3 -0
- package/locales/th/index.esm.d.mts +3 -0
- package/locales/th/index.esm.mjs +95 -0
- package/locales/th/package.json +19 -0
- package/locales/tr/index.cjs +97 -0
- package/locales/tr/index.d.cts +3 -0
- package/locales/tr/index.esm.d.mts +3 -0
- package/locales/tr/index.esm.mjs +95 -0
- package/locales/tr/package.json +19 -0
- package/locales/uk/index.cjs +97 -0
- package/locales/uk/index.d.cts +3 -0
- package/locales/uk/index.esm.d.mts +3 -0
- package/locales/uk/index.esm.mjs +95 -0
- package/locales/uk/package.json +19 -0
- package/locales/vi/index.cjs +97 -0
- package/locales/vi/index.d.cts +3 -0
- package/locales/vi/index.esm.d.mts +3 -0
- package/locales/vi/index.esm.mjs +95 -0
- package/locales/vi/package.json +19 -0
- package/locales/zh-Hans/index.cjs +97 -0
- package/locales/zh-Hans/index.d.cts +3 -0
- package/locales/zh-Hans/index.esm.d.mts +3 -0
- package/locales/zh-Hans/index.esm.mjs +95 -0
- package/locales/zh-Hans/package.json +19 -0
- package/locales/zh-Hant/index.cjs +97 -0
- package/locales/zh-Hant/index.d.cts +3 -0
- package/locales/zh-Hant/index.esm.d.mts +3 -0
- package/locales/zh-Hant/index.esm.mjs +95 -0
- package/locales/zh-Hant/package.json +19 -0
- package/package.json +184 -4
- package/src/components/MantineReactTable.tsx +38 -0
- package/src/components/body/MRT_TableBody.module.css +42 -0
- package/src/components/body/MRT_TableBody.tsx +214 -0
- package/src/components/body/MRT_TableBodyCell.module.css +107 -0
- package/src/components/body/MRT_TableBodyCell.tsx +355 -0
- package/src/components/body/MRT_TableBodyCellValue.tsx +114 -0
- package/src/components/body/MRT_TableBodyEmptyRow.tsx +89 -0
- package/src/components/body/MRT_TableBodyRow.module.css +261 -0
- package/src/components/body/MRT_TableBodyRow.tsx +278 -0
- package/src/components/body/MRT_TableBodyRowGrabHandle.tsx +59 -0
- package/src/components/body/MRT_TableBodyRowPinButton.tsx +59 -0
- package/src/components/body/MRT_TableDetailPanel.module.css +35 -0
- package/src/components/body/MRT_TableDetailPanel.tsx +132 -0
- package/src/components/buttons/MRT_ColumnPinningButtons.module.css +11 -0
- package/src/components/buttons/MRT_ColumnPinningButtons.tsx +69 -0
- package/src/components/buttons/MRT_CopyButton.module.css +27 -0
- package/src/components/buttons/MRT_CopyButton.tsx +84 -0
- package/src/components/buttons/MRT_EditActionButtons.module.css +4 -0
- package/src/components/buttons/MRT_EditActionButtons.tsx +139 -0
- package/src/components/buttons/MRT_ExpandAllButton.module.css +26 -0
- package/src/components/buttons/MRT_ExpandAllButton.tsx +84 -0
- package/src/components/buttons/MRT_ExpandButton.module.css +37 -0
- package/src/components/buttons/MRT_ExpandButton.tsx +121 -0
- package/src/components/buttons/MRT_GrabHandleButton.module.css +6 -0
- package/src/components/buttons/MRT_GrabHandleButton.tsx +65 -0
- package/src/components/buttons/MRT_RowPinButton.tsx +84 -0
- package/src/components/buttons/MRT_ShowHideColumnsButton.tsx +46 -0
- package/src/components/buttons/MRT_ToggleDensePaddingButton.tsx +66 -0
- package/src/components/buttons/MRT_ToggleFiltersButton.tsx +45 -0
- package/src/components/buttons/MRT_ToggleFullScreenButton.tsx +59 -0
- package/src/components/buttons/MRT_ToggleGlobalFilterButton.tsx +52 -0
- package/src/components/buttons/MRT_ToggleRowActionMenuButton.tsx +87 -0
- package/src/components/footer/MRT_TableFooter.module.css +17 -0
- package/src/components/footer/MRT_TableFooter.tsx +70 -0
- package/src/components/footer/MRT_TableFooterCell.module.css +59 -0
- package/src/components/footer/MRT_TableFooterCell.tsx +126 -0
- package/src/components/footer/MRT_TableFooterRow.module.css +10 -0
- package/src/components/footer/MRT_TableFooterRow.tsx +111 -0
- package/src/components/head/MRT_TableHead.module.css +32 -0
- package/src/components/head/MRT_TableHead.tsx +106 -0
- package/src/components/head/MRT_TableHeadCell.module.css +172 -0
- package/src/components/head/MRT_TableHeadCell.tsx +317 -0
- package/src/components/head/MRT_TableHeadCellFilterContainer.module.css +5 -0
- package/src/components/head/MRT_TableHeadCellFilterContainer.tsx +123 -0
- package/src/components/head/MRT_TableHeadCellFilterLabel.module.css +14 -0
- package/src/components/head/MRT_TableHeadCellFilterLabel.tsx +176 -0
- package/src/components/head/MRT_TableHeadCellGrabHandle.tsx +82 -0
- package/src/components/head/MRT_TableHeadCellResizeHandle.module.css +44 -0
- package/src/components/head/MRT_TableHeadCellResizeHandle.tsx +68 -0
- package/src/components/head/MRT_TableHeadCellSortLabel.module.css +22 -0
- package/src/components/head/MRT_TableHeadCellSortLabel.tsx +90 -0
- package/src/components/head/MRT_TableHeadRow.module.css +12 -0
- package/src/components/head/MRT_TableHeadRow.tsx +105 -0
- package/src/components/inputs/MRT_EditCellTextInput.tsx +214 -0
- package/src/components/inputs/MRT_FilterCheckBox.module.css +4 -0
- package/src/components/inputs/MRT_FilterCheckbox.tsx +80 -0
- package/src/components/inputs/MRT_FilterRangeFields.module.css +5 -0
- package/src/components/inputs/MRT_FilterRangeFields.tsx +36 -0
- package/src/components/inputs/MRT_FilterRangeSlider.module.css +6 -0
- package/src/components/inputs/MRT_FilterRangeSlider.tsx +107 -0
- package/src/components/inputs/MRT_FilterTextInput.module.css +27 -0
- package/src/components/inputs/MRT_FilterTextInput.tsx +418 -0
- package/src/components/inputs/MRT_GlobalFilterTextInput.module.css +11 -0
- package/src/components/inputs/MRT_GlobalFilterTextInput.tsx +142 -0
- package/src/components/inputs/MRT_SelectCheckbox.tsx +138 -0
- package/src/components/menus/MRT_ColumnActionMenu.module.css +7 -0
- package/src/components/menus/MRT_ColumnActionMenu.tsx +288 -0
- package/src/components/menus/MRT_FilterOptionMenu.module.css +6 -0
- package/src/components/menus/MRT_FilterOptionMenu.tsx +279 -0
- package/src/components/menus/MRT_RowActionMenu.tsx +75 -0
- package/src/components/menus/MRT_ShowHideColumnsMenu.module.css +10 -0
- package/src/components/menus/MRT_ShowHideColumnsMenu.tsx +136 -0
- package/src/components/menus/MRT_ShowHideColumnsMenuItems.module.css +35 -0
- package/src/components/menus/MRT_ShowHideColumnsMenuItems.tsx +171 -0
- package/src/components/modals/MRT_EditRowModal.tsx +98 -0
- package/src/components/table/MRT_Table.module.css +7 -0
- package/src/components/table/MRT_Table.tsx +155 -0
- package/src/components/table/MRT_TableContainer.module.css +32 -0
- package/src/components/table/MRT_TableContainer.tsx +124 -0
- package/src/components/table/MRT_TablePaper.module.css +88 -0
- package/src/components/table/MRT_TablePaper.tsx +91 -0
- package/src/components/toolbar/MRT_BottomToolbar.module.css +40 -0
- package/src/components/toolbar/MRT_BottomToolbar.tsx +99 -0
- package/src/components/toolbar/MRT_ProgressBar.module.css +10 -0
- package/src/components/toolbar/MRT_ProgressBar.tsx +54 -0
- package/src/components/toolbar/MRT_TablePagination.module.css +20 -0
- package/src/components/toolbar/MRT_TablePagination.tsx +175 -0
- package/src/components/toolbar/MRT_ToolbarAlertBanner.module.css +37 -0
- package/src/components/toolbar/MRT_ToolbarAlertBanner.tsx +169 -0
- package/src/components/toolbar/MRT_ToolbarDropZone.module.css +23 -0
- package/src/components/toolbar/MRT_ToolbarDropZone.tsx +68 -0
- package/src/components/toolbar/MRT_ToolbarInternalButtons.module.css +6 -0
- package/src/components/toolbar/MRT_ToolbarInternalButtons.tsx +74 -0
- package/src/components/toolbar/MRT_TopToolbar.module.css +24 -0
- package/src/components/toolbar/MRT_TopToolbar.tsx +127 -0
- package/src/components/toolbar/common.styles.module.css +10 -0
- package/src/fns/aggregationFns.ts +3 -0
- package/src/fns/filterFns.ts +243 -0
- package/src/fns/sortingFns.ts +34 -0
- package/src/hooks/display-columns/getMRT_RowActionsColumnDef.tsx +25 -0
- package/src/hooks/display-columns/getMRT_RowDragColumnDef.tsx +32 -0
- package/src/hooks/display-columns/getMRT_RowExpandColumnDef.tsx +94 -0
- package/src/hooks/display-columns/getMRT_RowNumbersColumnDef.tsx +32 -0
- package/src/hooks/display-columns/getMRT_RowPinningColumnDef.tsx +26 -0
- package/src/hooks/display-columns/getMRT_RowSelectColumnDef.tsx +36 -0
- package/src/hooks/display-columns/getMRT_RowSpacerColumnDef.tsx +36 -0
- package/src/hooks/useMRT_ColumnVirtualizer.ts +135 -0
- package/src/hooks/useMRT_Effects.ts +109 -0
- package/src/hooks/useMRT_RowVirtualizer.ts +101 -0
- package/src/hooks/useMRT_Rows.ts +47 -0
- package/src/hooks/useMRT_TableInstance.ts +320 -0
- package/src/hooks/useMRT_TableOptions.ts +300 -0
- package/src/hooks/useMRT_TableSnapshot.ts +134 -0
- package/src/hooks/useMRT_VirtualizerScrollElement.ts +31 -0
- package/src/hooks/useMantineReactTable.ts +23 -0
- package/src/icons.ts +108 -0
- package/src/index.ts +91 -0
- package/src/locales/ar.ts +96 -0
- package/src/locales/az.ts +96 -0
- package/src/locales/bg.ts +96 -0
- package/src/locales/cs.ts +97 -0
- package/src/locales/da.ts +96 -0
- package/src/locales/de.ts +96 -0
- package/src/locales/el.ts +96 -0
- package/src/locales/en.ts +96 -0
- package/src/locales/es.ts +96 -0
- package/src/locales/et.ts +97 -0
- package/src/locales/fa.ts +96 -0
- package/src/locales/fi.ts +97 -0
- package/src/locales/fr.ts +96 -0
- package/src/locales/he.ts +96 -0
- package/src/locales/hr.ts +96 -0
- package/src/locales/hu.ts +96 -0
- package/src/locales/hy.ts +96 -0
- package/src/locales/id.ts +97 -0
- package/src/locales/it.ts +96 -0
- package/src/locales/ja.ts +96 -0
- package/src/locales/ko.ts +96 -0
- package/src/locales/nl.ts +96 -0
- package/src/locales/no.ts +97 -0
- package/src/locales/np.ts +97 -0
- package/src/locales/pl.ts +96 -0
- package/src/locales/pt-BR.ts +96 -0
- package/src/locales/pt.ts +96 -0
- package/src/locales/ro.ts +96 -0
- package/src/locales/ru.ts +96 -0
- package/src/locales/sk.ts +97 -0
- package/src/locales/sr-Cyrl-RS.ts +96 -0
- package/src/locales/sr-Latn-RS.ts +96 -0
- package/src/locales/sv.ts +96 -0
- package/src/locales/th.ts +97 -0
- package/src/locales/tr.ts +96 -0
- package/src/locales/uk.ts +96 -0
- package/src/locales/vi.ts +96 -0
- package/src/locales/zh-Hans.ts +95 -0
- package/src/locales/zh-Hant.ts +95 -0
- package/src/types.ts +1299 -0
- package/src/typings.d.ts +1 -0
- package/src/utils/column.utils.ts +157 -0
- package/src/utils/displayColumn.utils.ts +153 -0
- package/src/utils/row.utils.ts +263 -0
- package/src/utils/snapshot.utils.ts +97 -0
- package/src/utils/style.utils.ts +32 -0
- package/src/utils/tanstack.helpers.ts +66 -0
- package/src/utils/utils.ts +15 -0
- package/src/utils/virtualization.utils.ts +85 -0
- package/styles.css +1381 -0
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
'use no memo';
|
|
2
|
+
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
type Column,
|
|
7
|
+
getCoreRowModel,
|
|
8
|
+
getExpandedRowModel,
|
|
9
|
+
getFacetedMinMaxValues,
|
|
10
|
+
getFacetedRowModel,
|
|
11
|
+
getFacetedUniqueValues,
|
|
12
|
+
getFilteredRowModel,
|
|
13
|
+
getGroupedRowModel,
|
|
14
|
+
getPaginationRowModel,
|
|
15
|
+
getSortedRowModel,
|
|
16
|
+
} from '@tanstack/react-table';
|
|
17
|
+
|
|
18
|
+
import { useDirection } from '@mantine/core';
|
|
19
|
+
|
|
20
|
+
import { MRT_AggregationFns } from '../fns/aggregationFns';
|
|
21
|
+
import { MRT_FilterFns } from '../fns/filterFns';
|
|
22
|
+
import { MRT_SortingFns } from '../fns/sortingFns';
|
|
23
|
+
import { MRT_Default_Icons } from '../icons';
|
|
24
|
+
import { MRT_Localization_EN } from '../locales/en';
|
|
25
|
+
import {
|
|
26
|
+
type MRT_DefinedTableOptions,
|
|
27
|
+
type MRT_RowData,
|
|
28
|
+
type MRT_TableOptions,
|
|
29
|
+
} from '../types';
|
|
30
|
+
|
|
31
|
+
export const MRT_DefaultColumn = {
|
|
32
|
+
filterVariant: 'text',
|
|
33
|
+
maxSize: 1000,
|
|
34
|
+
minSize: 40,
|
|
35
|
+
size: 180,
|
|
36
|
+
} as const;
|
|
37
|
+
|
|
38
|
+
export const MRT_DefaultDisplayColumn = {
|
|
39
|
+
columnDefType: 'display',
|
|
40
|
+
enableClickToCopy: false,
|
|
41
|
+
enableColumnActions: false,
|
|
42
|
+
enableColumnDragging: false,
|
|
43
|
+
enableColumnFilter: false,
|
|
44
|
+
enableColumnOrdering: false,
|
|
45
|
+
enableEditing: false,
|
|
46
|
+
enableGlobalFilter: false,
|
|
47
|
+
enableGrouping: false,
|
|
48
|
+
enableHiding: false,
|
|
49
|
+
enableResizing: false,
|
|
50
|
+
enableSorting: false,
|
|
51
|
+
} as const;
|
|
52
|
+
|
|
53
|
+
const globalFilterValueCache = new WeakMap<object, Map<string, boolean>>();
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Finds the first row with a value in the column and checks that the value is
|
|
57
|
+
* a string or a number. The result is cached for each data array.
|
|
58
|
+
*/
|
|
59
|
+
const getColumnHasGlobalFilterValue = <TData extends MRT_RowData>(
|
|
60
|
+
data: TData[] | undefined,
|
|
61
|
+
column: Column<TData, unknown>,
|
|
62
|
+
): boolean => {
|
|
63
|
+
if (!data?.length || !column.accessorFn) return false;
|
|
64
|
+
let cache = globalFilterValueCache.get(data);
|
|
65
|
+
if (!cache) {
|
|
66
|
+
cache = new Map();
|
|
67
|
+
globalFilterValueCache.set(data, cache);
|
|
68
|
+
}
|
|
69
|
+
let hasValue = cache.get(column.id);
|
|
70
|
+
if (hasValue === undefined) {
|
|
71
|
+
hasValue = false;
|
|
72
|
+
for (let index = 0; index < data.length; index++) {
|
|
73
|
+
const value = column.accessorFn(data[index], index);
|
|
74
|
+
if (value !== null && value !== undefined) {
|
|
75
|
+
hasValue = typeof value === 'string' || typeof value === 'number';
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
cache.set(column.id, hasValue);
|
|
80
|
+
}
|
|
81
|
+
return hasValue;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export const useMRT_TableOptions: <TData extends MRT_RowData>(
|
|
85
|
+
tableOptions: MRT_TableOptions<TData>,
|
|
86
|
+
) => MRT_DefinedTableOptions<TData> = <TData extends MRT_RowData>({
|
|
87
|
+
aggregationFns,
|
|
88
|
+
autoResetExpanded = false,
|
|
89
|
+
columnFilterDisplayMode = 'subheader',
|
|
90
|
+
columnResizeDirection,
|
|
91
|
+
columnResizeMode = 'onChange',
|
|
92
|
+
createDisplayMode = 'modal',
|
|
93
|
+
defaultColumn,
|
|
94
|
+
defaultDisplayColumn,
|
|
95
|
+
editDisplayMode = 'modal',
|
|
96
|
+
enableBatchRowSelection = true,
|
|
97
|
+
enableBottomToolbar = true,
|
|
98
|
+
enableColumnActions = true,
|
|
99
|
+
enableColumnFilters = true,
|
|
100
|
+
enableColumnOrdering = false,
|
|
101
|
+
enableColumnPinning = false,
|
|
102
|
+
enableColumnResizing = false,
|
|
103
|
+
enableColumnVirtualization,
|
|
104
|
+
enableDensityToggle = true,
|
|
105
|
+
enableExpandAll = true,
|
|
106
|
+
enableExpanding,
|
|
107
|
+
enableFacetedValues = false,
|
|
108
|
+
enableFilterMatchHighlighting = true,
|
|
109
|
+
enableFilters = true,
|
|
110
|
+
enableFullScreenToggle = true,
|
|
111
|
+
enableGlobalFilter = true,
|
|
112
|
+
enableGlobalFilterRankedResults = true,
|
|
113
|
+
enableGrouping = false,
|
|
114
|
+
enableHeaderActionsHoverReveal = false,
|
|
115
|
+
enableHiding = true,
|
|
116
|
+
enableMultiRowSelection = true,
|
|
117
|
+
enableMultiSort = true,
|
|
118
|
+
enablePagination = true,
|
|
119
|
+
enableRowPinning = false,
|
|
120
|
+
enableRowSelection = false,
|
|
121
|
+
enableRowVirtualization,
|
|
122
|
+
enableSelectAll = true,
|
|
123
|
+
enableSorting = true,
|
|
124
|
+
enableStickyHeader = false,
|
|
125
|
+
enableTableFooter = true,
|
|
126
|
+
enableTableHead = true,
|
|
127
|
+
enableToolbarInternalActions = true,
|
|
128
|
+
enableTopToolbar = true,
|
|
129
|
+
filterFns,
|
|
130
|
+
icons,
|
|
131
|
+
layoutMode,
|
|
132
|
+
localization,
|
|
133
|
+
manualFiltering,
|
|
134
|
+
manualGrouping,
|
|
135
|
+
manualPagination,
|
|
136
|
+
manualSorting,
|
|
137
|
+
paginationDisplayMode = 'default',
|
|
138
|
+
positionActionsColumn = 'first',
|
|
139
|
+
positionCreatingRow = 'top',
|
|
140
|
+
positionExpandColumn = 'first',
|
|
141
|
+
positionGlobalFilter = 'right',
|
|
142
|
+
positionPagination = 'bottom',
|
|
143
|
+
positionToolbarAlertBanner = 'top',
|
|
144
|
+
positionToolbarDropZone = 'top',
|
|
145
|
+
rowNumberDisplayMode = 'static',
|
|
146
|
+
rowPinningDisplayMode = 'sticky',
|
|
147
|
+
selectAllMode = 'page',
|
|
148
|
+
sortingFns,
|
|
149
|
+
...rest
|
|
150
|
+
}: MRT_TableOptions<TData>) => {
|
|
151
|
+
const direction = useDirection();
|
|
152
|
+
|
|
153
|
+
icons = useMemo(() => ({ ...MRT_Default_Icons, ...icons }), [icons]);
|
|
154
|
+
localization = useMemo(
|
|
155
|
+
() => ({
|
|
156
|
+
...MRT_Localization_EN,
|
|
157
|
+
...localization,
|
|
158
|
+
}),
|
|
159
|
+
[localization],
|
|
160
|
+
);
|
|
161
|
+
aggregationFns = useMemo(
|
|
162
|
+
() => ({ ...MRT_AggregationFns, ...aggregationFns }),
|
|
163
|
+
[],
|
|
164
|
+
);
|
|
165
|
+
filterFns = useMemo(() => ({ ...MRT_FilterFns, ...filterFns }), []);
|
|
166
|
+
sortingFns = useMemo(() => ({ ...MRT_SortingFns, ...sortingFns }), []);
|
|
167
|
+
defaultColumn = useMemo(
|
|
168
|
+
() => ({ ...MRT_DefaultColumn, ...defaultColumn }),
|
|
169
|
+
[defaultColumn],
|
|
170
|
+
);
|
|
171
|
+
defaultDisplayColumn = useMemo(
|
|
172
|
+
() => ({
|
|
173
|
+
...MRT_DefaultDisplayColumn,
|
|
174
|
+
...defaultDisplayColumn,
|
|
175
|
+
}),
|
|
176
|
+
[defaultDisplayColumn],
|
|
177
|
+
);
|
|
178
|
+
//cannot be changed after initialization
|
|
179
|
+
[enableColumnVirtualization, enableRowVirtualization] = useMemo(
|
|
180
|
+
() => [enableColumnVirtualization, enableRowVirtualization],
|
|
181
|
+
[],
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
if (!columnResizeDirection) {
|
|
185
|
+
columnResizeDirection = direction.dir || 'ltr';
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
layoutMode =
|
|
189
|
+
layoutMode || (enableColumnResizing ? 'grid-no-grow' : 'semantic');
|
|
190
|
+
if (
|
|
191
|
+
layoutMode === 'semantic' &&
|
|
192
|
+
(enableRowVirtualization || enableColumnVirtualization)
|
|
193
|
+
) {
|
|
194
|
+
layoutMode = 'grid';
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (enableRowVirtualization) {
|
|
198
|
+
enableStickyHeader = true;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (enablePagination === false && manualPagination === undefined) {
|
|
202
|
+
manualPagination = true;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (!rest.data?.length) {
|
|
206
|
+
manualFiltering = true;
|
|
207
|
+
manualGrouping = true;
|
|
208
|
+
manualPagination = true;
|
|
209
|
+
manualSorting = true;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return {
|
|
213
|
+
aggregationFns,
|
|
214
|
+
autoResetExpanded,
|
|
215
|
+
columnFilterDisplayMode,
|
|
216
|
+
columnResizeDirection,
|
|
217
|
+
columnResizeMode,
|
|
218
|
+
createDisplayMode,
|
|
219
|
+
defaultColumn,
|
|
220
|
+
defaultDisplayColumn,
|
|
221
|
+
editDisplayMode,
|
|
222
|
+
enableBatchRowSelection,
|
|
223
|
+
enableBottomToolbar,
|
|
224
|
+
enableColumnActions,
|
|
225
|
+
enableColumnFilters,
|
|
226
|
+
enableColumnOrdering,
|
|
227
|
+
enableColumnPinning,
|
|
228
|
+
enableColumnResizing,
|
|
229
|
+
enableColumnVirtualization,
|
|
230
|
+
enableDensityToggle,
|
|
231
|
+
enableExpandAll,
|
|
232
|
+
enableExpanding,
|
|
233
|
+
enableFacetedValues,
|
|
234
|
+
enableFilterMatchHighlighting,
|
|
235
|
+
enableFilters,
|
|
236
|
+
enableFullScreenToggle,
|
|
237
|
+
enableGlobalFilter,
|
|
238
|
+
enableGlobalFilterRankedResults,
|
|
239
|
+
enableGrouping,
|
|
240
|
+
enableHeaderActionsHoverReveal,
|
|
241
|
+
enableHiding,
|
|
242
|
+
enableMultiRowSelection,
|
|
243
|
+
enableMultiSort,
|
|
244
|
+
enablePagination,
|
|
245
|
+
enableRowPinning,
|
|
246
|
+
enableRowSelection,
|
|
247
|
+
enableRowVirtualization,
|
|
248
|
+
enableSelectAll,
|
|
249
|
+
enableSorting,
|
|
250
|
+
enableStickyHeader,
|
|
251
|
+
enableTableFooter,
|
|
252
|
+
enableTableHead,
|
|
253
|
+
enableToolbarInternalActions,
|
|
254
|
+
enableTopToolbar,
|
|
255
|
+
filterFns,
|
|
256
|
+
//TanStack only checks the value in the first row, so a null there removes the column from the global filter
|
|
257
|
+
getColumnCanGlobalFilter: (column) =>
|
|
258
|
+
getColumnHasGlobalFilterValue(rest.data, column),
|
|
259
|
+
getCoreRowModel: getCoreRowModel(),
|
|
260
|
+
getExpandedRowModel:
|
|
261
|
+
enableExpanding || enableGrouping ? getExpandedRowModel() : undefined,
|
|
262
|
+
getFacetedMinMaxValues: enableFacetedValues
|
|
263
|
+
? getFacetedMinMaxValues()
|
|
264
|
+
: undefined,
|
|
265
|
+
getFacetedRowModel: enableFacetedValues ? getFacetedRowModel() : undefined,
|
|
266
|
+
getFacetedUniqueValues: enableFacetedValues
|
|
267
|
+
? getFacetedUniqueValues()
|
|
268
|
+
: undefined,
|
|
269
|
+
getFilteredRowModel:
|
|
270
|
+
enableColumnFilters || enableGlobalFilter || enableFilters
|
|
271
|
+
? getFilteredRowModel()
|
|
272
|
+
: undefined,
|
|
273
|
+
getGroupedRowModel: enableGrouping ? getGroupedRowModel() : undefined,
|
|
274
|
+
getPaginationRowModel: enablePagination
|
|
275
|
+
? getPaginationRowModel()
|
|
276
|
+
: undefined,
|
|
277
|
+
getSortedRowModel: enableSorting ? getSortedRowModel() : undefined,
|
|
278
|
+
getSubRows: (row) => row?.subRows,
|
|
279
|
+
icons,
|
|
280
|
+
layoutMode,
|
|
281
|
+
localization,
|
|
282
|
+
manualFiltering,
|
|
283
|
+
manualGrouping,
|
|
284
|
+
manualPagination,
|
|
285
|
+
manualSorting,
|
|
286
|
+
paginationDisplayMode,
|
|
287
|
+
positionActionsColumn,
|
|
288
|
+
positionCreatingRow,
|
|
289
|
+
positionExpandColumn,
|
|
290
|
+
positionGlobalFilter,
|
|
291
|
+
positionPagination,
|
|
292
|
+
positionToolbarAlertBanner,
|
|
293
|
+
positionToolbarDropZone,
|
|
294
|
+
rowNumberDisplayMode,
|
|
295
|
+
rowPinningDisplayMode,
|
|
296
|
+
selectAllMode,
|
|
297
|
+
sortingFns,
|
|
298
|
+
...rest,
|
|
299
|
+
} as MRT_DefinedTableOptions<TData>;
|
|
300
|
+
};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
'use no memo';
|
|
2
|
+
|
|
3
|
+
import { useRef } from 'react';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
type MRT_RowData,
|
|
7
|
+
type MRT_TableInstance,
|
|
8
|
+
type MRT_TableOptions,
|
|
9
|
+
} from '../types';
|
|
10
|
+
import { createMRT_View } from '../utils/snapshot.utils';
|
|
11
|
+
|
|
12
|
+
type Snapshot<TData extends MRT_RowData> = {
|
|
13
|
+
options: Record<string, unknown>;
|
|
14
|
+
state: Record<string, unknown>;
|
|
15
|
+
stateVersion: number;
|
|
16
|
+
table: MRT_TableInstance<TData>;
|
|
17
|
+
version: number;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
//`state` and `initialState` are compared through `table.getState()` instead
|
|
21
|
+
const ignoredOptionKeys = new Set(['initialState', 'state']);
|
|
22
|
+
|
|
23
|
+
const isPlain = (value: unknown): value is Record<string, unknown> => {
|
|
24
|
+
if (typeof value !== 'object' || value === null) return false;
|
|
25
|
+
const prototype = Object.getPrototypeOf(value);
|
|
26
|
+
return (
|
|
27
|
+
prototype === Object.prototype || prototype === null || Array.isArray(value)
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Compares plain objects and arrays by content, `depth` levels deep, and
|
|
33
|
+
* everything else by identity. `table.setSorting([{ desc: false, id: 'name' }])`
|
|
34
|
+
* with the sorting that is already set makes a new array with the same content,
|
|
35
|
+
* and that must not count as a change.
|
|
36
|
+
*/
|
|
37
|
+
const isEqual = (a: unknown, b: unknown, depth: number): boolean => {
|
|
38
|
+
if (Object.is(a, b)) return true;
|
|
39
|
+
if (
|
|
40
|
+
!depth ||
|
|
41
|
+
!isPlain(a) ||
|
|
42
|
+
!isPlain(b) ||
|
|
43
|
+
Array.isArray(a) !== Array.isArray(b)
|
|
44
|
+
) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
const keys = Object.keys(a);
|
|
48
|
+
return (
|
|
49
|
+
keys.length === Object.keys(b).length &&
|
|
50
|
+
keys.every((key) => key in b && isEqual(a[key], b[key], depth - 1))
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Option objects such as `mantineTableProps={{ striped: true }}` compare by
|
|
56
|
+
* content. Arrays (`data`, `columns`) and functions compare by identity,
|
|
57
|
+
* because TanStack rebuilds rows and columns when their identity changes.
|
|
58
|
+
*/
|
|
59
|
+
const optionsEqual = (
|
|
60
|
+
a: Record<string, unknown>,
|
|
61
|
+
b: Record<string, unknown>,
|
|
62
|
+
) => {
|
|
63
|
+
if (a === b) return true;
|
|
64
|
+
const keys = Object.keys(a);
|
|
65
|
+
return (
|
|
66
|
+
keys.length === Object.keys(b).length &&
|
|
67
|
+
keys.every(
|
|
68
|
+
(key) =>
|
|
69
|
+
key in b &&
|
|
70
|
+
(ignoredOptionKeys.has(key) ||
|
|
71
|
+
isEqual(a[key], b[key], Array.isArray(a[key]) ? 0 : 1)),
|
|
72
|
+
)
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const stateVersions = new WeakMap<object, number>();
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* A number that changes when table state changes, and not when only table
|
|
80
|
+
* options change. `memoMode: 'rows'` compares it, so a consumer that passes
|
|
81
|
+
* inline options still gets memoized rows.
|
|
82
|
+
*/
|
|
83
|
+
export const getMRT_TableStateVersion = (table: object) =>
|
|
84
|
+
stateVersions.get(table);
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* TanStack Table mutates one table instance for the lifetime of the hook. The
|
|
88
|
+
* React Compiler memoizes on reference identity, so compiled consumer code
|
|
89
|
+
* (`<MantineReactTable table={table} />`, `table.getState()` and so on) never
|
|
90
|
+
* sees a change on that instance.
|
|
91
|
+
*
|
|
92
|
+
* This hook returns a new reference whenever table state, table options or the
|
|
93
|
+
* internal render version change, and the same reference otherwise. State and
|
|
94
|
+
* option objects are compared by content, so a setter called with the current
|
|
95
|
+
* value keeps the reference. A function option is compared by identity: pass a
|
|
96
|
+
* stable function (`useCallback` or the React Compiler) to keep the reference
|
|
97
|
+
* across renders of the component that calls the hook. Each
|
|
98
|
+
* reference is a view (see `snapshot.utils.ts`) of the one underlying instance,
|
|
99
|
+
* so every reference reads current data and an old reference is never stale.
|
|
100
|
+
*/
|
|
101
|
+
export const useMRT_TableSnapshot = <TData extends MRT_RowData>(
|
|
102
|
+
table: MRT_TableInstance<TData>,
|
|
103
|
+
tableOptions: MRT_TableOptions<TData>,
|
|
104
|
+
version: number,
|
|
105
|
+
): MRT_TableInstance<TData> => {
|
|
106
|
+
const snapshotRef = useRef<null | Snapshot<TData>>(null);
|
|
107
|
+
|
|
108
|
+
const options = tableOptions as unknown as Record<string, unknown>;
|
|
109
|
+
const state = table.getState() as unknown as Record<string, unknown>;
|
|
110
|
+
const previous = snapshotRef.current;
|
|
111
|
+
|
|
112
|
+
const stateChanged =
|
|
113
|
+
!previous ||
|
|
114
|
+
previous.version !== version ||
|
|
115
|
+
!isEqual(previous.state, state, 3);
|
|
116
|
+
|
|
117
|
+
if (stateChanged || !optionsEqual(previous.options, options)) {
|
|
118
|
+
const snapshot = createMRT_View(table, {
|
|
119
|
+
//a new function identity keeps `const { getState } = table` reactive too
|
|
120
|
+
getState: () => table.getState(),
|
|
121
|
+
} as Partial<MRT_TableInstance<TData>>);
|
|
122
|
+
const stateVersion = (previous?.stateVersion ?? 0) + (stateChanged ? 1 : 0);
|
|
123
|
+
stateVersions.set(snapshot, stateVersion);
|
|
124
|
+
snapshotRef.current = {
|
|
125
|
+
options,
|
|
126
|
+
state,
|
|
127
|
+
stateVersion,
|
|
128
|
+
table: snapshot,
|
|
129
|
+
version,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return snapshotRef.current!.table;
|
|
134
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use no memo';
|
|
2
|
+
|
|
3
|
+
import { useEffect, useReducer } from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* TanStack Virtual reads its scroll element in a layout effect. Child layout
|
|
7
|
+
* effects run before the table container attaches its ref, so the first read
|
|
8
|
+
* returns null and no rows or columns are rendered.
|
|
9
|
+
*
|
|
10
|
+
* Passive effects run after every ref is attached. This hook re-renders the
|
|
11
|
+
* owner once when the virtualizer still holds a different scroll element, so
|
|
12
|
+
* the next layout effect picks up the mounted container. The virtualizer no
|
|
13
|
+
* longer depends on an unrelated parent re-render, which compiled consumer
|
|
14
|
+
* code does not produce.
|
|
15
|
+
*/
|
|
16
|
+
export const useMRT_VirtualizerScrollElement = (virtualizer: {
|
|
17
|
+
options: { enabled?: boolean; getScrollElement: () => unknown };
|
|
18
|
+
scrollElement: unknown;
|
|
19
|
+
}) => {
|
|
20
|
+
const rerender = useReducer((version: number) => version + 1, 0)[1];
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
//the virtualizer's own options decide the element, so a consumer's
|
|
24
|
+
//`getScrollElement` or `enabled: false` never leaves a permanent mismatch
|
|
25
|
+
const { enabled, getScrollElement } = virtualizer.options;
|
|
26
|
+
const scrollElement = enabled === false ? null : getScrollElement();
|
|
27
|
+
if (scrollElement && virtualizer.scrollElement !== scrollElement) {
|
|
28
|
+
rerender();
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use no memo';
|
|
2
|
+
|
|
3
|
+
import { useReducer } from 'react';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
type MRT_RowData,
|
|
7
|
+
type MRT_TableInstance,
|
|
8
|
+
type MRT_TableOptions,
|
|
9
|
+
} from '../types';
|
|
10
|
+
import { useMRT_TableInstance } from './useMRT_TableInstance';
|
|
11
|
+
import { useMRT_TableOptions } from './useMRT_TableOptions';
|
|
12
|
+
import { useMRT_TableSnapshot } from './useMRT_TableSnapshot';
|
|
13
|
+
|
|
14
|
+
export const useMantineReactTable = <TData extends MRT_RowData>(
|
|
15
|
+
tableOptions: MRT_TableOptions<TData>,
|
|
16
|
+
): MRT_TableInstance<TData> => {
|
|
17
|
+
const [version, rerender] = useReducer((v: number) => v + 1, 0);
|
|
18
|
+
const table = useMRT_TableInstance(
|
|
19
|
+
useMRT_TableOptions(tableOptions),
|
|
20
|
+
rerender,
|
|
21
|
+
);
|
|
22
|
+
return useMRT_TableSnapshot(table, tableOptions, version);
|
|
23
|
+
};
|
package/src/icons.ts
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IconArrowAutofitContent,
|
|
3
|
+
IconArrowsSort,
|
|
4
|
+
IconBaselineDensityLarge,
|
|
5
|
+
IconBaselineDensityMedium,
|
|
6
|
+
IconBaselineDensitySmall,
|
|
7
|
+
IconBoxMultiple,
|
|
8
|
+
IconChevronDown,
|
|
9
|
+
IconChevronLeft,
|
|
10
|
+
IconChevronLeftPipe,
|
|
11
|
+
IconChevronRight,
|
|
12
|
+
IconChevronRightPipe,
|
|
13
|
+
IconChevronsDown,
|
|
14
|
+
IconCircleX,
|
|
15
|
+
IconClearAll,
|
|
16
|
+
IconColumns,
|
|
17
|
+
IconDeviceFloppy,
|
|
18
|
+
IconDots,
|
|
19
|
+
IconDotsVertical,
|
|
20
|
+
IconEdit,
|
|
21
|
+
IconEyeOff,
|
|
22
|
+
IconFilter,
|
|
23
|
+
IconFilterCog,
|
|
24
|
+
IconFilterOff,
|
|
25
|
+
IconGripHorizontal,
|
|
26
|
+
IconMaximize,
|
|
27
|
+
IconMinimize,
|
|
28
|
+
IconPinned,
|
|
29
|
+
IconPinnedOff,
|
|
30
|
+
IconSearch,
|
|
31
|
+
IconSearchOff,
|
|
32
|
+
IconSortAscending,
|
|
33
|
+
IconSortDescending,
|
|
34
|
+
IconX,
|
|
35
|
+
} from '@tabler/icons-react';
|
|
36
|
+
|
|
37
|
+
export type MRT_IconKeys =
|
|
38
|
+
| 'IconArrowAutofitContent'
|
|
39
|
+
| 'IconArrowsSort'
|
|
40
|
+
| 'IconBaselineDensityLarge'
|
|
41
|
+
| 'IconBaselineDensityMedium'
|
|
42
|
+
| 'IconBaselineDensitySmall'
|
|
43
|
+
| 'IconBoxMultiple'
|
|
44
|
+
| 'IconChevronDown'
|
|
45
|
+
| 'IconChevronLeft'
|
|
46
|
+
| 'IconChevronLeftPipe'
|
|
47
|
+
| 'IconChevronRight'
|
|
48
|
+
| 'IconChevronRightPipe'
|
|
49
|
+
| 'IconChevronsDown'
|
|
50
|
+
| 'IconCircleX'
|
|
51
|
+
| 'IconClearAll'
|
|
52
|
+
| 'IconColumns'
|
|
53
|
+
| 'IconDeviceFloppy'
|
|
54
|
+
| 'IconDots'
|
|
55
|
+
| 'IconDotsVertical'
|
|
56
|
+
| 'IconEdit'
|
|
57
|
+
| 'IconEyeOff'
|
|
58
|
+
| 'IconFilter'
|
|
59
|
+
| 'IconFilterCog'
|
|
60
|
+
| 'IconFilterOff'
|
|
61
|
+
| 'IconGripHorizontal'
|
|
62
|
+
| 'IconMaximize'
|
|
63
|
+
| 'IconMinimize'
|
|
64
|
+
| 'IconPinned'
|
|
65
|
+
| 'IconPinnedOff'
|
|
66
|
+
| 'IconSearch'
|
|
67
|
+
| 'IconSearchOff'
|
|
68
|
+
| 'IconSortAscending'
|
|
69
|
+
| 'IconSortDescending'
|
|
70
|
+
| 'IconX';
|
|
71
|
+
|
|
72
|
+
export type MRT_Icons = Record<MRT_IconKeys, any>;
|
|
73
|
+
|
|
74
|
+
export const MRT_Default_Icons: MRT_Icons = {
|
|
75
|
+
IconArrowAutofitContent,
|
|
76
|
+
IconArrowsSort,
|
|
77
|
+
IconBaselineDensityLarge,
|
|
78
|
+
IconBaselineDensityMedium,
|
|
79
|
+
IconBaselineDensitySmall,
|
|
80
|
+
IconBoxMultiple,
|
|
81
|
+
IconChevronDown,
|
|
82
|
+
IconChevronLeft,
|
|
83
|
+
IconChevronLeftPipe,
|
|
84
|
+
IconChevronRight,
|
|
85
|
+
IconChevronRightPipe,
|
|
86
|
+
IconChevronsDown,
|
|
87
|
+
IconCircleX,
|
|
88
|
+
IconClearAll,
|
|
89
|
+
IconColumns,
|
|
90
|
+
IconDeviceFloppy,
|
|
91
|
+
IconDots,
|
|
92
|
+
IconDotsVertical,
|
|
93
|
+
IconEdit,
|
|
94
|
+
IconEyeOff,
|
|
95
|
+
IconFilter,
|
|
96
|
+
IconFilterCog,
|
|
97
|
+
IconFilterOff,
|
|
98
|
+
IconGripHorizontal,
|
|
99
|
+
IconMaximize,
|
|
100
|
+
IconMinimize,
|
|
101
|
+
IconPinned,
|
|
102
|
+
IconPinnedOff,
|
|
103
|
+
IconSearch,
|
|
104
|
+
IconSearchOff,
|
|
105
|
+
IconSortAscending,
|
|
106
|
+
IconSortDescending,
|
|
107
|
+
IconX,
|
|
108
|
+
};
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
//body components
|
|
2
|
+
export * from './components/body/MRT_TableBody';
|
|
3
|
+
|
|
4
|
+
export * from './components/body/MRT_TableBodyCell';
|
|
5
|
+
export * from './components/body/MRT_TableBodyCellValue';
|
|
6
|
+
export * from './components/body/MRT_TableBodyEmptyRow';
|
|
7
|
+
export * from './components/body/MRT_TableBodyRow';
|
|
8
|
+
export * from './components/body/MRT_TableBodyRowGrabHandle';
|
|
9
|
+
|
|
10
|
+
export * from './components/body/MRT_TableBodyRowPinButton';
|
|
11
|
+
export * from './components/body/MRT_TableDetailPanel';
|
|
12
|
+
//button components
|
|
13
|
+
export * from './components/buttons/MRT_ColumnPinningButtons';
|
|
14
|
+
|
|
15
|
+
export * from './components/buttons/MRT_CopyButton';
|
|
16
|
+
export * from './components/buttons/MRT_EditActionButtons';
|
|
17
|
+
export * from './components/buttons/MRT_ExpandAllButton';
|
|
18
|
+
export * from './components/buttons/MRT_ExpandButton';
|
|
19
|
+
export * from './components/buttons/MRT_GrabHandleButton';
|
|
20
|
+
export * from './components/buttons/MRT_RowPinButton';
|
|
21
|
+
export * from './components/buttons/MRT_ShowHideColumnsButton';
|
|
22
|
+
|
|
23
|
+
export * from './components/buttons/MRT_ToggleDensePaddingButton';
|
|
24
|
+
export * from './components/buttons/MRT_ToggleFiltersButton';
|
|
25
|
+
export * from './components/buttons/MRT_ToggleFullScreenButton';
|
|
26
|
+
export * from './components/buttons/MRT_ToggleGlobalFilterButton';
|
|
27
|
+
export * from './components/buttons/MRT_ToggleRowActionMenuButton';
|
|
28
|
+
//footer components
|
|
29
|
+
export * from './components/footer/MRT_TableFooter';
|
|
30
|
+
export * from './components/footer/MRT_TableFooterCell';
|
|
31
|
+
export * from './components/footer/MRT_TableFooterRow';
|
|
32
|
+
//head components
|
|
33
|
+
export * from './components/head/MRT_TableHead';
|
|
34
|
+
export * from './components/head/MRT_TableHeadCell';
|
|
35
|
+
export * from './components/head/MRT_TableHeadCellFilterContainer';
|
|
36
|
+
export * from './components/head/MRT_TableHeadCellFilterLabel';
|
|
37
|
+
export * from './components/head/MRT_TableHeadCellGrabHandle';
|
|
38
|
+
export * from './components/head/MRT_TableHeadCellResizeHandle';
|
|
39
|
+
export * from './components/head/MRT_TableHeadCellSortLabel';
|
|
40
|
+
export * from './components/head/MRT_TableHeadRow';
|
|
41
|
+
//input components
|
|
42
|
+
export * from './components/inputs/MRT_EditCellTextInput';
|
|
43
|
+
export * from './components/inputs/MRT_FilterCheckbox';
|
|
44
|
+
export * from './components/inputs/MRT_FilterRangeFields';
|
|
45
|
+
export * from './components/inputs/MRT_FilterRangeSlider';
|
|
46
|
+
export * from './components/inputs/MRT_FilterTextInput';
|
|
47
|
+
export * from './components/inputs/MRT_GlobalFilterTextInput';
|
|
48
|
+
export * from './components/inputs/MRT_SelectCheckbox';
|
|
49
|
+
//components
|
|
50
|
+
export * from './components/MantineReactTable';
|
|
51
|
+
//menu components
|
|
52
|
+
export * from './components/menus/MRT_ColumnActionMenu';
|
|
53
|
+
export * from './components/menus/MRT_FilterOptionMenu';
|
|
54
|
+
export * from './components/menus/MRT_RowActionMenu';
|
|
55
|
+
export * from './components/menus/MRT_ShowHideColumnsMenu';
|
|
56
|
+
export * from './components/menus/MRT_ShowHideColumnsMenuItems';
|
|
57
|
+
//modal components
|
|
58
|
+
export * from './components/modals/MRT_EditRowModal';
|
|
59
|
+
//table components
|
|
60
|
+
export * from './components/table/MRT_Table';
|
|
61
|
+
export * from './components/table/MRT_TableContainer';
|
|
62
|
+
export * from './components/table/MRT_TablePaper';
|
|
63
|
+
//toolbar components
|
|
64
|
+
export * from './components/toolbar/MRT_BottomToolbar';
|
|
65
|
+
export * from './components/toolbar/MRT_ProgressBar';
|
|
66
|
+
export * from './components/toolbar/MRT_TablePagination';
|
|
67
|
+
export * from './components/toolbar/MRT_ToolbarAlertBanner';
|
|
68
|
+
export * from './components/toolbar/MRT_ToolbarDropZone';
|
|
69
|
+
export * from './components/toolbar/MRT_ToolbarInternalButtons';
|
|
70
|
+
export * from './components/toolbar/MRT_TopToolbar';
|
|
71
|
+
//fns
|
|
72
|
+
export * from './fns/aggregationFns';
|
|
73
|
+
export * from './fns/filterFns';
|
|
74
|
+
export * from './fns/sortingFns';
|
|
75
|
+
//hooks
|
|
76
|
+
export * from './hooks/useMantineReactTable';
|
|
77
|
+
export * from './hooks/useMRT_ColumnVirtualizer';
|
|
78
|
+
export * from './hooks/useMRT_Effects';
|
|
79
|
+
export * from './hooks/useMRT_Rows';
|
|
80
|
+
export * from './hooks/useMRT_RowVirtualizer';
|
|
81
|
+
export * from './hooks/useMRT_TableInstance';
|
|
82
|
+
export * from './hooks/useMRT_TableOptions';
|
|
83
|
+
export * from './types';
|
|
84
|
+
export * from './utils/column.utils';
|
|
85
|
+
export * from './utils/displayColumn.utils';
|
|
86
|
+
export * from './utils/row.utils';
|
|
87
|
+
export * from './utils/snapshot.utils';
|
|
88
|
+
export * from './utils/style.utils';
|
|
89
|
+
//helpers
|
|
90
|
+
export * from './utils/tanstack.helpers';
|
|
91
|
+
export * from './utils/utils';
|