UNPKG

@talend/react-components

Version:
38 lines (37 loc) 1.05 kB
import PropTypes from 'prop-types'; import { Component } from 'react'; import Badge from '../../Badge'; /** * Cell renderer that displays a badge */ import { jsx as _jsx } from "react/jsx-runtime"; class CellBadge extends Component { shouldComponentUpdate(nextProps) { return this.props.cellData !== nextProps.cellData || this.props.columnData !== nextProps.columnData || this.props.rowIndex !== nextProps.rowIndex; } render() { const { columnData, cellData, rowIndex } = this.props; return /*#__PURE__*/_jsx(Badge, { id: `${rowIndex}`, label: cellData, selected: columnData.selected }); } } CellBadge.displayName = 'VirtualizedList(CellBadge)'; CellBadge.propTypes = { // The cell value : props.rowData[props.dataKey] cellData: PropTypes.string, // The collection item index. rowIndex: PropTypes.number, // Column data columnData: PropTypes.shape({ selected: PropTypes.bool }).isRequired }; export default CellBadge; //# sourceMappingURL=CellBadge.component.js.map