Skip to content

Commit 6eb9ef4

Browse files
committed
Merge remote-tracking branch 'upstream/master' into distance-range
2 parents 4255433 + c790ca8 commit 6eb9ef4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+3939
-3395
lines changed

.dumirc.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { defineConfig } from 'dumi';
2+
import path from 'path';
3+
4+
export default defineConfig({
5+
alias: {
6+
'rc-slider$': path.resolve('src'),
7+
'rc-slider/es': path.resolve('src'),
8+
},
9+
mfsu: false,
10+
favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'],
11+
themeConfig: {
12+
name: 'Slider',
13+
logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
14+
},
15+
styles: [``],
16+
});

.editorconfig

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1-
# top-most EditorConfig file
1+
# http://editorconfig.org
22
root = true
33

4-
# Unix-style newlines with a newline ending every file
5-
[*.{js,jsx,css}]
6-
end_of_line = lf
7-
insert_final_newline = true
4+
[*]
85
indent_style = space
96
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false
14+
15+
[Makefile]
16+
indent_style = tab

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ module.exports = {
1313
'react/require-default-props': 0,
1414
'no-confusing-arrow': 0,
1515
'import/no-named-as-default-member': 0,
16+
'import/no-extraneous-dependencies': 0,
1617
'jsx-a11y/label-has-for': 0,
1718
'jsx-a11y/label-has-associated-control': 0,
1819
},

.fatherrc.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
export default {
2-
cjs: 'babel',
3-
esm: { type: 'babel', importLibToEs: true },
4-
preCommit: {
5-
eslint: true,
6-
prettier: true,
7-
},
8-
runtimeHelpers: true,
9-
};
1+
import { defineConfig } from 'father';
2+
3+
export default defineConfig({
4+
plugins: ['@rc-component/father-plugin'],
5+
});

.github/dependabot.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: npm
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
time: "21:00"
8+
open-pull-requests-limit: 10
9+
ignore:
10+
- dependency-name: "@types/react"
11+
versions:
12+
- 17.0.0
13+
- 17.0.1
14+
- 17.0.2
15+
- 17.0.3
16+
- dependency-name: "@types/react-dom"
17+
versions:
18+
- 17.0.0
19+
- 17.0.1
20+
- 17.0.2
21+
- dependency-name: less
22+
versions:
23+
- 4.1.0

.github/workflows/codeql.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
schedule:
9+
- cron: "17 10 * * 1"
10+
11+
jobs:
12+
analyze:
13+
name: Analyze
14+
runs-on: ubuntu-latest
15+
permissions:
16+
actions: read
17+
contents: read
18+
security-events: write
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
language: [ javascript ]
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v3
28+
29+
- name: Initialize CodeQL
30+
uses: github/codeql-action/init@v2
31+
with:
32+
languages: ${{ matrix.language }}
33+
queries: +security-and-quality
34+
35+
- name: Autobuild
36+
uses: github/codeql-action/autobuild@v2
37+
38+
- name: Perform CodeQL Analysis
39+
uses: github/codeql-action/analyze@v2
40+
with:
41+
category: "/language:${{ matrix.language }}"

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,11 @@ es
3030
yarn.lock
3131
package-lock.json
3232
.doc
33-
.storybook
33+
.storybook
34+
35+
# umi
36+
.umi
37+
.umi-production
38+
.umi-test
39+
.env.local
40+
.dumi/

HISTORY.md renamed to CHANGELOG.md

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,52 @@
1-
# History
2-
----
1+
# Changelog
2+
3+
## 9.7.1
4+
5+
`2020-12-15`
6+
7+
- feat: add dragableTrack. [#722](https://github.com/react-component/slider/pull/722)
8+
9+
## 9.6.5
10+
11+
`2020-12-01`
12+
13+
- chore: export slider、range and handle props interface. [#718](https://github.com/react-component/slider/pull/718)
14+
15+
## 9.6.4
16+
17+
`2020-11-21`
18+
19+
- fix: slider cannot drag to max value. [#714](https://github.com/react-component/slider/pull/714)
20+
21+
## 9.6.3
22+
23+
`2020-11-17`
24+
25+
- fix: forcePopupAlign null. [930ad6d](https://github.com/react-component/slider/commit/930ad6d117850505775956f26e025487073615dc) [69dc592](https://github.com/react-component/slider/commit/69dc59270ca46ae2d3c4b5aa073d2bc75dfc5b16)
26+
27+
## 9.6.2
28+
29+
`2020-11-10`
30+
31+
- fix: extra onChange when value out of range. [#711](https://github.com/react-component/slider/pull/711)
32+
33+
## 9.6.1
34+
35+
`2020-10-31`
36+
37+
- fix: update getLowerBound and getUpperBound to check startPoint prop. [#683](https://github.com/react-component/slider/pull/683)
38+
39+
## 9.6.0
40+
41+
`2020-10-30`
42+
43+
- fix: keep tooltip align with handle when dragging. [#696](https://github.com/react-component/slider/pull/696)
44+
45+
---
46+
47+
Middle check in [releases](https://github.com/react-component/slider/releases).
48+
49+
---
350

451
## 9.2.0
552

README.md

Lines changed: 40 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,66 @@
11
# rc-slider
2-
---
32

43
Slider UI component for React
54

65
[![NPM version][npm-image]][npm-url]
7-
[![build status][github-actions-image]][github-actions-url]
8-
[![Test coverage][coveralls-image]][coveralls-url]
9-
[![Dependencies][david-image]][david-url]
10-
[![DevDependencies][david-dev-image]][david-dev-url]
116
[![npm download][download-image]][download-url]
7+
[![build status][github-actions-image]][github-actions-url]
8+
[![Codecov][codecov-image]][codecov-url]
129
[![bundle size][bundlephobia-image]][bundlephobia-url]
10+
[![dumi][dumi-image]][dumi-url]
1311

1412
[npm-image]: http://img.shields.io/npm/v/rc-slider.svg?style=flat-square
1513
[npm-url]: http://npmjs.org/package/rc-slider
14+
[travis-image]: https://img.shields.io/travis/react-component/slider/master?style=flat-square
15+
[travis-url]: https://travis-ci.com/react-component/slider
1616
[github-actions-image]: https://github.com/react-component/slider/workflows/CI/badge.svg
1717
[github-actions-url]: https://github.com/react-component/slider/actions
18-
[circleci-image]: https://img.shields.io/circleci/react-component/slider/master?style=flat-square
19-
[circleci-url]: https://circleci.com/gh/react-component/slider
20-
[coveralls-image]: https://img.shields.io/coveralls/react-component/slider.svg?style=flat-square
21-
[coveralls-url]: https://coveralls.io/r/react-component/slider?branch=master
18+
[codecov-image]: https://img.shields.io/codecov/c/github/react-component/slider/master.svg?style=flat-square
19+
[codecov-url]: https://app.codecov.io/gh/react-component/slider
2220
[david-url]: https://david-dm.org/react-component/slider
2321
[david-image]: https://david-dm.org/react-component/slider/status.svg?style=flat-square
2422
[david-dev-url]: https://david-dm.org/react-component/slider?type=dev
2523
[david-dev-image]: https://david-dm.org/react-component/slider/dev-status.svg?style=flat-square
2624
[download-image]: https://img.shields.io/npm/dm/rc-slider.svg?style=flat-square
2725
[download-url]: https://npmjs.org/package/rc-slider
28-
[bundlephobia-url]: https://bundlephobia.com/result?p=rc-slider
26+
[bundlephobia-url]: https://bundlephobia.com/package/rc-slider
2927
[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/rc-slider
30-
28+
[dumi-url]: https://github.com/umijs/dumi
29+
[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square
3130
## Install
3231

3332
[![rc-slider](https://nodei.co/npm/rc-slider.png)](https://npmjs.org/package/rc-slider)
3433

34+
## Example
35+
36+
`npm start` and then go to http://localhost:8000
37+
38+
Online examples: https://slider.react-component.now.sh/
39+
3540
## Usage
3641

42+
## Slider
3743
```js
38-
import Slider, { Range } from 'rc-slider';
44+
import Slider from 'rc-slider';
3945
import 'rc-slider/assets/index.css';
4046

4147
export default () => (
4248
<>
4349
<Slider />
44-
<Range />
50+
</>
51+
);
52+
```
53+
54+
## Range
55+
Please refer to [#825](https://github.com/react-component/slider/issues/825) for information regarding usage of `Range`.
56+
An example:
57+
```js
58+
import Slider, { Range } from 'rc-slider';
59+
import 'rc-slider/assets/index.css';
60+
61+
export default () => (
62+
<>
63+
<Slider range />
4564
</>
4665
);
4766
```
@@ -58,7 +77,7 @@ export default () => (
5877

5978
An extension to make Slider or Range support Tooltip on handle.
6079

61-
```jsx
80+
```js
6281
const Slider = require('rc-slider');
6382
const createSliderWithTooltip = Slider.createSliderWithTooltip;
6483
const Range = createSliderWithTooltip(Slider.Range);
@@ -89,17 +108,18 @@ The following APIs are shared by Slider and Range.
89108
| included | boolean | `true` | If the value is `true`, it means a continuous value interval, otherwise, it is a independent value. |
90109
| reverse | boolean | `false` | If the value is `true`, it means the component is rendered reverse. |
91110
| disabled | boolean | `false` | If `true`, handles can't be moved. |
111+
| keyboard | boolean | `true` | Support using keyboard to move handlers. |
92112
| dots | boolean | `false` | When the `step` value is greater than 1, you can set the `dots` to `true` if you want to render the slider with dots. |
93113
| onBeforeChange | Function | NOOP | `onBeforeChange` will be triggered when `ontouchstart` or `onmousedown` is triggered. |
94114
| onChange | Function | NOOP | `onChange` will be triggered while the value of Slider changing. |
95-
| onAfterChange | Function | NOOP | `onAfterChange` will be triggered when `ontouchend` or `onmouseup` is triggered. |
115+
| onChangeComplete | Function | NOOP | `onChangeComplete` will be triggered when `ontouchend` or `onmouseup` is triggered. |
96116
| minimumTrackStyle | Object | | please use `trackStyle` instead. (`only used for slider, just for compatibility , will be deprecate at [email protected] `) |
97117
| maximumTrackStyle | Object | | please use `railStyle` instead (`only used for slider, just for compatibility , will be deprecate at [email protected]`) |
98118
| handleStyle | Array[Object] \| Object | `[{}]` | The style used for handle. (`both for slider(`Object`) and range(`Array of Object`), the array will be used for multi handle following element order`) |
99119
| trackStyle | Array[Object] \| Object | `[{}]` | The style used for track. (`both for slider(`Object`) and range(`Array of Object`), the array will be used for multi track following element order`)|
100120
| railStyle | Object | `{}` | The style used for the track base color. |
101-
| dotStyle | Object | `{}` | The style used for the dots. |
102-
| activeDotStyle | Object | `{}` | The style used for the active dots. |
121+
| dotStyle | Object \| (dotValue) => Object | `{}` | The style used for the dots. |
122+
| activeDotStyle | Object \| (dotValue) => Object | `{}` | The style used for the active dots. |
103123

104124
### Slider
105125

@@ -126,6 +146,7 @@ The following APIs are shared by Slider and Range.
126146
| count | number | `1` | Determine how many ranges to render, and multiple handles will be rendered (number + 1). |
127147
| allowCross | boolean | `true` | `allowCross` could be set as `true` to allow those handles to cross. |
128148
| pushable | boolean or number | `false` | `pushable` could be set as `true` to allow pushing of surrounding handles when moving a handle. When set to a number, the number will be the minimum ensured distance between handles. Example: ![](http://i.giphy.com/l46Cs36c9HrHMExoc.gif) |
149+
| draggableTrack | boolean | `false` | Open the track drag. open after click on the track will be invalid. |
129150

130151
### SliderTooltip
131152

@@ -138,20 +159,13 @@ npm install
138159
npm start
139160
```
140161

141-
## Example
142-
143-
`npm start` and then go to `http://localhost:8005/examples/`
144-
145-
Online examples: [http://react-component.github.io/slider/](http://react-component.github.io/slider/)
146-
147162
## Test Case
148163

149-
`http://localhost:8005/tests/runner.html?coverage`
164+
`npm run test`
150165

151166
## Coverage
152167

153-
`http://localhost:8005/node_modules/rc-server/node_modules/node-jscover/lib/front-end/jscoverage.html?w=http://localhost:8088/tests/runner.html?coverage`
154-
168+
`npm run coverage`
155169
## License
156170

157171
`rc-slider` is released under the MIT license.

0 commit comments

Comments
 (0)