UNPKG

@talend/react-components

Version:
48 lines (47 loc) 1.54 kB
import PropTypes from 'prop-types'; import { Component } from 'react'; import classnames from 'classnames'; import Action from '../../Actions/Action'; import styles from './CellWithIcon.module.scss'; /** * Cell renderer that displays text + icon */ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; class CellWithIcon extends Component { shouldComponentUpdate(nextProps) { return this.props.cellData !== nextProps.cellData || this.props.columnData !== nextProps.columnData || this.props.rowData !== nextProps.rowData; } render() { const { columnData, rowData, cellData } = this.props; const action = columnData.getIcon(rowData); return /*#__PURE__*/_jsxs("div", { className: classnames('cell-icon-container', styles['cell-icon-container']), children: [/*#__PURE__*/_jsx("div", { children: cellData }), /*#__PURE__*/_jsx("div", { className: classnames('icon-container', styles['icon-container']), children: action && /*#__PURE__*/_jsx(Action, { ...action, hideLabel: true, link: true }) })] }); } } CellWithIcon.displayName = 'VirtualizedList(CellWithIcon)'; CellWithIcon.propTypes = { // The cell value : props.rowData[props.dataKey] cellData: PropTypes.string, // Can be any object rowData: PropTypes.object, columnData: PropTypes.shape({ getIcon: PropTypes.func.isRequired }).isRequired }; export default CellWithIcon; //# sourceMappingURL=CellWithIcon.component.js.map