UNPKG

tinper-bee

Version:

React Components living for enterprise-class pc backend application

1,641 lines (1,278 loc) 42 kB
(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("react"), require("prop-types"), require("react-dom")); else if(typeof define === 'function' && define.amd) define(["react", "prop-types", "react-dom"], factory); else { var a = typeof exports === 'object' ? factory(require("react"), require("prop-types"), require("react-dom")) : factory(root["React"], root["PropTypes"], root["ReactDOM"]); for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; } })(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_0__, __WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_3__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 1496); /******/ }) /************************************************************************/ /******/ ({ /***/ 0: /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_0__; /***/ }), /***/ 1: /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_1__; /***/ }), /***/ 130: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /** * @ignore * some key-codes definition and utils from closure-library * @author yiminghe@gmail.com */ var KeyCode = { /** * MAC_ENTER */ MAC_ENTER: 3, /** * BACKSPACE */ BACKSPACE: 8, /** * TAB */ TAB: 9, /** * NUMLOCK on FF/Safari Mac */ NUM_CENTER: 12, /** * ENTER */ ENTER: 13, /** * SHIFT */ SHIFT: 16, /** * CTRL */ CTRL: 17, /** * ALT */ ALT: 18, /** * PAUSE */ PAUSE: 19, /** * CAPS_LOCK */ CAPS_LOCK: 20, /** * ESC */ ESC: 27, /** * SPACE */ SPACE: 32, /** * PAGE_UP */ PAGE_UP: 33, /** * PAGE_DOWN */ PAGE_DOWN: 34, /** * END */ END: 35, /** * HOME */ HOME: 36, /** * LEFT */ LEFT: 37, /** * UP */ UP: 38, /** * RIGHT */ RIGHT: 39, /** * DOWN */ DOWN: 40, /** * PRINT_SCREEN */ PRINT_SCREEN: 44, /** * INSERT */ INSERT: 45, /** * DELETE */ DELETE: 46, /** * ZERO */ ZERO: 48, /** * ONE */ ONE: 49, /** * TWO */ TWO: 50, /** * THREE */ THREE: 51, /** * FOUR */ FOUR: 52, /** * FIVE */ FIVE: 53, /** * SIX */ SIX: 54, /** * SEVEN */ SEVEN: 55, /** * EIGHT */ EIGHT: 56, /** * NINE */ NINE: 57, /** * QUESTION_MARK */ QUESTION_MARK: 63, /** * A */ A: 65, /** * B */ B: 66, /** * C */ C: 67, /** * D */ D: 68, /** * E */ E: 69, /** * F */ F: 70, /** * G */ G: 71, /** * H */ H: 72, /** * I */ I: 73, /** * J */ J: 74, /** * K */ K: 75, /** * L */ L: 76, /** * M */ M: 77, /** * N */ N: 78, /** * O */ O: 79, /** * P */ P: 80, /** * Q */ Q: 81, /** * R */ R: 82, /** * S */ S: 83, /** * T */ T: 84, /** * U */ U: 85, /** * V */ V: 86, /** * W */ W: 87, /** * X */ X: 88, /** * Y */ Y: 89, /** * Z */ Z: 90, /** * META */ META: 91, /** * WIN_KEY_RIGHT */ WIN_KEY_RIGHT: 92, /** * CONTEXT_MENU */ CONTEXT_MENU: 93, /** * NUM_ZERO */ NUM_ZERO: 96, /** * NUM_ONE */ NUM_ONE: 97, /** * NUM_TWO */ NUM_TWO: 98, /** * NUM_THREE */ NUM_THREE: 99, /** * NUM_FOUR */ NUM_FOUR: 100, /** * NUM_FIVE */ NUM_FIVE: 101, /** * NUM_SIX */ NUM_SIX: 102, /** * NUM_SEVEN */ NUM_SEVEN: 103, /** * NUM_EIGHT */ NUM_EIGHT: 104, /** * NUM_NINE */ NUM_NINE: 105, /** * NUM_MULTIPLY */ NUM_MULTIPLY: 106, /** * NUM_PLUS */ NUM_PLUS: 107, /** * NUM_MINUS */ NUM_MINUS: 109, /** * NUM_PERIOD */ NUM_PERIOD: 110, /** * NUM_DIVISION */ NUM_DIVISION: 111, /** * F1 */ F1: 112, /** * F2 */ F2: 113, /** * F3 */ F3: 114, /** * F4 */ F4: 115, /** * F5 */ F5: 116, /** * F6 */ F6: 117, /** * F7 */ F7: 118, /** * F8 */ F8: 119, /** * F9 */ F9: 120, /** * F10 */ F10: 121, /** * F11 */ F11: 122, /** * F12 */ F12: 123, /** * NUMLOCK */ NUMLOCK: 144, /** * SEMICOLON */ SEMICOLON: 186, /** * DASH */ DASH: 189, /** * EQUALS */ EQUALS: 187, /** * COMMA */ COMMA: 188, /** * PERIOD */ PERIOD: 190, /** * SLASH */ SLASH: 191, /** * APOSTROPHE */ APOSTROPHE: 192, /** * SINGLE_QUOTE */ SINGLE_QUOTE: 222, /** * OPEN_SQUARE_BRACKET */ OPEN_SQUARE_BRACKET: 219, /** * BACKSLASH */ BACKSLASH: 220, /** * CLOSE_SQUARE_BRACKET */ CLOSE_SQUARE_BRACKET: 221, /** * WIN_KEY */ WIN_KEY: 224, /** * MAC_FF_META */ MAC_FF_META: 224, /** * WIN_IME */ WIN_IME: 229, // ======================== Function ======================== /** * whether text and modified key is entered at the same time. */ isTextModifyingKeyEvent: function isTextModifyingKeyEvent(e) { var keyCode = e.keyCode; if (e.altKey && !e.ctrlKey || e.metaKey || // Function keys don't generate text keyCode >= KeyCode.F1 && keyCode <= KeyCode.F12) { return false; } // The following keys are quite harmless, even in combination with // CTRL, ALT or SHIFT. switch (keyCode) { case KeyCode.ALT: case KeyCode.CAPS_LOCK: case KeyCode.CONTEXT_MENU: case KeyCode.CTRL: case KeyCode.DOWN: case KeyCode.END: case KeyCode.ESC: case KeyCode.HOME: case KeyCode.INSERT: case KeyCode.LEFT: case KeyCode.MAC_FF_META: case KeyCode.META: case KeyCode.NUMLOCK: case KeyCode.NUM_CENTER: case KeyCode.PAGE_DOWN: case KeyCode.PAGE_UP: case KeyCode.PAUSE: case KeyCode.PRINT_SCREEN: case KeyCode.RIGHT: case KeyCode.SHIFT: case KeyCode.UP: case KeyCode.WIN_KEY: case KeyCode.WIN_KEY_RIGHT: return false; default: return true; } }, /** * whether character is entered. */ isCharacterKey: function isCharacterKey(keyCode) { if (keyCode >= KeyCode.ZERO && keyCode <= KeyCode.NINE) { return true; } if (keyCode >= KeyCode.NUM_ZERO && keyCode <= KeyCode.NUM_MULTIPLY) { return true; } if (keyCode >= KeyCode.A && keyCode <= KeyCode.Z) { return true; } // Safari sends zero key code for non-latin characters. if (window.navigator.userAgent.indexOf('WebKit') !== -1 && keyCode === 0) { return true; } switch (keyCode) { case KeyCode.SPACE: case KeyCode.QUESTION_MARK: case KeyCode.NUM_PLUS: case KeyCode.NUM_MINUS: case KeyCode.NUM_PERIOD: case KeyCode.NUM_DIVISION: case KeyCode.SEMICOLON: case KeyCode.DASH: case KeyCode.EQUALS: case KeyCode.COMMA: case KeyCode.PERIOD: case KeyCode.SLASH: case KeyCode.APOSTROPHE: case KeyCode.SINGLE_QUOTE: case KeyCode.OPEN_SQUARE_BRACKET: case KeyCode.BACKSLASH: case KeyCode.CLOSE_SQUARE_BRACKET: return true; default: return false; } } }; /* harmony default export */ __webpack_exports__["a"] = (KeyCode); /***/ }), /***/ 1496: /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(1497); /***/ }), /***/ 1497: /***/ (function(module, exports, __webpack_require__) { __webpack_require__(1498); module.exports = __webpack_require__(1499); /***/ }), /***/ 1498: /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), /***/ 1499: /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _Rate = __webpack_require__(1500); var _Rate2 = _interopRequireDefault(_Rate); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } exports["default"] = _Rate2["default"]; module.exports = exports['default']; /***/ }), /***/ 1500: /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _rcRate = __webpack_require__(1501); var _rcRate2 = _interopRequireDefault(_rcRate); var _beeIcon = __webpack_require__(1505); var _beeIcon2 = _interopRequireDefault(_beeIcon); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 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) : _defaults(subClass, superClass); } var propTypes = { count: _propTypes2["default"].number, value: _propTypes2["default"].number, defaultValue: _propTypes2["default"].number, onChange: _propTypes2["default"].func, onHoverChange: _propTypes2["default"].func, allowHalf: _propTypes2["default"].bool, disabled: _propTypes2["default"].bool, className: _propTypes2["default"].string, style: _propTypes2["default"].object }; var defaultProps = { count: 5, defaultValue: 0, value: 0, onChange: function onChange() {}, onHoverChange: function onHoverChange() {}, allowHalf: false, disabled: false, character: _react2["default"].createElement(_beeIcon2["default"], { type: 'uf-star' }), className: '', style: {}, clsPrefix: 'u-rate' }; var Rate = function (_Component) { _inherits(Rate, _Component); function Rate() { _classCallCheck(this, Rate); return _possibleConstructorReturn(this, _Component.apply(this, arguments)); } Rate.prototype.render = function render() { var _props = this.props, count = _props.count, value = _props.value, defaultValue = _props.defaultValue, onChange = _props.onChange, clsPrefix = _props.clsPrefix, onHoverChange = _props.onHoverChange, allowHalf = _props.allowHalf, disabled = _props.disabled, character = _props.character, className = _props.className, style = _props.style; return _react2["default"].createElement(_rcRate2["default"], { prefixCls: clsPrefix, count: count, value: value, defaultValue: defaultValue, onChange: onChange, onHoverChange: onHoverChange, allowHalf: allowHalf, disabled: disabled, character: character, className: className, style: style }); }; return Rate; }(_react.Component); ; Rate.propTypes = propTypes; Rate.defaultProps = defaultProps; exports["default"] = Rate; module.exports = exports['default']; /***/ }), /***/ 1501: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Rate__ = __webpack_require__(1502); /* harmony default export */ __webpack_exports__["default"] = (__WEBPACK_IMPORTED_MODULE_0__Rate__["a" /* default */]); /***/ }), /***/ 1502: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(0); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_rc_util_es_Dom_findDOMNode__ = __webpack_require__(919); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_classnames__ = __webpack_require__(4); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_classnames___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_classnames__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_rc_util_es_KeyCode__ = __webpack_require__(130); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util__ = __webpack_require__(1503); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Star__ = __webpack_require__(1504); function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } 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; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { 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); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 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; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function noop() {} var Rate = /*#__PURE__*/function (_React$Component) { _inherits(Rate, _React$Component); var _super = _createSuper(Rate); function Rate(props) { var _this; _classCallCheck(this, Rate); _this = _super.call(this, props); _this.onHover = function (event, index) { var onHoverChange = _this.props.onHoverChange; var hoverValue = _this.getStarValue(index, event.pageX); var cleanedValue = _this.state.cleanedValue; if (hoverValue !== cleanedValue) { _this.setState({ hoverValue: hoverValue, cleanedValue: null }); } onHoverChange(hoverValue); }; _this.onMouseLeave = function () { var onHoverChange = _this.props.onHoverChange; _this.setState({ hoverValue: undefined, cleanedValue: null }); onHoverChange(undefined); }; _this.onClick = function (event, index) { var allowClear = _this.props.allowClear; var value = _this.state.value; var newValue = _this.getStarValue(index, event.pageX); var isReset = false; if (allowClear) { isReset = newValue === value; } _this.onMouseLeave(); _this.changeValue(isReset ? 0 : newValue); _this.setState({ cleanedValue: isReset ? newValue : null }); }; _this.onFocus = function () { var onFocus = _this.props.onFocus; _this.setState({ focused: true }); if (onFocus) { onFocus(); } }; _this.onBlur = function () { var onBlur = _this.props.onBlur; _this.setState({ focused: false }); if (onBlur) { onBlur(); } }; _this.onKeyDown = function (event) { var keyCode = event.keyCode; var _this$props = _this.props, count = _this$props.count, allowHalf = _this$props.allowHalf, onKeyDown = _this$props.onKeyDown, direction = _this$props.direction; var reverse = direction === 'rtl'; var value = _this.state.value; if (keyCode === __WEBPACK_IMPORTED_MODULE_3_rc_util_es_KeyCode__["a" /* default */].RIGHT && value < count && !reverse) { if (allowHalf) { value += 0.5; } else { value += 1; } _this.changeValue(value); event.preventDefault(); } else if (keyCode === __WEBPACK_IMPORTED_MODULE_3_rc_util_es_KeyCode__["a" /* default */].LEFT && value > 0 && !reverse) { if (allowHalf) { value -= 0.5; } else { value -= 1; } _this.changeValue(value); event.preventDefault(); } else if (keyCode === __WEBPACK_IMPORTED_MODULE_3_rc_util_es_KeyCode__["a" /* default */].RIGHT && value > 0 && reverse) { if (allowHalf) { value -= 0.5; } else { value -= 1; } _this.changeValue(value); event.preventDefault(); } else if (keyCode === __WEBPACK_IMPORTED_MODULE_3_rc_util_es_KeyCode__["a" /* default */].LEFT && value < count && reverse) { if (allowHalf) { value += 0.5; } else { value += 1; } _this.changeValue(value); event.preventDefault(); } if (onKeyDown) { onKeyDown(event); } }; _this.saveRef = function (index) { return function (node) { _this.stars[index] = node; }; }; _this.saveRate = function (node) { _this.rate = node; }; var value = props.value; if (value === undefined) { value = props.defaultValue; } _this.stars = {}; _this.state = { value: value, focused: false, cleanedValue: null }; return _this; } _createClass(Rate, [{ key: "componentDidMount", value: function componentDidMount() { var _this$props2 = this.props, autoFocus = _this$props2.autoFocus, disabled = _this$props2.disabled; if (autoFocus && !disabled) { this.focus(); } } }, { key: "getStarDOM", value: function getStarDOM(index) { return Object(__WEBPACK_IMPORTED_MODULE_1_rc_util_es_Dom_findDOMNode__["a" /* default */])(this.stars[index]); } }, { key: "getStarValue", value: function getStarValue(index, x) { var _this$props3 = this.props, allowHalf = _this$props3.allowHalf, direction = _this$props3.direction; var reverse = direction === 'rtl'; var value = index + 1; if (allowHalf) { var starEle = this.getStarDOM(index); var leftDis = Object(__WEBPACK_IMPORTED_MODULE_4__util__["a" /* getOffsetLeft */])(starEle); var width = starEle.clientWidth; if (reverse && x - leftDis > width / 2) { value -= 0.5; } else if (!reverse && x - leftDis < width / 2) { value -= 0.5; } } return value; } }, { key: "focus", value: function focus() { var disabled = this.props.disabled; if (!disabled) { this.rate.focus(); } } }, { key: "blur", value: function blur() { var disabled = this.props.disabled; if (!disabled) { this.rate.blur(); } } }, { key: "changeValue", value: function changeValue(value) { var onChange = this.props.onChange; if (!('value' in this.props)) { this.setState({ value: value }); } onChange(value); } }, { key: "render", value: function render() { var _this$props4 = this.props, count = _this$props4.count, allowHalf = _this$props4.allowHalf, style = _this$props4.style, prefixCls = _this$props4.prefixCls, disabled = _this$props4.disabled, className = _this$props4.className, character = _this$props4.character, characterRender = _this$props4.characterRender, tabIndex = _this$props4.tabIndex, direction = _this$props4.direction; var _this$state = this.state, value = _this$state.value, hoverValue = _this$state.hoverValue, focused = _this$state.focused; var stars = []; var disabledClass = disabled ? "".concat(prefixCls, "-disabled") : ''; for (var index = 0; index < count; index += 1) { stars.push(__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_5__Star__["a" /* default */], { ref: this.saveRef(index), index: index, count: count, disabled: disabled, prefixCls: "".concat(prefixCls, "-star"), allowHalf: allowHalf, value: hoverValue === undefined ? value : hoverValue, onClick: this.onClick, onHover: this.onHover, key: index, character: character, characterRender: characterRender, focused: focused })); } var rateClassName = __WEBPACK_IMPORTED_MODULE_2_classnames___default()(prefixCls, disabledClass, className, _defineProperty({}, "".concat(prefixCls, "-rtl"), direction === 'rtl')); return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement("ul", { className: rateClassName, style: style, onMouseLeave: disabled ? null : this.onMouseLeave, tabIndex: disabled ? -1 : tabIndex, onFocus: disabled ? null : this.onFocus, onBlur: disabled ? null : this.onBlur, onKeyDown: disabled ? null : this.onKeyDown, ref: this.saveRate, role: "radiogroup" }, stars); } }], [{ key: "getDerivedStateFromProps", value: function getDerivedStateFromProps(nextProps, state) { if ('value' in nextProps && nextProps.value !== undefined) { return _objectSpread({}, state, { value: nextProps.value }); } return state; } }]); return Rate; }(__WEBPACK_IMPORTED_MODULE_0_react___default.a.Component); Rate.defaultProps = { defaultValue: 0, count: 5, allowHalf: false, allowClear: true, style: {}, prefixCls: 'rc-rate', onChange: noop, character: '★', onHoverChange: noop, tabIndex: 0, direction: 'ltr' }; /* harmony default export */ __webpack_exports__["a"] = (Rate); /***/ }), /***/ 1503: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = getOffsetLeft; /* eslint-disable import/prefer-default-export */ function getScroll(w) { var ret = w.pageXOffset; var method = 'scrollLeft'; if (typeof ret !== 'number') { var d = w.document; // ie6,7,8 standard mode ret = d.documentElement[method]; if (typeof ret !== 'number') { // quirks mode ret = d.body[method]; } } return ret; } function getClientPosition(elem) { var x; var y; var doc = elem.ownerDocument; var body = doc.body; var docElem = doc && doc.documentElement; var box = elem.getBoundingClientRect(); x = box.left; y = box.top; x -= docElem.clientLeft || body.clientLeft || 0; y -= docElem.clientTop || body.clientTop || 0; return { left: x, top: y }; } function getOffsetLeft(el) { var pos = getClientPosition(el); var doc = el.ownerDocument; // Only IE use `parentWindow` var w = doc.defaultView || doc.parentWindow; pos.left += getScroll(w); return pos.left; } /***/ }), /***/ 1504: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Star; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(0); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__); function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { 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); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 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; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } var Star = /*#__PURE__*/function (_React$Component) { _inherits(Star, _React$Component); var _super = _createSuper(Star); function Star() { var _this; _classCallCheck(this, Star); _this = _super.apply(this, arguments); _this.onHover = function (e) { var _this$props = _this.props, onHover = _this$props.onHover, index = _this$props.index; onHover(e, index); }; _this.onClick = function (e) { var _this$props2 = _this.props, onClick = _this$props2.onClick, index = _this$props2.index; onClick(e, index); }; _this.onKeyDown = function (e) { var _this$props3 = _this.props, onClick = _this$props3.onClick, index = _this$props3.index; if (e.keyCode === 13) { onClick(e, index); } }; return _this; } _createClass(Star, [{ key: "getClassName", value: function getClassName() { var _this$props4 = this.props, prefixCls = _this$props4.prefixCls, index = _this$props4.index, value = _this$props4.value, allowHalf = _this$props4.allowHalf, focused = _this$props4.focused; var starValue = index + 1; var className = prefixCls; if (value === 0 && index === 0 && focused) { className += " ".concat(prefixCls, "-focused"); } else if (allowHalf && value + 0.5 === starValue) { className += " ".concat(prefixCls, "-half ").concat(prefixCls, "-active"); if (focused) { className += " ".concat(prefixCls, "-focused"); } } else { className += starValue <= value ? " ".concat(prefixCls, "-full") : " ".concat(prefixCls, "-zero"); if (starValue === value && focused) { className += " ".concat(prefixCls, "-focused"); } } return className; } }, { key: "render", value: function render() { var onHover = this.onHover, onClick = this.onClick, onKeyDown = this.onKeyDown; var _this$props5 = this.props, disabled = _this$props5.disabled, prefixCls = _this$props5.prefixCls, character = _this$props5.character, characterRender = _this$props5.characterRender, index = _this$props5.index, count = _this$props5.count, value = _this$props5.value; var start = __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement("li", { className: this.getClassName() }, __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement("div", { onClick: disabled ? null : onClick, onKeyDown: disabled ? null : onKeyDown, onMouseMove: disabled ? null : onHover, role: "radio", "aria-checked": value > index ? 'true' : 'false', "aria-posinset": index + 1, "aria-setsize": count, tabIndex: 0 }, __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement("div", { className: "".concat(prefixCls, "-first") }, character), __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement("div", { className: "".concat(prefixCls, "-second") }, character))); if (characterRender) { start = characterRender(start, this.props); } return start; } }]); return Star; }(__WEBPACK_IMPORTED_MODULE_0_react___default.a.Component); /***/ }), /***/ 1505: /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _Icon = __webpack_require__(1506); var _Icon2 = _interopRequireDefault(_Icon); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } exports["default"] = _Icon2["default"]; module.exports = exports['default']; /***/ }), /***/ 1506: /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: 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 _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); var _classnames = __webpack_require__(4); var _classnames2 = _interopRequireDefault(_classnames); var _propTypes = __webpack_require__(1); var _propTypes2 = _interopRequireDefault(_propTypes); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 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) : _defaults(subClass, superClass); } var propTypes = { type: _propTypes2["default"].string }; /** * badge 默认显示内容1 */ var defaultProps = { clsPrefix: 'uf' }; var Icon = function (_Component) { _inherits(Icon, _Component); function Icon(props) { _classCallCheck(this, Icon); return _possibleConstructorReturn(this, _Component.call(this, props)); } Icon.prototype.render = function render() { var _props = this.props, type = _props.type, className = _props.className, clsPrefix = _props.clsPrefix, others = _objectWithoutProperties(_props, ['type', 'className', 'clsPrefix']); var clsObj = {}; var classNames = (0, _classnames2["default"])(clsPrefix, type); return _react2["default"].createElement('i', _extends({}, others, { className: (0, _classnames2["default"])(classNames, className) })); }; return Icon; }(_react.Component); Icon.defaultProps = defaultProps; Icon.propTypes = propTypes; exports["default"] = Icon; module.exports = exports['default']; /***/ }), /***/ 3: /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_3__; /***/ }), /***/ 4: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! Copyright (c) 2017 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ /* global define */ (function () { 'use strict'; var hasOwn = {}.hasOwnProperty; function classNames () { var classes = []; for (var i = 0; i < arguments.length; i++) { var arg = arguments[i]; if (!arg) continue; var argType = typeof arg; if (argType === 'string' || argType === 'number') { classes.push(arg); } else if (Array.isArray(arg) && arg.length) { var inner = classNames.apply(null, arg); if (inner) { classes.push(inner); } } else if (argType === 'object') { for (var key in arg) { if (hasOwn.call(arg, key) && arg[key]) { classes.push(key); } } } } return classes.join(' '); } if (typeof module !== 'undefined' && module.exports) { classNames.default = classNames; module.exports = classNames; } else if (true) { // register as 'classnames', consistent with npm package name !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { return classNames; }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else { window.classNames = classNames; } }()); /***/ }), /***/ 919: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = findDOMNode; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react_dom__ = __webpack_require__(3); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react_dom___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react_dom__); /** * Return if a node is a DOM node. Else will return by `findDOMNode` */ function findDOMNode(node) { if (node instanceof HTMLElement) { return node; } return __WEBPACK_IMPORTED_MODULE_0_react_dom___default.a.findDOMNode(node); } /***/ }) /******/ }); });