UNPKG

zent

Version:

一套前端设计语言和基于React的实现

29 lines (28 loc) 1.85 kB
import { __assign, __extends, __rest } from "tslib"; import { jsx as _jsx } from "react/jsx-runtime"; import { Component } from 'react'; import Group from './Group'; import { ButtonDirective } from './Directive'; import { PopoverHoverTriggerContext, } from '../popover'; var Button = (function (_super) { __extends(Button, _super); function Button() { return _super !== null && _super.apply(this, arguments) || this; } Button.prototype.render = function () { var _a = this.props, href = _a.href, target = _a.target, htmlType = _a.htmlType, type = _a.type, size = _a.size, block = _a.block, disabled = _a.disabled, loading = _a.loading, outline = _a.outline, bordered = _a.bordered, icon = _a.icon, children = _a.children, download = _a.download, props = __rest(_a, ["href", "target", "htmlType", "type", "size", "block", "disabled", "loading", "outline", "bordered", "icon", "children", "download"]); return (_jsx(ButtonDirective, __assign({ type: type, size: size, block: block, disabled: disabled, loading: loading, outline: outline, bordered: bordered, icon: icon, onMouseEnter: this.props.onMouseEnter, onMouseLeave: this.props.onMouseLeave }, { children: href || target ? (_jsx("a", __assign({ href: disabled ? undefined : href || '', target: target, download: download }, props, { "data-zv": '10.0.17' }, { children: children }), void 0)) : (_jsx("button", __assign({ type: htmlType }, props, { "data-zv": '10.0.17' }, { children: children }), void 0)) }), void 0)); }; Button.defaultProps = { type: 'default', size: 'medium', htmlType: 'button', bordered: true, }; Button.Group = Group; Button.Directive = ButtonDirective; Button.contextType = PopoverHoverTriggerContext; return Button; }(Component)); export { Button }; export default Button;