UNPKG

drip-table

Version:

A tiny and powerful enterprise-class solution for building tables.

35 lines (31 loc) 1.26 kB
/* * This file is part of the drip-table project. * @link : https://drip-table.jd.com/ * @author : Emil Zhai (root@derzh.com) * @modifier : Emil Zhai (root@derzh.com) * @copyright: Copyright (c) 2021 JD Network Technology Co., Ltd. */ import "./index.less"; import classNames from 'classnames'; import React from 'react'; var prefixCls = 'jfe-drip-table-rc-col'; var Col = /*#__PURE__*/React.memo(function (_ref) { var props = Object.assign({}, _ref); var style = React.useMemo(function () { var st = Object.assign({}, props.style); if (props.gutter) { var _props$style$marginLe, _props$style; st.marginLeft = (_props$style$marginLe = (_props$style = props.style) === null || _props$style === void 0 ? void 0 : _props$style.marginLeft) !== null && _props$style$marginLe !== void 0 ? _props$style$marginLe : "-".concat(props.gutter[1], "px"); st.padding = "0 ".concat(props.gutter[1], "px"); } if (props.span) { st.flexBasis = "".concat(Math.floor(props.span / 24 * 100) / 100, "%"); } return st; }, [props.style, props.span]); return /*#__PURE__*/React.createElement("div", { className: classNames(prefixCls, props.className), style: style }, props.children); }); export default Col;