material-react-table 1.0.0-beta.7 → 1.0.0-beta.8

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 CHANGED
@@ -48,10 +48,12 @@ See all [Props and Options](https://www.material-react-table.com/docs/api)
48
48
 
49
49
  View additional [storybook examples](https://www.material-react-table.dev/)
50
50
 
51
- ## Features (All Features work and are MVP, but are still being polished)
51
+ ## Features
52
52
 
53
53
  _All features can easily be enabled/disabled_
54
54
 
55
+ _**Fully Fleshed out [Docs](https://www.material-react-table.com/docs/guides#guides) are available for all features**_
56
+
55
57
  - [x] < 37kb gzipped - [Bundlephobia](https://bundlephobia.com/package/material-react-table)
56
58
  - [x] Advanced TypeScript Generics Support (TypeScript Optional)
57
59
  - [x] Aggregation and Grouping (Sum, Average, Count, etc.)
@@ -63,7 +65,7 @@ _All features can easily be enabled/disabled_
63
65
  - [x] Column Resizing
64
66
  - [x] Customize Icons
65
67
  - [x] Customize Styling of internal Mui Components
66
- - [x] Data Editing (3 different editing modes)
68
+ - [x] Data Editing (4 different editing modes)
67
69
  - [x] Density Toggle
68
70
  - [x] Detail Panels (Expansion)
69
71
  - [x] Filtering (supports client-side and server-side)
@@ -71,7 +73,7 @@ _All features can easily be enabled/disabled_
71
73
  - [x] Global Filtering (Search across all columns, rank by best match)
72
74
  - [x] Header Groups & Footers
73
75
  - [x] Localization (i18n) support
74
- - [x] Manage your own state
76
+ - [x] Manage your own state or let the table manage it internally for you
75
77
  - [x] Pagination (supports client-side and server-side)
76
78
  - [x] Row Actions (Your Custom Action Buttons)
77
79
  - [x] Row Numbers
@@ -112,33 +114,31 @@ npm install material-react-table
112
114
  import React, { useMemo, useRef, useState, useEffect } from 'react';
113
115
  import MaterialReactTable from 'material-react-table';
114
116
 
117
+ const data = [
118
+ {
119
+ name: 'John',
120
+ age: 30,
121
+ },
122
+ {
123
+ name: 'Sara',
124
+ age: 25,
125
+ },
126
+ ]
127
+
115
128
  export default function App() {
116
129
  const columns = useMemo(
117
130
  () => [
118
131
  {
119
132
  accessorKey: 'name', //simple recommended way to define a column
120
133
  header: 'Name',
121
- muiTableHeadCellProps: { sx: { color: 'green' } }, //custom props
134
+ muiTableHeadCellProps: { sx: { color: 'green' } }, //optional custom props
135
+ Cell: ({ cell}) => <span>{cell.getValue()}</span>, //optional custom cell render
122
136
  },
123
137
  {
124
138
  accessorFn: (row) => row.age, //alternate way
125
139
  id: 'age', //id required if you use accessorFn instead of accessorKey
126
140
  header: 'Age',
127
- Header: <i>Age</i>, //optional custom markup
128
- },
129
- ],
130
- [],
131
- );
132
-
133
- const data = useMemo(
134
- () => [
135
- {
136
- name: 'John',
137
- age: 30,
138
- },
139
- {
140
- name: 'Sara',
141
- age: 25,
141
+ Header: () => <i>Age</i>, //optional custom header render
142
142
  },
143
143
  ],
144
144
  [],
@@ -170,7 +170,7 @@ export default function App() {
170
170
  state={{ rowSelection }} //manage your own state, pass it back to the table (optional)
171
171
  tableInstanceRef={tableInstanceRef} //get a reference to the underlying table instance (optional)
172
172
  />
173
- );
173
+ );
174
174
  }
175
175
  ```
176
176
 
package/dist/cjs/index.js CHANGED
@@ -2366,16 +2366,6 @@ const MRT_TableContainer = ({ table }) => {
2366
2366
  const MRT_TablePaper = ({ table }) => {
2367
2367
  const { getState, options: { enableBottomToolbar, enableTopToolbar, muiTablePaperProps }, refs: { tablePaperRef }, } = table;
2368
2368
  const { isFullScreen } = getState();
2369
- React.useEffect(() => {
2370
- if (typeof window !== 'undefined') {
2371
- if (isFullScreen) {
2372
- document.body.style.height = '100vh';
2373
- }
2374
- else {
2375
- document.body.style.height = 'auto';
2376
- }
2377
- }
2378
- }, [isFullScreen]);
2379
2369
  const tablePaperProps = muiTablePaperProps instanceof Function
2380
2370
  ? muiTablePaperProps({ table })
2381
2371
  : muiTablePaperProps;
@@ -2387,7 +2377,16 @@ const MRT_TablePaper = ({ table }) => {
2387
2377
  }
2388
2378
  }, sx: (theme) => (Object.assign({ transition: 'all 0.2s ease-in-out' }, ((tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx) instanceof Function
2389
2379
  ? tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx(theme)
2390
- : tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx))), style: Object.assign(Object.assign({}, tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.style), { height: isFullScreen ? '100vh' : undefined, margin: isFullScreen ? '0' : undefined, maxHeight: isFullScreen ? '100vh' : undefined, maxWidth: isFullScreen ? '100vw' : undefined, padding: isFullScreen ? '0' : undefined, width: isFullScreen ? '100vw' : undefined }) }),
2380
+ : tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.sx))), style: Object.assign(Object.assign({}, tablePaperProps === null || tablePaperProps === void 0 ? void 0 : tablePaperProps.style), (isFullScreen
2381
+ ? {
2382
+ height: '100vh',
2383
+ margin: 0,
2384
+ maxHeight: '100vh',
2385
+ maxWidth: '100vw',
2386
+ padding: 0,
2387
+ width: '100vw',
2388
+ }
2389
+ : {})) }),
2391
2390
  enableTopToolbar && React__default["default"].createElement(MRT_TopToolbar, { table: table }),
2392
2391
  React__default["default"].createElement(MRT_TableContainer, { table: table }),
2393
2392
  enableBottomToolbar && React__default["default"].createElement(MRT_BottomToolbar, { table: table })));
@@ -2545,6 +2544,22 @@ const MRT_TableRoot = (props) => {
2545
2544
  if (props.tableInstanceRef) {
2546
2545
  props.tableInstanceRef.current = table;
2547
2546
  }
2547
+ const initialBodyHeight = React.useRef();
2548
+ React.useEffect(() => {
2549
+ if (typeof window !== 'undefined') {
2550
+ initialBodyHeight.current = document.body.style.height;
2551
+ }
2552
+ }, []);
2553
+ React.useEffect(() => {
2554
+ if (typeof window !== 'undefined') {
2555
+ if (table.getState().isFullScreen) {
2556
+ document.body.style.height = '100vh';
2557
+ }
2558
+ else {
2559
+ document.body.style.height = initialBodyHeight.current;
2560
+ }
2561
+ }
2562
+ }, [table.getState().isFullScreen]);
2548
2563
  return (React__default["default"].createElement(React__default["default"].Fragment, null,
2549
2564
  React__default["default"].createElement(material.Dialog, { PaperComponent: material.Box, TransitionComponent: material.Grow, disablePortal: true, fullScreen: true, keepMounted: false, onClose: () => table.setIsFullScreen(false), open: table.getState().isFullScreen, transitionDuration: 400 },
2550
2565
  React__default["default"].createElement(MRT_TablePaper, { table: table })),