UNPKG

drip-table

Version:

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

37 lines (34 loc) 1.36 kB
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } /* * 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-tag'; var Tag = /*#__PURE__*/React.memo(function (props) { var color = React.useMemo(function () { var _props$color; if ((_props$color = props.color) !== null && _props$color !== void 0 && _props$color.match(/^[\x2Da-z]+$/)) { return { style: props.color, className: "".concat(prefixCls, "-color-").concat(props.color) }; } return { style: props.color, className: '' }; }, [props.color]); return /*#__PURE__*/React.createElement("span", { style: Object.assign({ color: color.style }, props.style), className: classNames("".concat(prefixCls), props.className, color.className, _defineProperty({}, "".concat(prefixCls, "-has-color"), props.color)) }, props.children); }); export default Tag;