choerodon-ui
Version:
An enterprise-class UI design language and React-based implementation
106 lines (88 loc) • 2.56 kB
JavaScript
import _extends from "@babel/runtime/helpers/extends";
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, { Component } from 'react';
import PropTypes from 'prop-types';
import Icon from '../icon';
import RcRate from '../rc-components/rate';
import ConfigContext from '../config-provider/ConfigContext';
var Rate =
/*#__PURE__*/
function (_Component) {
_inherits(Rate, _Component);
var _super = _createSuper(Rate);
function Rate() {
var _this;
_classCallCheck(this, Rate);
_this = _super.apply(this, arguments);
_this.saveRate = function (node) {
_this.rcRate = node;
};
return _this;
}
_createClass(Rate, [{
key: "focus",
value: function focus() {
this.rcRate.focus();
}
}, {
key: "blur",
value: function blur() {
this.rcRate.blur();
}
}, {
key: "render",
value: function render() {
var getPrefixCls = this.context.getPrefixCls;
return React.createElement(RcRate, _extends({
ref: this.saveRate,
prefixCls: getPrefixCls('rate')
}, this.props));
}
}], [{
key: "contextType",
get: function get() {
return ConfigContext;
}
}]);
return Rate;
}(Component);
export { Rate as default };
Rate.displayName = 'Rate';
Rate.propTypes = {
prefixCls: PropTypes.string,
character: PropTypes.node
};
Rate.defaultProps = {
character: React.createElement(Icon, {
type: "star"
})
};
//# sourceMappingURL=index.js.map