Comparing version 2.9.1 to 2.9.2
import React from 'react'; | ||
import Star, { StarProps } from './Star'; | ||
import Star from './Star'; | ||
import type { StarProps } from './Star'; | ||
declare function noop(): void; | ||
export interface RateProps { | ||
disabled?: boolean; | ||
export interface RateProps extends Pick<StarProps, "count" | "character" | "characterRender" | "allowHalf" | "disabled"> { | ||
value?: number; | ||
defaultValue?: number; | ||
count?: number; | ||
allowHalf?: boolean; | ||
allowClear?: boolean; | ||
@@ -16,4 +14,2 @@ style?: React.CSSProperties; | ||
className?: string; | ||
character?: React.ReactNode; | ||
characterRender?: (origin: React.ReactElement, props: StarProps) => React.ReactNode; | ||
tabIndex?: number; | ||
@@ -20,0 +16,0 @@ onFocus?: () => void; |
@@ -27,2 +27,4 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2"; | ||
_this = _super.call(this, props); | ||
_this.stars = void 0; | ||
_this.rate = void 0; | ||
@@ -169,6 +171,6 @@ _this.onHover = function (event, index) { | ||
var value = props.value; | ||
var _value = props.value; | ||
if (value === undefined) { | ||
value = props.defaultValue; | ||
if (_value === undefined) { | ||
_value = props.defaultValue; | ||
} | ||
@@ -178,3 +180,3 @@ | ||
_this.state = { | ||
value: value, | ||
value: _value, | ||
focused: false, | ||
@@ -181,0 +183,0 @@ cleanedValue: null |
@@ -10,3 +10,3 @@ import React from 'react'; | ||
onClick?: (e: React.MouseEvent<HTMLDivElement> | React.KeyboardEvent<HTMLDivElement>, index: number) => void; | ||
character?: React.ReactNode; | ||
character?: React.ReactNode | ((props: StarProps) => React.ReactNode); | ||
characterRender?: (origin: React.ReactElement, props: StarProps) => React.ReactNode; | ||
@@ -13,0 +13,0 @@ focused?: boolean; |
@@ -17,4 +17,8 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck"; | ||
_this = _super.apply(this, arguments); | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
_this.onHover = function (e) { | ||
@@ -21,0 +25,0 @@ var _this$props = _this.props, |
@@ -1,2 +0,1 @@ | ||
/* eslint-disable import/prefer-default-export */ | ||
function getScroll(w) { | ||
@@ -3,0 +2,0 @@ var ret = w.pageXOffset; |
import React from 'react'; | ||
import Star, { StarProps } from './Star'; | ||
import Star from './Star'; | ||
import type { StarProps } from './Star'; | ||
declare function noop(): void; | ||
export interface RateProps { | ||
disabled?: boolean; | ||
export interface RateProps extends Pick<StarProps, "count" | "character" | "characterRender" | "allowHalf" | "disabled"> { | ||
value?: number; | ||
defaultValue?: number; | ||
count?: number; | ||
allowHalf?: boolean; | ||
allowClear?: boolean; | ||
@@ -16,4 +14,2 @@ style?: React.CSSProperties; | ||
className?: string; | ||
character?: React.ReactNode; | ||
characterRender?: (origin: React.ReactElement, props: StarProps) => React.ReactNode; | ||
tabIndex?: number; | ||
@@ -20,0 +16,0 @@ onFocus?: () => void; |
@@ -46,2 +46,4 @@ "use strict"; | ||
_this = _super.call(this, props); | ||
_this.stars = void 0; | ||
_this.rate = void 0; | ||
@@ -188,6 +190,6 @@ _this.onHover = function (event, index) { | ||
var value = props.value; | ||
var _value = props.value; | ||
if (value === undefined) { | ||
value = props.defaultValue; | ||
if (_value === undefined) { | ||
_value = props.defaultValue; | ||
} | ||
@@ -197,3 +199,3 @@ | ||
_this.state = { | ||
value: value, | ||
value: _value, | ||
focused: false, | ||
@@ -200,0 +202,0 @@ cleanedValue: null |
@@ -10,3 +10,3 @@ import React from 'react'; | ||
onClick?: (e: React.MouseEvent<HTMLDivElement> | React.KeyboardEvent<HTMLDivElement>, index: number) => void; | ||
character?: React.ReactNode; | ||
character?: React.ReactNode | ((props: StarProps) => React.ReactNode); | ||
characterRender?: (origin: React.ReactElement, props: StarProps) => React.ReactNode; | ||
@@ -13,0 +13,0 @@ focused?: boolean; |
@@ -29,4 +29,9 @@ "use strict"; | ||
(0, _classCallCheck2.default)(this, Star); | ||
_this = _super.apply(this, arguments); | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
_this.onHover = function (e) { | ||
@@ -33,0 +38,0 @@ var _this$props = _this.props, |
@@ -8,3 +8,2 @@ "use strict"; | ||
/* eslint-disable import/prefer-default-export */ | ||
function getScroll(w) { | ||
@@ -11,0 +10,0 @@ var ret = w.pageXOffset; |
{ | ||
"name": "rc-rate", | ||
"version": "2.9.1", | ||
"version": "2.9.2", | ||
"description": "React Star Rate Component", | ||
@@ -31,6 +31,6 @@ "engines": { | ||
"scripts": { | ||
"start": "cross-env NODE_ENV=development father doc dev --storybook", | ||
"build": "father doc build --storybook", | ||
"start": "dumi dev", | ||
"docs:build": "dumi build", | ||
"docs:deploy": "gh-pages -d .doc", | ||
"compile": "father build && lessc assets/index.less assets/index.css", | ||
"gh-pages": "npm run build && father doc deploy", | ||
"prepublishOnly": "npm run compile && np --yolo --no-publish", | ||
@@ -41,3 +41,4 @@ "postpublish": "npm run gh-pages", | ||
"test": "father test", | ||
"coverage": "father test --coverage" | ||
"coverage": "father test --coverage", | ||
"now-build": "npm run docs:build" | ||
}, | ||
@@ -56,2 +57,3 @@ "dependencies": { | ||
"cross-env": "^7.0.0", | ||
"dumi": "^1.1.0", | ||
"enzyme": "^3.1.1", | ||
@@ -62,2 +64,5 @@ "enzyme-adapter-react-16": "^1.0.1", | ||
"father": "^2.22.0", | ||
"father-build": "^1.18.6", | ||
"gh-pages": "^3.1.0", | ||
"less": "^3.0.0", | ||
"np": "^7.0.0", | ||
@@ -64,0 +69,0 @@ "rc-tooltip": "^5.0.1", |
@@ -5,12 +5,8 @@ # rc-rate | ||
[![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 version][npm-image]][npm-url] [![dumi](https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square)](https://github.com/umijs/dumi) [![build status][github-actions-image]][github-actions-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 | ||
[github-actions-image]: https://github.com/react-component/rate/workflows/CI/badge.svg | ||
[github-actions-url]: https://github.com/react-component/rate/actions | ||
[codecov-image]: https://img.shields.io/codecov/c/github/react-component/rate/master.svg?style=flat-square | ||
@@ -51,7 +47,6 @@ [codecov-url]: https://codecov.io/gh/react-component/rate/branch/master | ||
```jsx | ||
```js | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import Rate from 'rc-rate'; | ||
import 'rc-rate/assets/index.css'; | ||
@@ -65,3 +60,3 @@ ReactDOM.render( | ||
### with [styled-components](https://github.com/styled-components/styled-components) | ||
```jsx | ||
```js | ||
import React from 'react'; | ||
@@ -68,0 +63,0 @@ import ReactDOM from 'react-dom'; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43226
20
20
112