UNPKG

@jannie-shao/components-antd4

Version:
40 lines 1.3 kB
import "antd/es/row/style"; import _Row from "antd/es/row"; import "antd/es/col/style"; import _Col from "antd/es/col"; import React from 'react'; import PropTypes from 'prop-types'; import classnames from 'classnames'; import { rootPrefix } from "../style/config"; var prefix = rootPrefix + "-grid-list"; var GridList = function GridList(_ref) { var _ref$className = _ref.className, className = _ref$className === void 0 ? '' : _ref$className, col = _ref.col, columns = _ref.columns, dataSource = _ref.dataSource; return /*#__PURE__*/React.createElement(_Row, { className: classnames(prefix, className) }, columns.map(function (c) { return /*#__PURE__*/React.createElement(_Col, { key: c.dataIndex, span: parseInt(24 / col, 10) }, /*#__PURE__*/React.createElement(_Row, null, /*#__PURE__*/React.createElement(_Col, { className: prefix + "-label", span: 8 }, c.title), /*#__PURE__*/React.createElement(_Col, { span: 16 }, c.render ? c.render(dataSource[c.dataIndex], dataSource) : dataSource[c.dataIndex]))); })); }; GridList.propTypes = { col: PropTypes.number, columns: PropTypes.array, dataSource: PropTypes.object }; GridList.defaultProps = { col: 2, columns: [], dataSource: {} }; export default GridList;