UNPKG

709 BJavaScriptView Raw
1import * as React from 'react';
2import ResizeObserver from 'rc-resize-observer';
3export default function MeasureCell(_ref) {
4 var columnKey = _ref.columnKey,
5 onColumnResize = _ref.onColumnResize;
6 var cellRef = React.useRef();
7 React.useEffect(function () {
8 if (cellRef.current) {
9 onColumnResize(columnKey, cellRef.current.offsetWidth);
10 }
11 }, []);
12 return /*#__PURE__*/React.createElement(ResizeObserver, {
13 data: columnKey
14 }, /*#__PURE__*/React.createElement("td", {
15 ref: cellRef,
16 style: {
17 padding: 0,
18 border: 0,
19 height: 0
20 }
21 }, /*#__PURE__*/React.createElement("div", {
22 style: {
23 height: 0,
24 overflow: 'hidden'
25 }
26 }, "\xA0")));
27}
\No newline at end of file