Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { showIdWarnings } from './utils/utils';
const propTypes = {
...TableBody.propTypes,
editConfig: PropTypes.shape({
editConfirmationType: PropTypes.oneOf(Object.values(TableEditConfirmation)),
onEditCellClicked: PropTypes.func,
onEditConfirmed: PropTypes.func,
onEditCanceled: PropTypes.func
}).isRequired,
/** Function that is fired when user clicks on a row if not editing. */
onRowClick: PropTypes.func
};
const defaultProps = {
...TableBody.defaultProps,
editConfig: null,
onRowClick: () => undefined
};
const resolveCascadeEditability = rows => {
const isRowExpandedIndexes = new Set(
rows.map((row, idx) => (isRowExpanded(row, rows) ? idx : null)).filter(row => row !== null)
);
// flag parents and their children which are edited together
rows
.filter(
(row, idx) =>
row.parent !== undefined &&
row.isEditing &&
isRowExpandedIndexes.has(idx) &&