1 | "use strict";
|
2 |
|
3 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4 | var _typeof = require("@babel/runtime/helpers/typeof");
|
5 | Object.defineProperty(exports, "__esModule", {
|
6 | value: true
|
7 | });
|
8 | exports.default = MeasureCell;
|
9 | var React = _interopRequireWildcard(require("react"));
|
10 | var _rcResizeObserver = _interopRequireDefault(require("rc-resize-observer"));
|
11 | function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
12 | function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
13 | function MeasureCell(_ref) {
|
14 | var columnKey = _ref.columnKey,
|
15 | onColumnResize = _ref.onColumnResize;
|
16 | var cellRef = React.useRef();
|
17 | React.useEffect(function () {
|
18 | if (cellRef.current) {
|
19 | onColumnResize(columnKey, cellRef.current.offsetWidth);
|
20 | }
|
21 | }, []);
|
22 | return React.createElement(_rcResizeObserver.default, {
|
23 | data: columnKey
|
24 | }, React.createElement("td", {
|
25 | ref: cellRef,
|
26 | style: {
|
27 | padding: 0,
|
28 | border: 0,
|
29 | height: 0
|
30 | }
|
31 | }, React.createElement("div", {
|
32 | style: {
|
33 | height: 0,
|
34 | overflow: 'hidden'
|
35 | }
|
36 | }, "\xA0")));
|
37 | } |
\ | No newline at end of file |