Latest updates from IceHrmPro
This commit is contained in:
22
web/node_modules/rc-rate/HISTORY.md
generated
vendored
Normal file
22
web/node_modules/rc-rate/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
## 2.4.1
|
||||
|
||||
- Better accessibility support.
|
||||
|
||||
## 2.4.0
|
||||
|
||||
- Add allowClear support.
|
||||
|
||||
## 2.3.0
|
||||
|
||||
- Add keyboard support.
|
||||
- Add focus() blur() and autoFocus.
|
||||
|
||||
## 2.1.0
|
||||
|
||||
- Fix typo `charactor` to `character`.
|
||||
|
||||
## 2.0.0
|
||||
|
||||
- Add `character`.
|
||||
- Add `className`.
|
||||
- Add `onHoverChange(value)`.
|
||||
9
web/node_modules/rc-rate/LICENSE.md
generated
vendored
Normal file
9
web/node_modules/rc-rate/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-present yiminghe
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
178
web/node_modules/rc-rate/README.md
generated
vendored
Normal file
178
web/node_modules/rc-rate/README.md
generated
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
# rc-rate
|
||||
---
|
||||
|
||||
React Rate Component
|
||||
|
||||
|
||||
[![NPM version][npm-image]][npm-url]
|
||||
[![build status][travis-image]][travis-url]
|
||||
[![Test coverage][codecov-image]][codecov-url]
|
||||
[![gemnasium deps][gemnasium-image]][gemnasium-url]
|
||||
[![npm download][download-image]][download-url]
|
||||
|
||||
[npm-image]: http://img.shields.io/npm/v/rc-rate.svg?style=flat-square
|
||||
[npm-url]: http://npmjs.org/package/rc-rate
|
||||
[travis-image]: https://img.shields.io/travis/react-component/rate.svg?style=flat-square
|
||||
[travis-url]: https://travis-ci.org/react-component/rate
|
||||
[codecov-image]: https://img.shields.io/codecov/c/github/react-component/rate/master.svg?style=flat-square
|
||||
[codecov-url]: https://codecov.io/gh/react-component/rate/branch/master
|
||||
[gemnasium-image]: http://img.shields.io/gemnasium/react-component/rate.svg?style=flat-square
|
||||
[gemnasium-url]: https://gemnasium.com/react-component/rate
|
||||
[node-url]: http://nodejs.org/download/
|
||||
[download-image]: https://img.shields.io/npm/dm/rc-rate.svg?style=flat-square
|
||||
[download-url]: https://npmjs.org/package/rc-rate
|
||||
|
||||
## Screenshots
|
||||
|
||||
<img src="https://img.alicdn.com/tps/TB1ijlpLVXXXXb8XpXXXXXXXXXX-466-172.png" width="288"/>
|
||||
|
||||
|
||||
## Development
|
||||
|
||||
```
|
||||
npm install
|
||||
npm start
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
http://localhost:8000/examples/
|
||||
|
||||
|
||||
online example: http://react-component.github.io/rate/
|
||||
|
||||
|
||||
## install
|
||||
|
||||
|
||||
[](https://npmjs.org/package/rc-rate)
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import React from 'react'
|
||||
import ReactDOM from 'react-dom'
|
||||
import Rate from 'rc-rate'
|
||||
|
||||
ReactDOM.render(
|
||||
<Rate />,
|
||||
document.getElementById('root')
|
||||
)
|
||||
```
|
||||
|
||||
### with [styled-components](https://github.com/styled-components/styled-components)
|
||||
```js
|
||||
import React from 'react'
|
||||
import ReactDOM from 'react-dom'
|
||||
import Rate from 'rc-rate'
|
||||
import styled from 'styled-components'
|
||||
|
||||
cosnt StyledRate = styled(Rate)`
|
||||
&.rc-rate {
|
||||
font-size: ${({ size }) => size}px;
|
||||
}
|
||||
`
|
||||
|
||||
ReactDOM.render(
|
||||
<StyledRate size="24" />,
|
||||
document.getElementById('root')
|
||||
)
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### props
|
||||
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 100px;">name</th>
|
||||
<th style="width: 50px;">type</th>
|
||||
<th style="width: 50px;">default</th>
|
||||
<th>description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>count</td>
|
||||
<td>number</td>
|
||||
<td>5</td>
|
||||
<td>star numbers</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>value</td>
|
||||
<td>number</td>
|
||||
<td></td>
|
||||
<td>controlled value</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>defaultValue</td>
|
||||
<td>number</td>
|
||||
<td>0</td>
|
||||
<td>initial value</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>allowHalf</td>
|
||||
<td>bool</td>
|
||||
<td>false</td>
|
||||
<td>support half star</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>allowClear</td>
|
||||
<td>bool</td>
|
||||
<td>true</td>
|
||||
<td>reset when click again</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>style</td>
|
||||
<td>object</td>
|
||||
<td>{}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>onChange</td>
|
||||
<td>function(value: Number)</td>
|
||||
<td></td>
|
||||
<td>`onChange` will be triggered when click.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>onHoverChange</td>
|
||||
<td>function(value: Number)</td>
|
||||
<td></td>
|
||||
<td>`onHoverChange` will be triggered when hover on stars.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>character</td>
|
||||
<td>ReactNode</td>
|
||||
<td>★</td>
|
||||
<td>The each character of rate</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>disabled</td>
|
||||
<td>bool</td>
|
||||
<td>false</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
## Test Case
|
||||
|
||||
```
|
||||
npm test
|
||||
npm run chrome-test
|
||||
```
|
||||
|
||||
## Coverage
|
||||
|
||||
```
|
||||
npm run coverage
|
||||
```
|
||||
|
||||
open coverage/ dir
|
||||
|
||||
## License
|
||||
|
||||
rc-rate is released under the MIT license.
|
||||
82
web/node_modules/rc-rate/assets/index.css
generated
vendored
Normal file
82
web/node_modules/rc-rate/assets/index.css
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
.rc-rate {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
font-size: 18px;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
outline: none;
|
||||
}
|
||||
.rc-rate-disabled .rc-rate-star:before,
|
||||
.rc-rate-disabled .rc-rate-star-content:before {
|
||||
cursor: default;
|
||||
}
|
||||
.rc-rate-disabled .rc-rate-star:hover {
|
||||
transform: scale(1);
|
||||
}
|
||||
.rc-rate-star {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: inline-block;
|
||||
margin-right: 8px;
|
||||
position: relative;
|
||||
transition: all 0.3s;
|
||||
color: #e9e9e9;
|
||||
cursor: pointer;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.rc-rate-star-first,
|
||||
.rc-rate-star-second {
|
||||
transition: all 0.3s;
|
||||
}
|
||||
.rc-rate-star-focused,
|
||||
.rc-rate-star:hover {
|
||||
transform: scale(1.1);
|
||||
}
|
||||
.rc-rate-star-first {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 50%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
opacity: 0;
|
||||
}
|
||||
.rc-rate-star-half .rc-rate-star-first,
|
||||
.rc-rate-star-half .rc-rate-star-second {
|
||||
opacity: 1;
|
||||
}
|
||||
.rc-rate-star-half .rc-rate-star-first,
|
||||
.rc-rate-star-full .rc-rate-star-second {
|
||||
color: #f5a623;
|
||||
}
|
||||
.rc-rate-star-half:hover .rc-rate-star-first,
|
||||
.rc-rate-star-full:hover .rc-rate-star-second {
|
||||
color: #f8c165;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'anticon';
|
||||
src: url('//at.alicdn.com/t/font_r5u29ls31bgldi.eot');
|
||||
/* IE9*/
|
||||
src: url('//at.alicdn.com/t/font_r5u29ls31bgldi.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ url('//at.alicdn.com/t/font_r5u29ls31bgldi.woff') format('woff'), /* chrome、firefox */ url('//at.alicdn.com/t/font_r5u29ls31bgldi.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('//at.alicdn.com/t/font_r5u29ls31bgldi.svg#iconfont') format('svg');
|
||||
/* iOS 4.1- */
|
||||
}
|
||||
.anticon {
|
||||
font-style: normal;
|
||||
vertical-align: baseline;
|
||||
text-align: center;
|
||||
text-transform: none;
|
||||
line-height: 1;
|
||||
text-rendering: optimizeLegibility;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
.anticon:before {
|
||||
display: block;
|
||||
font-family: "anticon" !important;
|
||||
}
|
||||
.anticon-star:before {
|
||||
content: "\e660";
|
||||
}
|
||||
345
web/node_modules/rc-rate/es/Rate.js
generated
vendored
Normal file
345
web/node_modules/rc-rate/es/Rate.js
generated
vendored
Normal file
@@ -0,0 +1,345 @@
|
||||
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 _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 _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
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 _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; }
|
||||
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import PropTypes from 'prop-types';
|
||||
import classNames from 'classnames';
|
||||
import { polyfill } from 'react-lifecycles-compat';
|
||||
import KeyCode from "rc-util/es/KeyCode";
|
||||
import { getOffsetLeft } from './util';
|
||||
import Star from './Star';
|
||||
|
||||
function noop() {}
|
||||
|
||||
var Rate =
|
||||
/*#__PURE__*/
|
||||
function (_React$Component) {
|
||||
_inherits(Rate, _React$Component);
|
||||
|
||||
function Rate(props) {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, Rate);
|
||||
|
||||
_this = _possibleConstructorReturn(this, _getPrototypeOf(Rate).call(this, props));
|
||||
|
||||
_defineProperty(_assertThisInitialized(_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);
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "onMouseLeave", function () {
|
||||
var onHoverChange = _this.props.onHoverChange;
|
||||
|
||||
_this.setState({
|
||||
hoverValue: undefined,
|
||||
cleanedValue: null
|
||||
});
|
||||
|
||||
onHoverChange(undefined);
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_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(true);
|
||||
|
||||
_this.changeValue(isReset ? 0 : newValue);
|
||||
|
||||
_this.setState({
|
||||
cleanedValue: isReset ? newValue : null
|
||||
});
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "onFocus", function () {
|
||||
var onFocus = _this.props.onFocus;
|
||||
|
||||
_this.setState({
|
||||
focused: true
|
||||
});
|
||||
|
||||
if (onFocus) {
|
||||
onFocus();
|
||||
}
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "onBlur", function () {
|
||||
var onBlur = _this.props.onBlur;
|
||||
|
||||
_this.setState({
|
||||
focused: false
|
||||
});
|
||||
|
||||
if (onBlur) {
|
||||
onBlur();
|
||||
}
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_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;
|
||||
var value = _this.state.value;
|
||||
|
||||
if (keyCode === KeyCode.RIGHT && value < count) {
|
||||
if (allowHalf) {
|
||||
value += 0.5;
|
||||
} else {
|
||||
value += 1;
|
||||
}
|
||||
|
||||
_this.changeValue(value);
|
||||
|
||||
event.preventDefault();
|
||||
} else if (keyCode === KeyCode.LEFT && value > 0) {
|
||||
if (allowHalf) {
|
||||
value -= 0.5;
|
||||
} else {
|
||||
value -= 1;
|
||||
}
|
||||
|
||||
_this.changeValue(value);
|
||||
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
if (onKeyDown) {
|
||||
onKeyDown(event);
|
||||
}
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "saveRef", function (index) {
|
||||
return function (node) {
|
||||
_this.stars[index] = node;
|
||||
};
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_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 ReactDOM.findDOMNode(this.stars[index]);
|
||||
}
|
||||
}, {
|
||||
key: "getStarValue",
|
||||
value: function getStarValue(index, x) {
|
||||
var allowHalf = this.props.allowHalf;
|
||||
var value = index + 1;
|
||||
|
||||
if (allowHalf) {
|
||||
var starEle = this.getStarDOM(index);
|
||||
var leftDis = getOffsetLeft(starEle);
|
||||
var width = starEle.clientWidth;
|
||||
|
||||
if (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$props3 = this.props,
|
||||
count = _this$props3.count,
|
||||
allowHalf = _this$props3.allowHalf,
|
||||
style = _this$props3.style,
|
||||
prefixCls = _this$props3.prefixCls,
|
||||
disabled = _this$props3.disabled,
|
||||
className = _this$props3.className,
|
||||
character = _this$props3.character,
|
||||
characterRender = _this$props3.characterRender,
|
||||
tabIndex = _this$props3.tabIndex;
|
||||
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++) {
|
||||
stars.push(React.createElement(Star, {
|
||||
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
|
||||
}));
|
||||
}
|
||||
|
||||
return React.createElement("ul", {
|
||||
className: classNames(prefixCls, disabledClass, className),
|
||||
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;
|
||||
}(React.Component);
|
||||
|
||||
_defineProperty(Rate, "propTypes", {
|
||||
disabled: PropTypes.bool,
|
||||
value: PropTypes.number,
|
||||
defaultValue: PropTypes.number,
|
||||
count: PropTypes.number,
|
||||
allowHalf: PropTypes.bool,
|
||||
allowClear: PropTypes.bool,
|
||||
style: PropTypes.object,
|
||||
prefixCls: PropTypes.string,
|
||||
onChange: PropTypes.func,
|
||||
onHoverChange: PropTypes.func,
|
||||
className: PropTypes.string,
|
||||
character: PropTypes.node,
|
||||
characterRender: PropTypes.func,
|
||||
tabIndex: PropTypes.number,
|
||||
onFocus: PropTypes.func,
|
||||
onBlur: PropTypes.func,
|
||||
onKeyDown: PropTypes.func,
|
||||
autoFocus: PropTypes.bool
|
||||
});
|
||||
|
||||
_defineProperty(Rate, "defaultProps", {
|
||||
defaultValue: 0,
|
||||
count: 5,
|
||||
allowHalf: false,
|
||||
allowClear: true,
|
||||
style: {},
|
||||
prefixCls: 'rc-rate',
|
||||
onChange: noop,
|
||||
character: '★',
|
||||
onHoverChange: noop,
|
||||
tabIndex: 0
|
||||
});
|
||||
|
||||
polyfill(Rate);
|
||||
export default Rate;
|
||||
153
web/node_modules/rc-rate/es/Star.js
generated
vendored
Normal file
153
web/node_modules/rc-rate/es/Star.js
generated
vendored
Normal file
@@ -0,0 +1,153 @@
|
||||
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 _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
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 _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; }
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
var Star =
|
||||
/*#__PURE__*/
|
||||
function (_React$Component) {
|
||||
_inherits(Star, _React$Component);
|
||||
|
||||
function Star() {
|
||||
var _getPrototypeOf2;
|
||||
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, Star);
|
||||
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Star)).call.apply(_getPrototypeOf2, [this].concat(args)));
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "onHover", function (e) {
|
||||
var _this$props = _this.props,
|
||||
onHover = _this$props.onHover,
|
||||
index = _this$props.index;
|
||||
onHover(e, index);
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "onClick", function (e) {
|
||||
var _this$props2 = _this.props,
|
||||
onClick = _this$props2.onClick,
|
||||
index = _this$props2.index;
|
||||
onClick(e, index);
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_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 = React.createElement("li", {
|
||||
className: this.getClassName()
|
||||
}, React.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
|
||||
}, React.createElement("div", {
|
||||
className: "".concat(prefixCls, "-first")
|
||||
}, character), React.createElement("div", {
|
||||
className: "".concat(prefixCls, "-second")
|
||||
}, character)));
|
||||
|
||||
if (characterRender) {
|
||||
start = characterRender(start, this.props);
|
||||
}
|
||||
|
||||
return start;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Star;
|
||||
}(React.Component);
|
||||
|
||||
_defineProperty(Star, "propTypes", {
|
||||
value: PropTypes.number,
|
||||
index: PropTypes.number,
|
||||
prefixCls: PropTypes.string,
|
||||
allowHalf: PropTypes.bool,
|
||||
disabled: PropTypes.bool,
|
||||
onHover: PropTypes.func,
|
||||
onClick: PropTypes.func,
|
||||
character: PropTypes.node,
|
||||
characterRender: PropTypes.func,
|
||||
focused: PropTypes.bool,
|
||||
count: PropTypes.number
|
||||
});
|
||||
|
||||
export { Star as default };
|
||||
2
web/node_modules/rc-rate/es/index.js
generated
vendored
Normal file
2
web/node_modules/rc-rate/es/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import Rate from './Rate';
|
||||
export default Rate;
|
||||
43
web/node_modules/rc-rate/es/util.js
generated
vendored
Normal file
43
web/node_modules/rc-rate/es/util.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
function getScroll(w, top) {
|
||||
var ret = top ? w.pageYOffset : w.pageXOffset;
|
||||
var method = top ? 'scrollTop' : '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
|
||||
};
|
||||
}
|
||||
|
||||
export function getOffsetLeft(el) {
|
||||
var pos = getClientPosition(el);
|
||||
var doc = el.ownerDocument;
|
||||
var w = doc.defaultView || doc.parentWindow;
|
||||
pos.left += getScroll(w);
|
||||
return pos.left;
|
||||
}
|
||||
362
web/node_modules/rc-rate/lib/Rate.js
generated
vendored
Normal file
362
web/node_modules/rc-rate/lib/Rate.js
generated
vendored
Normal file
@@ -0,0 +1,362 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
|
||||
var _reactDom = _interopRequireDefault(require("react-dom"));
|
||||
|
||||
var _propTypes = _interopRequireDefault(require("prop-types"));
|
||||
|
||||
var _classnames = _interopRequireDefault(require("classnames"));
|
||||
|
||||
var _reactLifecyclesCompat = require("react-lifecycles-compat");
|
||||
|
||||
var _KeyCode = _interopRequireDefault(require("rc-util/lib/KeyCode"));
|
||||
|
||||
var _util = require("./util");
|
||||
|
||||
var _Star = _interopRequireDefault(require("./Star"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": 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 _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 _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
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 _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 noop() {}
|
||||
|
||||
var Rate =
|
||||
/*#__PURE__*/
|
||||
function (_React$Component) {
|
||||
_inherits(Rate, _React$Component);
|
||||
|
||||
function Rate(props) {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, Rate);
|
||||
|
||||
_this = _possibleConstructorReturn(this, _getPrototypeOf(Rate).call(this, props));
|
||||
|
||||
_defineProperty(_assertThisInitialized(_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);
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "onMouseLeave", function () {
|
||||
var onHoverChange = _this.props.onHoverChange;
|
||||
|
||||
_this.setState({
|
||||
hoverValue: undefined,
|
||||
cleanedValue: null
|
||||
});
|
||||
|
||||
onHoverChange(undefined);
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_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(true);
|
||||
|
||||
_this.changeValue(isReset ? 0 : newValue);
|
||||
|
||||
_this.setState({
|
||||
cleanedValue: isReset ? newValue : null
|
||||
});
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "onFocus", function () {
|
||||
var onFocus = _this.props.onFocus;
|
||||
|
||||
_this.setState({
|
||||
focused: true
|
||||
});
|
||||
|
||||
if (onFocus) {
|
||||
onFocus();
|
||||
}
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "onBlur", function () {
|
||||
var onBlur = _this.props.onBlur;
|
||||
|
||||
_this.setState({
|
||||
focused: false
|
||||
});
|
||||
|
||||
if (onBlur) {
|
||||
onBlur();
|
||||
}
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_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;
|
||||
var value = _this.state.value;
|
||||
|
||||
if (keyCode === _KeyCode["default"].RIGHT && value < count) {
|
||||
if (allowHalf) {
|
||||
value += 0.5;
|
||||
} else {
|
||||
value += 1;
|
||||
}
|
||||
|
||||
_this.changeValue(value);
|
||||
|
||||
event.preventDefault();
|
||||
} else if (keyCode === _KeyCode["default"].LEFT && value > 0) {
|
||||
if (allowHalf) {
|
||||
value -= 0.5;
|
||||
} else {
|
||||
value -= 1;
|
||||
}
|
||||
|
||||
_this.changeValue(value);
|
||||
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
if (onKeyDown) {
|
||||
onKeyDown(event);
|
||||
}
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "saveRef", function (index) {
|
||||
return function (node) {
|
||||
_this.stars[index] = node;
|
||||
};
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_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 _reactDom["default"].findDOMNode(this.stars[index]);
|
||||
}
|
||||
}, {
|
||||
key: "getStarValue",
|
||||
value: function getStarValue(index, x) {
|
||||
var allowHalf = this.props.allowHalf;
|
||||
var value = index + 1;
|
||||
|
||||
if (allowHalf) {
|
||||
var starEle = this.getStarDOM(index);
|
||||
var leftDis = (0, _util.getOffsetLeft)(starEle);
|
||||
var width = starEle.clientWidth;
|
||||
|
||||
if (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$props3 = this.props,
|
||||
count = _this$props3.count,
|
||||
allowHalf = _this$props3.allowHalf,
|
||||
style = _this$props3.style,
|
||||
prefixCls = _this$props3.prefixCls,
|
||||
disabled = _this$props3.disabled,
|
||||
className = _this$props3.className,
|
||||
character = _this$props3.character,
|
||||
characterRender = _this$props3.characterRender,
|
||||
tabIndex = _this$props3.tabIndex;
|
||||
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++) {
|
||||
stars.push(_react["default"].createElement(_Star["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
|
||||
}));
|
||||
}
|
||||
|
||||
return _react["default"].createElement("ul", {
|
||||
className: (0, _classnames["default"])(prefixCls, disabledClass, className),
|
||||
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;
|
||||
}(_react["default"].Component);
|
||||
|
||||
_defineProperty(Rate, "propTypes", {
|
||||
disabled: _propTypes["default"].bool,
|
||||
value: _propTypes["default"].number,
|
||||
defaultValue: _propTypes["default"].number,
|
||||
count: _propTypes["default"].number,
|
||||
allowHalf: _propTypes["default"].bool,
|
||||
allowClear: _propTypes["default"].bool,
|
||||
style: _propTypes["default"].object,
|
||||
prefixCls: _propTypes["default"].string,
|
||||
onChange: _propTypes["default"].func,
|
||||
onHoverChange: _propTypes["default"].func,
|
||||
className: _propTypes["default"].string,
|
||||
character: _propTypes["default"].node,
|
||||
characterRender: _propTypes["default"].func,
|
||||
tabIndex: _propTypes["default"].number,
|
||||
onFocus: _propTypes["default"].func,
|
||||
onBlur: _propTypes["default"].func,
|
||||
onKeyDown: _propTypes["default"].func,
|
||||
autoFocus: _propTypes["default"].bool
|
||||
});
|
||||
|
||||
_defineProperty(Rate, "defaultProps", {
|
||||
defaultValue: 0,
|
||||
count: 5,
|
||||
allowHalf: false,
|
||||
allowClear: true,
|
||||
style: {},
|
||||
prefixCls: 'rc-rate',
|
||||
onChange: noop,
|
||||
character: '★',
|
||||
onHoverChange: noop,
|
||||
tabIndex: 0
|
||||
});
|
||||
|
||||
(0, _reactLifecyclesCompat.polyfill)(Rate);
|
||||
var _default = Rate;
|
||||
exports["default"] = _default;
|
||||
164
web/node_modules/rc-rate/lib/Star.js
generated
vendored
Normal file
164
web/node_modules/rc-rate/lib/Star.js
generated
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
|
||||
var _propTypes = _interopRequireDefault(require("prop-types"));
|
||||
|
||||
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 _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 _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
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 _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; }
|
||||
|
||||
var Star =
|
||||
/*#__PURE__*/
|
||||
function (_React$Component) {
|
||||
_inherits(Star, _React$Component);
|
||||
|
||||
function Star() {
|
||||
var _getPrototypeOf2;
|
||||
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, Star);
|
||||
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Star)).call.apply(_getPrototypeOf2, [this].concat(args)));
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "onHover", function (e) {
|
||||
var _this$props = _this.props,
|
||||
onHover = _this$props.onHover,
|
||||
index = _this$props.index;
|
||||
onHover(e, index);
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "onClick", function (e) {
|
||||
var _this$props2 = _this.props,
|
||||
onClick = _this$props2.onClick,
|
||||
index = _this$props2.index;
|
||||
onClick(e, index);
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_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 = _react["default"].createElement("li", {
|
||||
className: this.getClassName()
|
||||
}, _react["default"].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
|
||||
}, _react["default"].createElement("div", {
|
||||
className: "".concat(prefixCls, "-first")
|
||||
}, character), _react["default"].createElement("div", {
|
||||
className: "".concat(prefixCls, "-second")
|
||||
}, character)));
|
||||
|
||||
if (characterRender) {
|
||||
start = characterRender(start, this.props);
|
||||
}
|
||||
|
||||
return start;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Star;
|
||||
}(_react["default"].Component);
|
||||
|
||||
exports["default"] = Star;
|
||||
|
||||
_defineProperty(Star, "propTypes", {
|
||||
value: _propTypes["default"].number,
|
||||
index: _propTypes["default"].number,
|
||||
prefixCls: _propTypes["default"].string,
|
||||
allowHalf: _propTypes["default"].bool,
|
||||
disabled: _propTypes["default"].bool,
|
||||
onHover: _propTypes["default"].func,
|
||||
onClick: _propTypes["default"].func,
|
||||
character: _propTypes["default"].node,
|
||||
characterRender: _propTypes["default"].func,
|
||||
focused: _propTypes["default"].bool,
|
||||
count: _propTypes["default"].number
|
||||
});
|
||||
13
web/node_modules/rc-rate/lib/index.js
generated
vendored
Normal file
13
web/node_modules/rc-rate/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _Rate = _interopRequireDefault(require("./Rate"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
var _default = _Rate["default"];
|
||||
exports["default"] = _default;
|
||||
50
web/node_modules/rc-rate/lib/util.js
generated
vendored
Normal file
50
web/node_modules/rc-rate/lib/util.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getOffsetLeft = getOffsetLeft;
|
||||
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
function getScroll(w, top) {
|
||||
var ret = top ? w.pageYOffset : w.pageXOffset;
|
||||
var method = top ? 'scrollTop' : '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;
|
||||
var w = doc.defaultView || doc.parentWindow;
|
||||
pos.left += getScroll(w);
|
||||
return pos.left;
|
||||
}
|
||||
92
web/node_modules/rc-rate/package.json
generated
vendored
Normal file
92
web/node_modules/rc-rate/package.json
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
{
|
||||
"_from": "rc-rate@~2.5.1",
|
||||
"_id": "rc-rate@2.5.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-3iJkNJT8xlHklPCdeZtUZmJmRVUbr6AHRlfSsztfYTXVlHrv2TcPn3XkHsH+12j812WVB7gvilS2j3+ffjUHXg==",
|
||||
"_location": "/rc-rate",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "rc-rate@~2.5.1",
|
||||
"name": "rc-rate",
|
||||
"escapedName": "rc-rate",
|
||||
"rawSpec": "~2.5.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~2.5.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/antd"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/rc-rate/-/rc-rate-2.5.1.tgz",
|
||||
"_shasum": "55fc5fd23ea9dcc72250b9a889803479f4842961",
|
||||
"_spec": "rc-rate@~2.5.1",
|
||||
"_where": "/Users/thilina/TestProjects/icehrm-pro/web/node_modules/antd",
|
||||
"bugs": {
|
||||
"url": "https://github.com/react-component/rate/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"config": {
|
||||
"port": 8000
|
||||
},
|
||||
"dependencies": {
|
||||
"classnames": "^2.2.5",
|
||||
"prop-types": "^15.5.8",
|
||||
"rc-util": "^4.3.0",
|
||||
"react-lifecycles-compat": "^3.0.4"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "React Star Rate Component",
|
||||
"devDependencies": {
|
||||
"enzyme": "^3.1.1",
|
||||
"jest": "^21.2.1",
|
||||
"lint-staged": "^8.1.0",
|
||||
"pre-commit": "1.x",
|
||||
"rc-tools": "^9.2.0",
|
||||
"rc-tooltip": "^3.7.3",
|
||||
"react": "^16.0.0",
|
||||
"react-dom": "^16.0.0"
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
"es",
|
||||
"assets/*.css"
|
||||
],
|
||||
"homepage": "https://github.com/react-component/rate",
|
||||
"keywords": [
|
||||
"react",
|
||||
"react-component",
|
||||
"react-rate",
|
||||
"rate"
|
||||
],
|
||||
"licenses": "MIT",
|
||||
"lint-staged": {
|
||||
"*.{js,jsx,ts,tsx}": [
|
||||
"npm run pre-commit",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"main": "./lib/index",
|
||||
"module": "./es/index",
|
||||
"name": "rc-rate",
|
||||
"pre-commit": [
|
||||
"lint-staged"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/react-component/rate.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rc-tools run build",
|
||||
"compile": "rc-tools run compile --babel-runtime",
|
||||
"coverage": "rc-tools run test --coverage",
|
||||
"gh-pages": "rc-tools run gh-pages",
|
||||
"lint": "rc-tools run lint",
|
||||
"lint-staged": "lint-staged",
|
||||
"pre-commit": "rc-tools run pre-commit",
|
||||
"pub": "rc-tools run pub",
|
||||
"start": "rc-tools run server",
|
||||
"test": "rc-tools run test"
|
||||
},
|
||||
"version": "2.5.1"
|
||||
}
|
||||
Reference in New Issue
Block a user