material-react-table 0.23.2 → 0.23.5
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 +13 -1
- package/dist/MaterialReactTable.d.ts +2 -1
- package/dist/material-react-table.cjs.development.js +6 -5
- 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 +6 -5
- package/dist/material-react-table.esm.js.map +1 -1
- package/dist/toolbar/MRT_LinearProgressBar.d.ts +1 -1
- package/package.json +3 -3
- package/src/MaterialReactTable.tsx +2 -0
- package/src/toolbar/MRT_LinearProgressBar.tsx +5 -5
- package/src/toolbar/MRT_ToolbarBottom.tsx +1 -1
- package/src/toolbar/MRT_ToolbarTop.tsx +1 -1
package/README.md
CHANGED
@@ -12,6 +12,9 @@
|
|
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" />
|
14
14
|
</a>
|
15
|
+
<a href="http://makeapullrequest.com" target="_blank_">
|
16
|
+
<img alt="" src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square" />
|
17
|
+
</a>
|
15
18
|
|
16
19
|
---
|
17
20
|
|
@@ -108,7 +111,7 @@ npm install material-react-table
|
|
108
111
|
> Read the full usage docs [here](https://www.material-react-table.com/docs/usage/)
|
109
112
|
|
110
113
|
```jsx
|
111
|
-
import React, { useMemo } from 'react';
|
114
|
+
import React, { useMemo, useState, useEffect } from 'react';
|
112
115
|
import MaterialReactTable from 'material-react-table';
|
113
116
|
|
114
117
|
export default function App() {
|
@@ -145,6 +148,13 @@ export default function App() {
|
|
145
148
|
[],
|
146
149
|
);
|
147
150
|
|
151
|
+
//optionally, you can manage any/all of the table state yourself
|
152
|
+
const [rowSelection, setRowSelection] = useState({});
|
153
|
+
|
154
|
+
useEffect(() => {
|
155
|
+
//do something when the row selection changes
|
156
|
+
}, [rowSelection]);
|
157
|
+
|
148
158
|
return (
|
149
159
|
<MaterialReactTable
|
150
160
|
columns={columns}
|
@@ -152,6 +162,8 @@ export default function App() {
|
|
152
162
|
enableColumnOrdering //enable some features
|
153
163
|
enableRowSelection
|
154
164
|
enableStickyHeader
|
165
|
+
onRowSelectionChange={setRowSelection} //hoist internal state to your own state (optional)
|
166
|
+
state={{ rowSelection }} //manage your own state, pass it back to the table (optional)
|
155
167
|
/>
|
156
168
|
);
|
157
169
|
}
|
@@ -255,7 +255,8 @@ export declare type MaterialReactTableProps<TData extends Record<string, any> =
|
|
255
255
|
table: MRT_TableInstance<TData>;
|
256
256
|
row: MRT_Row<TData>;
|
257
257
|
}) => IconButtonProps);
|
258
|
-
muiLinearProgressProps?: LinearProgressProps | (({ table, }: {
|
258
|
+
muiLinearProgressProps?: LinearProgressProps | (({ isTopToolbar, table, }: {
|
259
|
+
isTopToolbar: boolean;
|
259
260
|
table: MRT_TableInstance<TData>;
|
260
261
|
}) => LinearProgressProps);
|
261
262
|
muiSearchTextFieldProps?: TextFieldProps | (({ table }: {
|
@@ -1814,7 +1814,7 @@ var MRT_ToolbarAlertBanner = function MRT_ToolbarAlertBanner(_ref) {
|
|
1814
1814
|
};
|
1815
1815
|
|
1816
1816
|
var MRT_LinearProgressBar = function MRT_LinearProgressBar(_ref) {
|
1817
|
-
var
|
1817
|
+
var isTopToolbar = _ref.isTopToolbar,
|
1818
1818
|
table = _ref.table;
|
1819
1819
|
var muiLinearProgressProps = table.options.muiLinearProgressProps,
|
1820
1820
|
getState = table.getState;
|
@@ -1824,6 +1824,7 @@ var MRT_LinearProgressBar = function MRT_LinearProgressBar(_ref) {
|
|
1824
1824
|
showProgressBars = _getState.showProgressBars;
|
1825
1825
|
|
1826
1826
|
var linearProgressProps = muiLinearProgressProps instanceof Function ? muiLinearProgressProps({
|
1827
|
+
isTopToolbar: isTopToolbar,
|
1827
1828
|
table: table
|
1828
1829
|
}) : muiLinearProgressProps;
|
1829
1830
|
return React__default.createElement(material.Collapse, {
|
@@ -1831,9 +1832,9 @@ var MRT_LinearProgressBar = function MRT_LinearProgressBar(_ref) {
|
|
1831
1832
|
mountOnEnter: true,
|
1832
1833
|
unmountOnExit: true,
|
1833
1834
|
sx: {
|
1834
|
-
bottom:
|
1835
|
+
bottom: isTopToolbar ? 0 : undefined,
|
1835
1836
|
position: 'absolute',
|
1836
|
-
top:
|
1837
|
+
top: !isTopToolbar ? 0 : undefined,
|
1837
1838
|
width: '100%'
|
1838
1839
|
}
|
1839
1840
|
}, React__default.createElement(material.LinearProgress, Object.assign({
|
@@ -1922,7 +1923,7 @@ var MRT_ToolbarTop = function MRT_ToolbarTop(_ref2) {
|
|
1922
1923
|
table: table,
|
1923
1924
|
position: "top"
|
1924
1925
|
}), React__default.createElement(MRT_LinearProgressBar, {
|
1925
|
-
|
1926
|
+
isTopToolbar: true,
|
1926
1927
|
table: table
|
1927
1928
|
}));
|
1928
1929
|
};
|
@@ -1962,7 +1963,7 @@ var MRT_ToolbarBottom = function MRT_ToolbarBottom(_ref) {
|
|
1962
1963
|
}, toolbarProps == null ? void 0 : toolbarProps.sx);
|
1963
1964
|
}
|
1964
1965
|
}), React__default.createElement(MRT_LinearProgressBar, {
|
1965
|
-
|
1966
|
+
isTopToolbar: false,
|
1966
1967
|
table: table
|
1967
1968
|
}), positionToolbarAlertBanner === 'bottom' && React__default.createElement(MRT_ToolbarAlertBanner, {
|
1968
1969
|
table: table
|