UNPKG

eg-dropdown

Version:

eg-dropdown is deprecated ,please use react-drop-tree solution instead

64 lines (47 loc) 3.13 kB
/** * Created by slashhuang on 16/5/19. * js编写输入框取消按钮 */ 'use strict'; exports.__esModule = true; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var _react = require('react'); var _react2 = _interopRequireDefault(_react); var Drawing = (function (_Component) { _inherits(Drawing, _Component); function Drawing() { _classCallCheck(this, Drawing); _Component.call(this); } Drawing.prototype.calculateSize = function calculateSize() { var delta = arguments.length <= 0 || arguments[0] === undefined ? 0 : arguments[0]; var _props = this.props; var size = _props.size; var show = _props.show; return { width: size + delta + 'px', height: size + delta + 'px', visibility: show ? 'visible' : 'hidden' }; }; Drawing.prototype.render = function render() { var inlineStyle = { width: this.calculateSize(-5).width }; return _react2['default'].createElement( 'div', _extends({ style: this.calculateSize(), className: 'common-input-cancel-button' }, this.props), _react2['default'].createElement('i', { style: inlineStyle, className: 'left-rotate' }), _react2['default'].createElement('i', { style: inlineStyle, className: 'right-rotate' }) ); }; _createClass(Drawing, null, [{ key: 'defaultProps', value: { size: 19, show: false }, enumerable: true }]); return Drawing; })(_react.Component); exports['default'] = Drawing; module.exports = exports['default'];