UNPKG

choerodon-ui

Version:

An enterprise-class UI design language and React-based implementation

85 lines (67 loc) 2.22 kB
import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; import _createClass from "@babel/runtime/helpers/createClass"; import _inherits from "@babel/runtime/helpers/inherits"; import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; function _createSuper(Derived) { function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } return function () { var Super = _getPrototypeOf(Derived), result; if (isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } import React, { PureComponent } from 'react'; import Icon from '../icon'; import { stopEvent, stopPropagation } from '../_util/EventManager'; var CloseButton = /*#__PURE__*/ function (_PureComponent) { _inherits(CloseButton, _PureComponent); var _super = _createSuper(CloseButton); function CloseButton() { var _this; _classCallCheck(this, CloseButton); _this = _super.apply(this, arguments); _this.handleClick = function (e) { stopEvent(e); var _this$props = _this.props, onClose = _this$props.onClose, value = _this$props.value, index = _this$props.index; onClose(e, value, index); }; return _this; } _createClass(CloseButton, [{ key: "render", value: function render() { return React.createElement(Icon, { type: "cancel", onClick: this.handleClick, onFocus: stopPropagation, onMouseDown: stopEvent, tabIndex: -1 }); } }]); return CloseButton; }(PureComponent); export { CloseButton as default }; //# sourceMappingURL=CloseButton.js.map