UNPKG

@qn-pandora/pandora-visualization

Version:

Pandora 通用可视化库

16 lines (15 loc) 774 B
import * as React from 'react'; import { Resizable } from 'react-resizable'; import * as styles from '../../style.mless'; export default function Cell(props) { var col = props.col, renderDom = props.renderDom, handleCellResize = props.handleCellResize; var width = props.width || col.width || 0; var cell = (React.createElement("div", { className: styles.td, key: col.key, style: { width: props.width || col.width || 0 } }, renderDom)); if (typeof width === 'string') { return cell; } return (React.createElement(Resizable, { key: col.key, width: width, height: 0, minConstraints: [0, 10], onResize: function (_, _a) { var size = _a.size; return handleCellResize({ size: size }, col.dataIndex); } }, cell)); }