material-react-table 0.29.1 → 0.30.2
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/README.md +4 -4
- package/dist/MaterialReactTable.d.ts +2 -2
- package/dist/column.utils.d.ts +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/material-react-table.cjs.development.js +24 -13
- package/dist/material-react-table.cjs.development.js.map +1 -1
- package/dist/material-react-table.cjs.production.min.js +1 -1
- package/dist/material-react-table.cjs.production.min.js.map +1 -1
- package/dist/material-react-table.esm.js +24 -13
- package/dist/material-react-table.esm.js.map +1 -1
- package/package.json +2 -5
- package/src/MaterialReactTable.tsx +6 -2
- package/src/column.utils.ts +1 -0
- package/src/head/MRT_TableHeadCell.tsx +12 -2
- package/src/index.tsx +6 -0
- package/src/inputs/MRT_FilterTextField.tsx +28 -26
- package/src/inputs/MRT_GlobalFilterTextField.tsx +1 -1
- package/src/menus/MRT_ColumnActionMenu.tsx +3 -3
- package/src/table/MRT_TableRoot.tsx +1 -0
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# Material React Table
|
|
2
2
|
|
|
3
3
|
<a href="https://npmjs.com/package/material-react-table" target="_blank">
|
|
4
|
-
<img alt="" src="https://badgen.net/npm/v/material-react-table" />
|
|
4
|
+
<img alt="" src="https://badgen.net/npm/v/material-react-table?color=blue" />
|
|
5
5
|
</a>
|
|
6
6
|
<a href="https://npmjs.com/package/material-react-table" target="_blank">
|
|
7
|
-
<img alt="" src="https://img.shields.io/npm/dm/material-react-table.svg" />
|
|
7
|
+
<img alt="" src="https://img.shields.io/npm/dm/material-react-table.svg?color=blue" />
|
|
8
8
|
</a>
|
|
9
9
|
<a href="https://bundlephobia.com/result?p=material-react-table" target="_blank">
|
|
10
|
-
<img alt="" src="https://badgen.net/bundlephobia/minzip/material-react-table@latest" />
|
|
10
|
+
<img alt="" src="https://badgen.net/bundlephobia/minzip/material-react-table@latest?color=blue" />
|
|
11
11
|
</a>
|
|
12
12
|
<a href="https://github.com/KevinVandy/material-react-table" target="_blank">
|
|
13
13
|
<img alt="" src="https://img.shields.io/github/stars/KevinVandy/material-react-table.svg?style=social&label=Star" />
|
|
@@ -53,7 +53,7 @@ View additional [storybook examples](https://www.material-react-table.dev/)
|
|
|
53
53
|
|
|
54
54
|
_All features can easily be enabled/disabled_
|
|
55
55
|
|
|
56
|
-
- [x] <
|
|
56
|
+
- [x] < 37kb gzipped - [Bundlephobia](https://bundlephobia.com/package/material-react-table)
|
|
57
57
|
- [x] Advanced TypeScript Generics Support (TypeScript Optional)
|
|
58
58
|
- [x] Click To Copy Cell Values
|
|
59
59
|
- [x] Column Action Dropdown Menu
|
|
@@ -221,9 +221,9 @@ export declare type MRT_Cell<TData extends Record<string, any> = {}> = Omit<Cell
|
|
|
221
221
|
column: MRT_Column<TData>;
|
|
222
222
|
row: MRT_Row<TData>;
|
|
223
223
|
};
|
|
224
|
-
export declare type MRT_SortingOption = keyof typeof MRT_SortingFns
|
|
224
|
+
export declare type MRT_SortingOption = LiteralUnion<string & keyof typeof MRT_SortingFns>;
|
|
225
225
|
export declare type MRT_SortingFn<TData extends Record<string, any> = {}> = SortingFn<TData> | MRT_SortingOption;
|
|
226
|
-
export declare type MRT_FilterOption = keyof typeof MRT_FilterFns
|
|
226
|
+
export declare type MRT_FilterOption = LiteralUnion<string & keyof typeof MRT_FilterFns>;
|
|
227
227
|
export declare type MRT_FilterFn<TData extends Record<string, any> = {}> = FilterFn<TData> | MRT_FilterOption;
|
|
228
228
|
export declare type MRT_DisplayColumnIds = 'mrt-row-drag' | 'mrt-row-actions' | 'mrt-row-expand' | 'mrt-row-select' | 'mrt-row-numbers';
|
|
229
229
|
/**
|
package/dist/column.utils.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ColumnOrderState } from '@tanstack/react-table';
|
|
|
2
2
|
import { MaterialReactTableProps, MRT_Column, MRT_ColumnDef, MRT_DefinedColumnDef, MRT_DisplayColumnIds, MRT_FilterOption } from '.';
|
|
3
3
|
export declare const getAllLeafColumnDefs: <TData extends Record<string, any> = {}>(columns: MRT_ColumnDef<TData>[]) => MRT_ColumnDef<TData>[];
|
|
4
4
|
export declare const prepareColumns: <TData extends Record<string, any> = {}>(columnDefs: MRT_ColumnDef<TData>[], currentFilterFns: {
|
|
5
|
-
[key: string]: "between" | "betweenInclusive" | "contains" | "empty" | "endsWith" | "equals" | "fuzzy" | "greaterThan" | "greaterThanOrEqualTo" | "lessThan" | "lessThanOrEqualTo" | "notEmpty" | "notEquals" | "startsWith" | "includesString" | "includesStringSensitive" | "equalsString" | "arrIncludes" | "arrIncludesAll" | "arrIncludesSome" | "weakEquals" | "inNumberRange";
|
|
5
|
+
[key: string]: "between" | "betweenInclusive" | "contains" | "empty" | "endsWith" | "equals" | "fuzzy" | "greaterThan" | "greaterThanOrEqualTo" | "lessThan" | "lessThanOrEqualTo" | "notEmpty" | "notEquals" | "startsWith" | "includesString" | "includesStringSensitive" | "equalsString" | "arrIncludes" | "arrIncludesAll" | "arrIncludesSome" | "weakEquals" | "inNumberRange" | (string & Record<never, never>);
|
|
6
6
|
}) => MRT_DefinedColumnDef<TData>[];
|
|
7
7
|
export declare const reorderColumn: <TData extends Record<string, any> = {}>(draggedColumn: MRT_Column<TData>, targetColumn: MRT_Column<TData>, columnOrder: ColumnOrderState) => ColumnOrderState;
|
|
8
8
|
export declare const getLeadingDisplayColumnIds: <TData extends Record<string, any> = {}>(props: MaterialReactTableProps<TData>) => MRT_DisplayColumnIds[];
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import MaterialReactTable from './MaterialReactTable';
|
|
2
2
|
export default MaterialReactTable;
|
|
3
3
|
export * from './MaterialReactTable';
|
|
4
|
+
import type { MRT_Icons } from './icons';
|
|
5
|
+
export type { MRT_Icons };
|
|
6
|
+
import type { MRT_Localization } from './localization';
|
|
7
|
+
export type { MRT_Localization };
|
|
@@ -718,7 +718,8 @@ var prepareColumns = function prepareColumns(columnDefs, currentFilterFns) {
|
|
|
718
718
|
if (Object.keys(MRT_FilterFns).includes(currentFilterFns[columnDef.id])) {
|
|
719
719
|
var _MRT_FilterFns$curren;
|
|
720
720
|
|
|
721
|
-
columnDef.filterFn =
|
|
721
|
+
columnDef.filterFn = // @ts-ignore
|
|
722
|
+
(_MRT_FilterFns$curren = MRT_FilterFns[currentFilterFns[columnDef.id]]) != null ? _MRT_FilterFns$curren : MRT_FilterFns.fuzzy; //@ts-ignore
|
|
722
723
|
|
|
723
724
|
columnDef._filterFn = currentFilterFns[columnDef.id];
|
|
724
725
|
}
|
|
@@ -1151,7 +1152,11 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
|
1151
1152
|
sx: commonMenuItemStyles
|
|
1152
1153
|
}, React__default.createElement(material.Box, {
|
|
1153
1154
|
sx: commonListItemStyles
|
|
1154
|
-
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(SortIcon,
|
|
1155
|
+
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(SortIcon, {
|
|
1156
|
+
style: {
|
|
1157
|
+
transform: 'rotate(180deg) scaleX(-1)'
|
|
1158
|
+
}
|
|
1159
|
+
})), (_localization$sortByC = localization.sortByColumnAsc) == null ? void 0 : _localization$sortByC.replace('{column}', String(columnDef.header)))), React__default.createElement(material.MenuItem, {
|
|
1155
1160
|
divider: enableColumnFilters || enableGrouping || enableHiding,
|
|
1156
1161
|
key: 2,
|
|
1157
1162
|
disabled: column.getIsSorted() === 'desc',
|
|
@@ -1159,11 +1164,7 @@ var MRT_ColumnActionMenu = function MRT_ColumnActionMenu(_ref) {
|
|
|
1159
1164
|
sx: commonMenuItemStyles
|
|
1160
1165
|
}, React__default.createElement(material.Box, {
|
|
1161
1166
|
sx: commonListItemStyles
|
|
1162
|
-
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(SortIcon, {
|
|
1163
|
-
style: {
|
|
1164
|
-
transform: 'rotate(180deg) scaleX(-1)'
|
|
1165
|
-
}
|
|
1166
|
-
})), (_localization$sortByC2 = localization.sortByColumnDesc) == null ? void 0 : _localization$sortByC2.replace('{column}', String(columnDef.header))))], enableColumnFilters && column.getCanFilter() && [React__default.createElement(material.MenuItem, {
|
|
1167
|
+
}, React__default.createElement(material.ListItemIcon, null, React__default.createElement(SortIcon, null)), (_localization$sortByC2 = localization.sortByColumnDesc) == null ? void 0 : _localization$sortByC2.replace('{column}', String(columnDef.header))))], enableColumnFilters && column.getCanFilter() && [React__default.createElement(material.MenuItem, {
|
|
1167
1168
|
disabled: !column.getFilterValue(),
|
|
1168
1169
|
key: 0,
|
|
1169
1170
|
onClick: handleClearFilter,
|
|
@@ -1554,7 +1555,11 @@ var MRT_GlobalFilterTextField = function MRT_GlobalFilterTextField(_ref) {
|
|
|
1554
1555
|
height: '1.75rem',
|
|
1555
1556
|
width: '1.75rem'
|
|
1556
1557
|
}
|
|
1557
|
-
}, React__default.createElement(SearchIcon, null)))) : React__default.createElement(SearchIcon,
|
|
1558
|
+
}, React__default.createElement(SearchIcon, null)))) : React__default.createElement(SearchIcon, {
|
|
1559
|
+
style: {
|
|
1560
|
+
marginRight: '4px'
|
|
1561
|
+
}
|
|
1562
|
+
}),
|
|
1558
1563
|
endAdornment: React__default.createElement(material.InputAdornment, {
|
|
1559
1564
|
position: "end"
|
|
1560
1565
|
}, React__default.createElement(material.Tooltip, {
|
|
@@ -2305,7 +2310,11 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
|
|
|
2305
2310
|
}, React__default.createElement(FilterListIcon, null)))), filterChipLabel && React__default.createElement(material.Chip, {
|
|
2306
2311
|
onDelete: handleClearEmptyFilterChip,
|
|
2307
2312
|
label: filterChipLabel
|
|
2308
|
-
})) : React__default.createElement(FilterListIcon,
|
|
2313
|
+
})) : React__default.createElement(FilterListIcon, {
|
|
2314
|
+
style: {
|
|
2315
|
+
marginRight: '4px'
|
|
2316
|
+
}
|
|
2317
|
+
}),
|
|
2309
2318
|
endAdornment: !filterChipLabel && React__default.createElement(material.InputAdornment, {
|
|
2310
2319
|
position: "end"
|
|
2311
2320
|
}, React__default.createElement(material.Tooltip, {
|
|
@@ -2350,7 +2359,7 @@ var MRT_FilterTextField = function MRT_FilterTextField(_ref) {
|
|
|
2350
2359
|
return _extends({
|
|
2351
2360
|
p: 0,
|
|
2352
2361
|
minWidth: !filterChipLabel ? '6rem' : 'auto',
|
|
2353
|
-
width: '
|
|
2362
|
+
width: '100%',
|
|
2354
2363
|
'& .MuiSelect-icon': {
|
|
2355
2364
|
mr: '1.5rem'
|
|
2356
2365
|
}
|
|
@@ -2631,7 +2640,8 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
|
2631
2640
|
var _getState = getState(),
|
|
2632
2641
|
density = _getState.density,
|
|
2633
2642
|
currentDraggingColumn = _getState.currentDraggingColumn,
|
|
2634
|
-
currentHoveredColumn = _getState.currentHoveredColumn
|
|
2643
|
+
currentHoveredColumn = _getState.currentHoveredColumn,
|
|
2644
|
+
showColumnFilters = _getState.showColumnFilters;
|
|
2635
2645
|
|
|
2636
2646
|
var column = header.column;
|
|
2637
2647
|
var columnDef = column.columnDef;
|
|
@@ -2694,7 +2704,7 @@ var MRT_TableHeadCell = function MRT_TableHeadCell(_ref) {
|
|
|
2694
2704
|
overflow: 'visible',
|
|
2695
2705
|
opacity: (currentDraggingColumn == null ? void 0 : currentDraggingColumn.id) === column.id || (currentHoveredColumn == null ? void 0 : currentHoveredColumn.id) === column.id ? 0.5 : 1,
|
|
2696
2706
|
p: density === 'compact' ? '0.5rem' : density === 'comfortable' ? columnDefType === 'display' ? '0.75rem' : '1rem' : columnDefType === 'display' ? '1rem 1.25rem' : '1.5rem',
|
|
2697
|
-
pb: columnDefType === 'display' ? 0 : undefined,
|
|
2707
|
+
pb: columnDefType === 'display' ? 0 : showColumnFilters ? '0.5rem' : undefined,
|
|
2698
2708
|
position: column.getIsPinned() && columnDefType !== 'group' ? 'sticky' : undefined,
|
|
2699
2709
|
pt: columnDefType === 'group' ? 0 : density === 'compact' ? '0.25' : density === 'comfortable' ? '.75rem' : '1.25rem',
|
|
2700
2710
|
right: column.getIsPinned() === 'right' ? getTotalRight() + "px" : undefined,
|
|
@@ -3728,7 +3738,8 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
|
3728
3738
|
getSubRows: function getSubRows(row) {
|
|
3729
3739
|
return row == null ? void 0 : row.subRows;
|
|
3730
3740
|
},
|
|
3731
|
-
globalFilterFn:
|
|
3741
|
+
globalFilterFn: //@ts-ignore
|
|
3742
|
+
(_MRT_FilterFns$curren = MRT_FilterFns[currentGlobalFilterFn]) != null ? _MRT_FilterFns$curren : MRT_FilterFns.fuzzy,
|
|
3732
3743
|
initialState: initialState,
|
|
3733
3744
|
state: _extends({
|
|
3734
3745
|
columnOrder: columnOrder,
|