Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into distance-range
Browse files Browse the repository at this point in the history
  • Loading branch information
doong-jo committed Feb 24, 2024
2 parents 4255433 + c790ca8 commit 6eb9ef4
Show file tree
Hide file tree
Showing 70 changed files with 3,939 additions and 3,395 deletions.
16 changes: 16 additions & 0 deletions .dumirc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { defineConfig } from 'dumi';
import path from 'path';

export default defineConfig({
alias: {
'rc-slider$': path.resolve('src'),
'rc-slider/es': path.resolve('src'),
},
mfsu: false,
favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'],
themeConfig: {
name: 'Slider',
logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
},
styles: [``],
});
17 changes: 12 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# top-most EditorConfig file
# http://editorconfig.org
root = true

# Unix-style newlines with a newline ending every file
[*.{js,jsx,css}]
end_of_line = lf
insert_final_newline = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[Makefile]
indent_style = tab
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports = {
'react/require-default-props': 0,
'no-confusing-arrow': 0,
'import/no-named-as-default-member': 0,
'import/no-extraneous-dependencies': 0,
'jsx-a11y/label-has-for': 0,
'jsx-a11y/label-has-associated-control': 0,
},
Expand Down
14 changes: 5 additions & 9 deletions .fatherrc.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
export default {
cjs: 'babel',
esm: { type: 'babel', importLibToEs: true },
preCommit: {
eslint: true,
prettier: true,
},
runtimeHelpers: true,
};
import { defineConfig } from 'father';

export default defineConfig({
plugins: ['@rc-component/father-plugin'],
});
23 changes: 23 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
time: "21:00"
open-pull-requests-limit: 10
ignore:
- dependency-name: "@types/react"
versions:
- 17.0.0
- 17.0.1
- 17.0.2
- 17.0.3
- dependency-name: "@types/react-dom"
versions:
- 17.0.0
- 17.0.1
- 17.0.2
- dependency-name: less
versions:
- 4.1.0
41 changes: 41 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "CodeQL"

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
schedule:
- cron: "17 10 * * 1"

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ javascript ]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
queries: +security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{ matrix.language }}"
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,11 @@ es
yarn.lock
package-lock.json
.doc
.storybook
.storybook

# umi
.umi
.umi-production
.umi-test
.env.local
.dumi/
51 changes: 49 additions & 2 deletions HISTORY.md → CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,52 @@
# History
----
# Changelog

## 9.7.1

`2020-12-15`

- feat: add dragableTrack. [#722](https://github.com/react-component/slider/pull/722)

## 9.6.5

`2020-12-01`

- chore: export slider、range and handle props interface. [#718](https://github.com/react-component/slider/pull/718)

## 9.6.4

`2020-11-21`

- fix: slider cannot drag to max value. [#714](https://github.com/react-component/slider/pull/714)

## 9.6.3

`2020-11-17`

- fix: forcePopupAlign null. [930ad6d](https://github.com/react-component/slider/commit/930ad6d117850505775956f26e025487073615dc) [69dc592](https://github.com/react-component/slider/commit/69dc59270ca46ae2d3c4b5aa073d2bc75dfc5b16)

## 9.6.2

`2020-11-10`

- fix: extra onChange when value out of range. [#711](https://github.com/react-component/slider/pull/711)

## 9.6.1

`2020-10-31`

- fix: update getLowerBound and getUpperBound to check startPoint prop. [#683](https://github.com/react-component/slider/pull/683)

## 9.6.0

`2020-10-30`

- fix: keep tooltip align with handle when dragging. [#696](https://github.com/react-component/slider/pull/696)

---

Middle check in [releases](https://github.com/react-component/slider/releases).

---

## 9.2.0

Expand Down
66 changes: 40 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,66 @@
# rc-slider
---

Slider UI component for React

[![NPM version][npm-image]][npm-url]
[![build status][github-actions-image]][github-actions-url]
[![Test coverage][coveralls-image]][coveralls-url]
[![Dependencies][david-image]][david-url]
[![DevDependencies][david-dev-image]][david-dev-url]
[![npm download][download-image]][download-url]
[![build status][github-actions-image]][github-actions-url]
[![Codecov][codecov-image]][codecov-url]
[![bundle size][bundlephobia-image]][bundlephobia-url]
[![dumi][dumi-image]][dumi-url]

[npm-image]: http://img.shields.io/npm/v/rc-slider.svg?style=flat-square
[npm-url]: http://npmjs.org/package/rc-slider
[travis-image]: https://img.shields.io/travis/react-component/slider/master?style=flat-square
[travis-url]: https://travis-ci.com/react-component/slider
[github-actions-image]: https://github.com/react-component/slider/workflows/CI/badge.svg
[github-actions-url]: https://github.com/react-component/slider/actions
[circleci-image]: https://img.shields.io/circleci/react-component/slider/master?style=flat-square
[circleci-url]: https://circleci.com/gh/react-component/slider
[coveralls-image]: https://img.shields.io/coveralls/react-component/slider.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/react-component/slider?branch=master
[codecov-image]: https://img.shields.io/codecov/c/github/react-component/slider/master.svg?style=flat-square
[codecov-url]: https://app.codecov.io/gh/react-component/slider
[david-url]: https://david-dm.org/react-component/slider
[david-image]: https://david-dm.org/react-component/slider/status.svg?style=flat-square
[david-dev-url]: https://david-dm.org/react-component/slider?type=dev
[david-dev-image]: https://david-dm.org/react-component/slider/dev-status.svg?style=flat-square
[download-image]: https://img.shields.io/npm/dm/rc-slider.svg?style=flat-square
[download-url]: https://npmjs.org/package/rc-slider
[bundlephobia-url]: https://bundlephobia.com/result?p=rc-slider
[bundlephobia-url]: https://bundlephobia.com/package/rc-slider
[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/rc-slider

[dumi-url]: https://github.com/umijs/dumi
[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square
## Install

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

## Example

`npm start` and then go to http://localhost:8000

Online examples: https://slider.react-component.now.sh/

## Usage

## Slider
```js
import Slider, { Range } from 'rc-slider';
import Slider from 'rc-slider';
import 'rc-slider/assets/index.css';

export default () => (
<>
<Slider />
<Range />
</>
);
```

## Range
Please refer to [#825](https://github.com/react-component/slider/issues/825) for information regarding usage of `Range`.
An example:
```js
import Slider, { Range } from 'rc-slider';
import 'rc-slider/assets/index.css';

export default () => (
<>
<Slider range />
</>
);
```
Expand All @@ -58,7 +77,7 @@ export default () => (

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

```jsx
```js
const Slider = require('rc-slider');
const createSliderWithTooltip = Slider.createSliderWithTooltip;
const Range = createSliderWithTooltip(Slider.Range);
Expand Down Expand Up @@ -89,17 +108,18 @@ The following APIs are shared by Slider and Range.
| included | boolean | `true` | If the value is `true`, it means a continuous value interval, otherwise, it is a independent value. |
| reverse | boolean | `false` | If the value is `true`, it means the component is rendered reverse. |
| disabled | boolean | `false` | If `true`, handles can't be moved. |
| keyboard | boolean | `true` | Support using keyboard to move handlers. |
| 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. |
| onBeforeChange | Function | NOOP | `onBeforeChange` will be triggered when `ontouchstart` or `onmousedown` is triggered. |
| onChange | Function | NOOP | `onChange` will be triggered while the value of Slider changing. |
| onAfterChange | Function | NOOP | `onAfterChange` will be triggered when `ontouchend` or `onmouseup` is triggered. |
| onChangeComplete | Function | NOOP | `onChangeComplete` will be triggered when `ontouchend` or `onmouseup` is triggered. |
| minimumTrackStyle | Object | | please use `trackStyle` instead. (`only used for slider, just for compatibility , will be deprecate at rc-slider@9.x `) |
| maximumTrackStyle | Object | | please use `railStyle` instead (`only used for slider, just for compatibility , will be deprecate at rc-slider@9.x`) |
| 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`) |
| 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`)|
| railStyle | Object | `{}` | The style used for the track base color. |
| dotStyle | Object | `{}` | The style used for the dots. |
| activeDotStyle | Object | `{}` | The style used for the active dots. |
| dotStyle | Object \| (dotValue) => Object | `{}` | The style used for the dots. |
| activeDotStyle | Object \| (dotValue) => Object | `{}` | The style used for the active dots. |

### Slider

Expand All @@ -126,6 +146,7 @@ The following APIs are shared by Slider and Range.
| count | number | `1` | Determine how many ranges to render, and multiple handles will be rendered (number + 1). |
| allowCross | boolean | `true` | `allowCross` could be set as `true` to allow those handles to cross. |
| 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) |
| draggableTrack | boolean | `false` | Open the track drag. open after click on the track will be invalid. |

### SliderTooltip

Expand All @@ -138,20 +159,13 @@ npm install
npm start
```

## Example

`npm start` and then go to `http://localhost:8005/examples/`

Online examples: [http://react-component.github.io/slider/](http://react-component.github.io/slider/)

## Test Case

`http://localhost:8005/tests/runner.html?coverage`
`npm run test`

## Coverage

`http://localhost:8005/node_modules/rc-server/node_modules/node-jscover/lib/front-end/jscoverage.html?w=http://localhost:8088/tests/runner.html?coverage`

`npm run coverage`
## License

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

0 comments on commit 6eb9ef4

Please sign in to comment.