Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v6 #875

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

v6 #875

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
#### 6.4.7 (2024-11-11)

#### 6.4.7 (2024-11-11)

#### 6.4.6 (2024-11-11)

#### 6.4.5 (2024-11-11)

#### 6.4.4 (2024-05-21)

##### Other Changes
Expand Down
2 changes: 1 addition & 1 deletion __tests__/demo/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {
]
},
resolve: {
extensions: ['*', '.js', '.jsx']
extensions: ['.*', '.js', '.jsx']
},
output: {
path: '/dist',
Expand Down
3,711 changes: 2,557 additions & 1,154 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"access": "public"
},
"url": "https://material-table-core.github.io/",
"version": "6.4.4",
"version": "6.4.7",
"description": "Datatable for React based on https://material-ui.com/api/table/ with additional features",
"main": "dist/index.js",
"types": "types/index.d.ts",
Expand Down Expand Up @@ -113,7 +113,7 @@
"@hello-pangea/dnd": "^16.0.0",
"@mui/icons-material": ">=5.10.6",
"@mui/material": ">=5.11.12",
"@mui/x-date-pickers": "^6.19.0",
"@mui/x-date-pickers": "6.19.0",
"classnames": "^2.3.2",
"date-fns": "^3.2.0",
"debounce": "^1.2.1",
Expand Down
13 changes: 10 additions & 3 deletions src/components/MTableScrollbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,15 @@ const singleStyle = {
}
};

const ScrollBar = ({ double, children }) => {
return <Box sx={double ? doubleStyle : singleStyle}>{children}</Box>;
};
const ScrollBar = React.forwardRef(function ScrollBar(
{ double, children, ...props },
ref
) {
return (
<Box sx={double ? doubleStyle : singleStyle} {...props} ref={ref}>
{children}
</Box>
);
});

export default ScrollBar;
127 changes: 63 additions & 64 deletions src/material-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -1170,87 +1170,86 @@ export default class MaterialTable extends React.Component {
persistentGroupingsId={props.options.persistentGroupingsId}
/>
)}
<MTableScrollbar double={props.options.doubleHorizontalScroll}>
<MTableScrollbar
style={{
maxHeight: props.options.maxBodyHeight,
minHeight: props.options.minBodyHeight,
overflowY: props.options.overflowY
}}
ref={this.tableContainerDiv}
double={props.options.doubleHorizontalScroll}
>
<Droppable droppableId="headers" direction="horizontal">
{(provided, snapshot) => {
const table = this.renderTable(props);
return (
<div ref={provided.innerRef}>
<div
ref={this.tableContainerDiv}
style={{
maxHeight: props.options.maxBodyHeight,
minHeight: props.options.minBodyHeight,
overflowY: props.options.overflowY
}}
>
{this.state.width &&
props.options.fixedColumns &&
props.options.fixedColumns.right ? (
{this.state.width &&
props.options.fixedColumns &&
props.options.fixedColumns.right ? (
<div
style={{
width: this.getColumnsWidth(
props,
-1 * props.options.fixedColumns.right
),
position: 'absolute',
top: 0,
right: 0,
boxShadow: '-2px 0px 15px rgba(125,147,178,.25)',
overflowX: 'clip',
zIndex: 11
}}
>
<div
style={{
width: this.getColumnsWidth(
width: this.state.width,
background: 'white',
transform: `translateX(calc(${this.getColumnsWidth(
props,
-1 * props.options.fixedColumns.right
),
position: 'absolute',
top: 0,
right: 0,
boxShadow: '-2px 0px 15px rgba(125,147,178,.25)',
overflowX: 'clip',
zIndex: 11
)} - 100%))`
}}
>
<div
style={{
width: this.state.width,
background: 'white',
transform: `translateX(calc(${this.getColumnsWidth(
props,
-1 * props.options.fixedColumns.right
)} - 100%))`
}}
>
{table}
</div>
{table}
</div>
) : null}

<div>{table}</div>

{this.state.width &&
props.options.fixedColumns &&
props.options.fixedColumns.left ? (
</div>
) : null}

<div>{table}</div>

{this.state.width &&
props.options.fixedColumns &&
props.options.fixedColumns.left ? (
<div
style={{
width: this.getColumnsWidth(
props,
props.options.fixedColumns.left
),
position: 'absolute',
top: 0,
left: 0,
boxShadow: '2px 0px 15px rgba(125,147,178,.25)',
overflowX: 'clip',
zIndex: 11
}}
>
<div
style={{
width: this.getColumnsWidth(
props,
props.options.fixedColumns.left
),
position: 'absolute',
top: 0,
left: 0,
boxShadow: '2px 0px 15px rgba(125,147,178,.25)',
overflowX: 'clip',
zIndex: 11
width: this.state.width,
background: 'white'
}}
onKeyDown={(e) => {
if (e.key === 'Tab') {
e.preventDefault();
}
}}
>
<div
style={{
width: this.state.width,
background: 'white'
}}
onKeyDown={(e) => {
if (e.key === 'Tab') {
e.preventDefault();
}
}}
>
{table}
</div>
{table}
</div>
) : null}
</div>
</div>
) : null}
{provided.placeholder}
</div>
);
Expand Down
43 changes: 21 additions & 22 deletions src/utils/data-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ export default class DataManager {

this.tableStyleWidth =
this.tableWidth === 'full' ||
undefWidthCols.length > 0 ||
usedWidthNotPx.length > 0
undefWidthCols.length > 0 ||
usedWidthNotPx.length > 0
? '100%'
: usedWidthPx;
}
Expand Down Expand Up @@ -930,7 +930,7 @@ export default class DataManager {
this.treefied =
this.sorted =
this.paged =
false;
false;

this.filteredData = [...this.data];

Expand Down Expand Up @@ -1112,13 +1112,12 @@ export default class DataManager {
const path = [...(o.path || []), value];
let isDefaultExpanded = false;
switch (typeof this.defaultExpanded) {
case "boolean":
case 'boolean':
isDefaultExpanded = this.defaultExpanded;
break;
case "function":
case 'function':
isDefaultExpanded = this.defaultExpanded(currentRow);
break;

}
const oldGroup = this.findGroupByGroupPath(
this.groupedData,
Expand Down Expand Up @@ -1236,11 +1235,11 @@ export default class DataManager {
if (rowData.tableData.isTreeExpanded === undefined) {
let isExpanded = false;
switch (typeof this.defaultExpanded) {
case "boolean":
isDefaultExpanded = this.defaultExpanded;
case 'boolean':
isExpanded = this.defaultExpanded;
break;
case "function":
isDefaultExpanded = this.defaultExpanded(rowData);
case 'function':
isExpanded = this.defaultExpanded(rowData);
break;
}
rowData.tableData.isTreeExpanded = isExpanded;
Expand Down Expand Up @@ -1291,19 +1290,19 @@ export default class DataManager {
return list.sort(
columnDef.tableData.groupSort === 'desc'
? (a, b) =>
columnDef.customSort(
b.value,
a.value,
'group',
columnDef.tableData.groupSort
)
columnDef.customSort(
b.value,
a.value,
'group',
columnDef.tableData.groupSort
)
: (a, b) =>
columnDef.customSort(
a.value,
b.value,
'group',
columnDef.tableData.groupSort
)
columnDef.customSort(
a.value,
b.value,
'group',
columnDef.tableData.groupSort
)
);
} else {
return list.sort(
Expand Down