UNPKG

drip-table

Version:

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

31 lines (29 loc) 2.51 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-button'; var Button = /*#__PURE__*/React.memo(function (props) { var _classNames; return /*#__PURE__*/React.createElement("button", { type: "button", style: props.style, className: classNames("".concat(prefixCls), props.className, (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-primary"), props.type === 'primary'), _defineProperty(_classNames, "".concat(prefixCls, "-ghost"), props.type === 'ghost'), _defineProperty(_classNames, "".concat(prefixCls, "-dashed"), props.type === 'dashed'), _defineProperty(_classNames, "".concat(prefixCls, "-text"), props.type === 'text'), _defineProperty(_classNames, "".concat(prefixCls, "-link"), props.type === 'link'), _defineProperty(_classNames, "".concat(prefixCls, "-default"), props.type === 'default'), _defineProperty(_classNames, "".concat(prefixCls, "-circle"), props.shape === 'circle'), _defineProperty(_classNames, "".concat(prefixCls, "-round"), props.shape === 'round'), _defineProperty(_classNames, "".concat(prefixCls, "-sm"), props.size === 'small'), _defineProperty(_classNames, "".concat(prefixCls, "-lg"), props.size === 'large'), _defineProperty(_classNames, "".concat(prefixCls, "-danger"), props.danger), _defineProperty(_classNames, "".concat(prefixCls, "-background-ghost"), props.ghost), _defineProperty(_classNames, "".concat(prefixCls, "-icon-only"), !props.children && props.icon), _classNames)), disabled: props.disabled, onClick: props.onClick }, props.icon && props.iconPosition === 'left' && /*#__PURE__*/React.createElement("span", { className: "".concat(prefixCls, "-icon") }, props.icon), props.children && /*#__PURE__*/React.createElement("span", { className: "".concat(prefixCls, "-label") }, props.children), props.icon && props.iconPosition !== 'left' && /*#__PURE__*/React.createElement("span", { className: "".concat(prefixCls, "-icon") }, props.icon)); }); export default Button;