material-table
Advanced tools
Comparing version 1.1.2 to 1.2.0
@@ -49,4 +49,4 @@ /* eslint-disable no-unused-vars */ | ||
actions: PropTypes.array.isRequired, | ||
data: PropTypes.object.isRequired | ||
data: PropTypes.oneOfType([PropTypes.object, PropTypes.arrayOf(PropTypes.object)]) | ||
}; | ||
export default MTableActions; |
@@ -63,3 +63,3 @@ import _objectSpread from "@babel/runtime/helpers/objectSpread"; | ||
numeric: ['numeric'].indexOf(this.props.columnDef.type) !== -1 | ||
}, this.getRenderValue() || ''); | ||
}, this.getRenderValue()); | ||
} | ||
@@ -66,0 +66,0 @@ |
@@ -24,7 +24,7 @@ /* eslint-disable no-unused-vars */ | ||
}, columnDef.sort !== false ? React.createElement(TableSortLabel, { | ||
active: this.props.orderBy === index, | ||
active: this.props.orderBy === columnDef.tableData.id, | ||
direction: this.props.orderDirection || 'asc', | ||
onClick: () => { | ||
const orderDirection = index !== this.props.orderBy ? 'asc' : this.props.orderDirection === 'asc' ? 'desc' : 'asc'; | ||
this.props.onOrderChanged(index, orderDirection); | ||
const orderDirection = columnDef.tableData.id !== this.props.orderBy ? 'asc' : this.props.orderDirection === 'asc' ? 'desc' : 'asc'; | ||
this.props.onOrderChanged(columnDef.tableData.id, orderDirection); | ||
} | ||
@@ -31,0 +31,0 @@ }, columnDef.title) : columnDef.title)))); |
@@ -115,3 +115,3 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
}, React.createElement(Typography, { | ||
variant: "title" | ||
variant: "h6" | ||
}, title)), React.createElement("div", { | ||
@@ -118,0 +118,0 @@ className: classes.spacer |
import _objectSpread from "@babel/runtime/helpers/objectSpread"; | ||
import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
@@ -18,2 +19,10 @@ /* eslint-disable no-unused-vars */ | ||
super(props); | ||
_defineProperty(this, "onSelectionChange", () => { | ||
if (this.props.onSelectionChange) { | ||
const selectedRows = this.state.data.filter(row => row.tableData.checked); | ||
this.props.onSelectionChange(selectedRows); | ||
} | ||
}); | ||
const calculatedProps = this.getProps(props); | ||
@@ -164,3 +173,3 @@ this.state = _objectSpread({ | ||
if (this.state && this.state.orderBy >= 0 && this.state.orderDirection) { | ||
const columnDef = this.state.columns[this.state.orderBy]; | ||
const columnDef = this.state.columns.find(_ => _.tableData.id === this.state.orderBy); | ||
renderData = renderData.sort(this.state.orderDirection === 'desc' ? (a, b) => this.sort(this.getFieldValue(b, columnDef), this.getFieldValue(a, columnDef), columnDef.type) : (a, b) => this.sort(this.getFieldValue(a, columnDef), this.getFieldValue(b, columnDef), columnDef.type)); | ||
@@ -271,3 +280,3 @@ } | ||
selectedCount | ||
}); | ||
}, () => this.onSelectionChange()); | ||
}, | ||
@@ -306,3 +315,3 @@ onOrderChanged: (orderBy, orderDirection) => { | ||
selectedCount: state.selectedCount + (checked ? 1 : -1) | ||
})); | ||
}), () => this.onSelectionChange()); | ||
} | ||
@@ -369,4 +378,5 @@ }))), this.renderFooter()); | ||
nRowsSelected: PropTypes.string | ||
}) | ||
}), | ||
onSelectionChange: PropTypes.func | ||
}; | ||
export default MaterialTable; |
@@ -11,2 +11,3 @@ import * as React from 'react'; | ||
localization?: Localization; | ||
onSelectionChange?: ([]) => void; | ||
} | ||
@@ -13,0 +14,0 @@ |
{ | ||
"name": "material-table", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "Datatable for React based on https://material-ui.com/api/table/ with additional features", | ||
@@ -43,3 +43,3 @@ "main": "dist/material-table.js", | ||
"buble": "0.19.3", | ||
"docz": "0.12.5", | ||
"docz": "0.12.10", | ||
"eslint": "5.7.0", | ||
@@ -46,0 +46,0 @@ "eslint-config-defaults": "9.0.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41792
1015