How to use the @patternfly/react-table.TableBody.defaultProps function in @patternfly/react-table

To help you get started, we’ve selected a few @patternfly/react-table examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github patternfly / patternfly-react / packages / patternfly-4 / react-inline-edit-extension / src / components / InlineEdit / editableTableBody.js View on Github external
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) &&