Latest updates from IceHrmPro
This commit is contained in:
67
web/node_modules/rc-slider/HISTORY.md
generated
vendored
Normal file
67
web/node_modules/rc-slider/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
# History
|
||||
----
|
||||
|
||||
## 9.2.0
|
||||
|
||||
[Feature] createSliderWithTooltip support getTooltipContainer
|
||||
|
||||
## 9.1.0
|
||||
|
||||
[Feature] Support `startPoint` prop.
|
||||
|
||||
## 8.7.0
|
||||
|
||||
[Feature] Supprot `reverse` prop.
|
||||
|
||||
## 8.6.0
|
||||
|
||||
[Feature] Allow tabIndex to be set explicitly on Handle. [#381](https://github.com/react-component/slider/pull/381)
|
||||
|
||||
## 8.5.0
|
||||
|
||||
[Feature] Add focus() blur() and autoFocus.
|
||||
|
||||
## 8.4.0 / 2017-11-09
|
||||
|
||||
Support React 16.
|
||||
|
||||
## 8.3.0 / 2017-07-28
|
||||
|
||||
[Feature] Support keyboard accessibility.[#282](https://github.com/react-component/slider/pull/282)
|
||||
|
||||
## 8.2.0 / 2017-07-04
|
||||
|
||||
[Feature] Support custom dot style with `dotStyle` & `activeDotStyle` api.[#292](https://github.com/react-component/slider/pull/292)
|
||||
|
||||
## 8.1.0 / 2017-06-09
|
||||
|
||||
[Feature] rc-slider support custom style. [#281](https://github.com/react-component/slider/pull/281)
|
||||
|
||||
## 8.0.0 / 2017-05-31
|
||||
|
||||
[Feature] rc-slider support aria. [#260](https://github.com/react-component/slider/pull/260/)
|
||||
|
||||
## 6.0.0 / 2017-01-25
|
||||
|
||||
[Breaking Change] Re-design and refactor, almost a new UI component.
|
||||
|
||||
## 5.0.0 / 2016-09-12
|
||||
|
||||
[#147](https://github.com/react-component/slider/issues/147) fix style conflicts with rc-tooltip [@benjycui](https://github.com/benjycui)
|
||||
[#145](https://github.com/react-component/slider/pull/145) fix `onChange` will be triggered while mousemove [@Fuzzyma](https://github.com/Fuzzyma)
|
||||
|
||||
## 4.0.0 / 2016-08-12
|
||||
|
||||
[#133](https://github.com/react-component/slider/pull/133) support multi-range ([@sosz](https://github.com/sosz))
|
||||
|
||||
## 3.6.0 / 2016-04-01
|
||||
|
||||
[#18](https://github.com/react-component/slider/issues/18) add `vertical` props ([@wnlee](https://github.com/WNLee))
|
||||
|
||||
...
|
||||
|
||||
## 1.2.5 / 2015-07-13
|
||||
|
||||
[#8](https://github.com/react-component/slider/issues/8) add `isIncluded` props ([@simaQ](https://github.com/simaQ))
|
||||
|
||||
[#7](https://github.com/react-component/slider/issues/7) add tooltip for handler when slider has no `marks` props ([@simaQ](https://github.com/simaQ))
|
||||
20
web/node_modules/rc-slider/LICENSE
generated
vendored
Normal file
20
web/node_modules/rc-slider/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2015-present Alipay.com, https://www.alipay.com/
|
||||
|
||||
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.
|
||||
170
web/node_modules/rc-slider/README.md
generated
vendored
Normal file
170
web/node_modules/rc-slider/README.md
generated
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
# rc-slider
|
||||
---
|
||||
|
||||
Slider UI component for React
|
||||
|
||||
[![NPM version][npm-image]][npm-url]
|
||||
[![build status][travis-image]][travis-url]
|
||||
[![Test coverage][codecov-image]][codecov-url]
|
||||
[![david-dm deps][david-dm-image]][david-dm-url]
|
||||
[![david-dm dev deps][david-dm-dev-image]][david-dm-dev-url]
|
||||
[![node version][node-image]][node-url]
|
||||
[![npm download][download-image]][download-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.svg?style=flat-square
|
||||
[travis-url]: https://travis-ci.org/react-component/slider
|
||||
[codecov-image]: https://img.shields.io/codecov/c/github/react-component/slider/master.svg?style=flat-square
|
||||
[codecov-url]: https://codecov.io/gh/react-component/slider/branch/master
|
||||
[david-dm-image]: https://david-dm.org/react-component/slider/status.svg
|
||||
[david-dm-url]: https://david-dm.org/react-component/slider
|
||||
[david-dm-dev-image]: https://david-dm.org/react-component/slider/dev-status.svg
|
||||
[david-dm-dev-url]: https://david-dm.org/react-component/slider?type=dev
|
||||
[node-image]: https://img.shields.io/badge/node.js-%3E=_0.10-green.svg?style=flat-square
|
||||
[node-url]: http://nodejs.org/download/
|
||||
[download-image]: https://img.shields.io/npm/dm/rc-slider.svg?style=flat-square
|
||||
[download-url]: https://npmjs.org/package/rc-slider
|
||||
|
||||
## Screenshots
|
||||
|
||||
<img src="https://t.alipayobjects.com/images/T1ki8fXeprXXXXXXXX.png" width="550"/>
|
||||
|
||||
<img src="https://t.alipayobjects.com/images/T1pPhfXhBqXXXXXXXX.png" width="550"/>
|
||||
|
||||
<img src="https://t.alipayobjects.com/images/T1wO8fXd4rXXXXXXXX.png" width="550"/>
|
||||
|
||||
<img src="http://i.giphy.com/l46Cs36c9HrHMExoc.gif"/>
|
||||
|
||||
|
||||
## Features
|
||||
|
||||
* Supports IE9, IE9+, Chrome, Firefox & Safari
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm install --save rc-slider
|
||||
```
|
||||
|
||||
[](https://npmjs.org/package/rc-slider)
|
||||
|
||||
## Usage
|
||||
|
||||
````js
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import Slider, { Range } from 'rc-slider';
|
||||
// We can just import Slider or Range to reduce bundle size
|
||||
// import Slider from 'rc-slider/lib/Slider';
|
||||
// import Range from 'rc-slider/lib/Range';
|
||||
import 'rc-slider/assets/index.css';
|
||||
|
||||
ReactDOM.render(
|
||||
<div>
|
||||
<Slider />
|
||||
<Range />
|
||||
</div>,
|
||||
container
|
||||
);
|
||||
`````
|
||||
|
||||
## API
|
||||
|
||||
### createSliderWithTooltip(Slider | Range) => React.Component
|
||||
|
||||
An extension to make Slider or Range support Tooltip on handle.
|
||||
|
||||
```jsx
|
||||
const Slider = require('rc-slider');
|
||||
const createSliderWithTooltip = Slider.createSliderWithTooltip;
|
||||
const Range = createSliderWithTooltip(Slider.Range);
|
||||
```
|
||||
|
||||
[Online demo](http://react-component.github.io/slider/examples/handle.html)
|
||||
|
||||
After Range or Slider was wrapped by createSliderWithTooltip, it will have the following props:
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| ------------ | ------- | ------- | ----------- |
|
||||
| tipFormatter | (value: number): React.ReactNode | `value => value` | A function to format tooltip's overlay |
|
||||
| tipProps | Object | `{` <br>`placement: 'top',` <br> ` prefixCls: 'rc-slider-tooltip',` <br> `overlay: tipFormatter(value)` <br> `}` | A function to format tooltip's overlay |
|
||||
|
||||
### Common API
|
||||
|
||||
The following APIs are shared by Slider and Range.
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| ------------ | ------- | ------- | ----------- |
|
||||
| className | string | `''` | Additional CSS class for the root DOM node |
|
||||
| min | number | `0` | The minimum value of the slider |
|
||||
| max | number | `100` | The maximum value of the slider |
|
||||
| marks | `{number: ReactNode}` or`{number: { style, label }}` | `{}` | Marks on the slider. The key determines the position, and the value determines what will show. If you want to set the style of a specific mark point, the value should be an object which contains `style` and `label` properties. |
|
||||
| step | number or `null` | `1` | Value to be added or subtracted on each step the slider makes. Must be greater than zero, and `max` - `min` should be evenly divisible by the step value. <br /> When `marks` is not an empty object, `step` can be set to `null`, to make `marks` as steps. |
|
||||
| vertical | boolean | `false` | If vertical is `true`, the slider will be vertical. |
|
||||
| handle | (props) => React.ReactNode | | A handle generator which could be used to customized handle. |
|
||||
| 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. |
|
||||
| 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. |
|
||||
| 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. |
|
||||
|
||||
### Slider
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| ------------ | ------- | ------- | ----------- |
|
||||
| defaultValue | number | `0` | Set initial value of slider. |
|
||||
| value | number | - | Set current value of slider. |
|
||||
| startPoint | number | `undefined` | Track starts from this value. If `undefined`, `min` is used. |
|
||||
| tabIndex | number | `0` | Set the tabIndex of the slider handle. |
|
||||
| ariaLabelForHandle | string | - | Set the `aria-label` attribute on the slider handle. |
|
||||
| ariaLabelledByForHandle | string | - | Set the `aria-labelledby` attribute on the slider handle. |
|
||||
| ariaValueTextFormatterForHandle | (value) => string | - | A function to set the `aria-valuetext` attribute on the slider handle. It receives the current value of the slider and returns a formatted string describing the value. See [WAI-ARIA Authoring Practices 1.1](https://www.w3.org/TR/wai-aria-practices-1.1/#slider) for more information. |
|
||||
|
||||
### Range
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| ------------ | ------- | ------- | ----------- |
|
||||
| defaultValue | `number[]` | `[0, 0]` | Set initial positions of handles. |
|
||||
| value | `number[]` | | Set current positions of handles. |
|
||||
| tabIndex | number[] | `[0, 0]` | Set the tabIndex of each handle. |
|
||||
| ariaLabelGroupForHandles | Array[string] | - | Set the `aria-label` attribute on each handle. |
|
||||
| ariaLabelledByGroupForHandles | Array[string] | - | Set the `aria-labelledby` attribute on each handle. |
|
||||
| ariaValueTextFormatterGroupForHandles | Array[(value) => string] | - | A function to set the `aria-valuetext` attribute on each handle. It receives the current value of the slider and returns a formatted string describing the value. See [WAI-ARIA Authoring Practices 1.1](https://www.w3.org/TR/wai-aria-practices-1.1/#slider) for more information. |
|
||||
| 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:  |
|
||||
|
||||
## Development
|
||||
|
||||
```
|
||||
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`
|
||||
|
||||
## 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`
|
||||
|
||||
## License
|
||||
|
||||
`rc-slider` is released under the MIT license.
|
||||
257
web/node_modules/rc-slider/assets/index.css
generated
vendored
Normal file
257
web/node_modules/rc-slider/assets/index.css
generated
vendored
Normal file
@@ -0,0 +1,257 @@
|
||||
.rc-slider {
|
||||
position: relative;
|
||||
height: 14px;
|
||||
padding: 5px 0;
|
||||
width: 100%;
|
||||
border-radius: 6px;
|
||||
-ms-touch-action: none;
|
||||
touch-action: none;
|
||||
box-sizing: border-box;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
.rc-slider * {
|
||||
box-sizing: border-box;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
.rc-slider-rail {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
background-color: #e9e9e9;
|
||||
height: 4px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
.rc-slider-track {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
height: 4px;
|
||||
border-radius: 6px;
|
||||
background-color: #abe2fb;
|
||||
}
|
||||
.rc-slider-handle {
|
||||
position: absolute;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
cursor: pointer;
|
||||
cursor: -webkit-grab;
|
||||
margin-top: -5px;
|
||||
cursor: grab;
|
||||
border-radius: 50%;
|
||||
border: solid 2px #96dbfa;
|
||||
background-color: #fff;
|
||||
-ms-touch-action: pan-x;
|
||||
touch-action: pan-x;
|
||||
}
|
||||
.rc-slider-handle-dragging.rc-slider-handle-dragging.rc-slider-handle-dragging {
|
||||
border-color: #57c5f7;
|
||||
box-shadow: 0 0 0 5px #96dbfa;
|
||||
}
|
||||
.rc-slider-handle:focus {
|
||||
outline: none;
|
||||
}
|
||||
.rc-slider-handle-click-focused:focus {
|
||||
border-color: #96dbfa;
|
||||
box-shadow: unset;
|
||||
}
|
||||
.rc-slider-handle:hover {
|
||||
border-color: #57c5f7;
|
||||
}
|
||||
.rc-slider-handle:active {
|
||||
border-color: #57c5f7;
|
||||
box-shadow: 0 0 5px #57c5f7;
|
||||
cursor: -webkit-grabbing;
|
||||
cursor: grabbing;
|
||||
}
|
||||
.rc-slider-mark {
|
||||
position: absolute;
|
||||
top: 18px;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
font-size: 12px;
|
||||
}
|
||||
.rc-slider-mark-text {
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
color: #999;
|
||||
}
|
||||
.rc-slider-mark-text-active {
|
||||
color: #666;
|
||||
}
|
||||
.rc-slider-step {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 4px;
|
||||
background: transparent;
|
||||
}
|
||||
.rc-slider-dot {
|
||||
position: absolute;
|
||||
bottom: -2px;
|
||||
margin-left: -4px;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border: 2px solid #e9e9e9;
|
||||
background-color: #fff;
|
||||
cursor: pointer;
|
||||
border-radius: 50%;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.rc-slider-dot-active {
|
||||
border-color: #96dbfa;
|
||||
}
|
||||
.rc-slider-dot-reverse {
|
||||
margin-right: -4px;
|
||||
}
|
||||
.rc-slider-disabled {
|
||||
background-color: #e9e9e9;
|
||||
}
|
||||
.rc-slider-disabled .rc-slider-track {
|
||||
background-color: #ccc;
|
||||
}
|
||||
.rc-slider-disabled .rc-slider-handle,
|
||||
.rc-slider-disabled .rc-slider-dot {
|
||||
border-color: #ccc;
|
||||
box-shadow: none;
|
||||
background-color: #fff;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.rc-slider-disabled .rc-slider-mark-text,
|
||||
.rc-slider-disabled .rc-slider-dot {
|
||||
cursor: not-allowed !important;
|
||||
}
|
||||
.rc-slider-vertical {
|
||||
width: 14px;
|
||||
height: 100%;
|
||||
padding: 0 5px;
|
||||
}
|
||||
.rc-slider-vertical .rc-slider-rail {
|
||||
height: 100%;
|
||||
width: 4px;
|
||||
}
|
||||
.rc-slider-vertical .rc-slider-track {
|
||||
left: 5px;
|
||||
bottom: 0;
|
||||
width: 4px;
|
||||
}
|
||||
.rc-slider-vertical .rc-slider-handle {
|
||||
margin-left: -5px;
|
||||
-ms-touch-action: pan-y;
|
||||
touch-action: pan-y;
|
||||
}
|
||||
.rc-slider-vertical .rc-slider-mark {
|
||||
top: 0;
|
||||
left: 18px;
|
||||
height: 100%;
|
||||
}
|
||||
.rc-slider-vertical .rc-slider-step {
|
||||
height: 100%;
|
||||
width: 4px;
|
||||
}
|
||||
.rc-slider-vertical .rc-slider-dot {
|
||||
left: 2px;
|
||||
margin-bottom: -4px;
|
||||
}
|
||||
.rc-slider-vertical .rc-slider-dot:first-child {
|
||||
margin-bottom: -4px;
|
||||
}
|
||||
.rc-slider-vertical .rc-slider-dot:last-child {
|
||||
margin-bottom: -4px;
|
||||
}
|
||||
.rc-slider-tooltip-zoom-down-enter,
|
||||
.rc-slider-tooltip-zoom-down-appear {
|
||||
animation-duration: .3s;
|
||||
animation-fill-mode: both;
|
||||
display: block !important;
|
||||
animation-play-state: paused;
|
||||
}
|
||||
.rc-slider-tooltip-zoom-down-leave {
|
||||
animation-duration: .3s;
|
||||
animation-fill-mode: both;
|
||||
display: block !important;
|
||||
animation-play-state: paused;
|
||||
}
|
||||
.rc-slider-tooltip-zoom-down-enter.rc-slider-tooltip-zoom-down-enter-active,
|
||||
.rc-slider-tooltip-zoom-down-appear.rc-slider-tooltip-zoom-down-appear-active {
|
||||
animation-name: rcSliderTooltipZoomDownIn;
|
||||
animation-play-state: running;
|
||||
}
|
||||
.rc-slider-tooltip-zoom-down-leave.rc-slider-tooltip-zoom-down-leave-active {
|
||||
animation-name: rcSliderTooltipZoomDownOut;
|
||||
animation-play-state: running;
|
||||
}
|
||||
.rc-slider-tooltip-zoom-down-enter,
|
||||
.rc-slider-tooltip-zoom-down-appear {
|
||||
transform: scale(0, 0);
|
||||
animation-timing-function: cubic-bezier(0.23, 1, 0.32, 1);
|
||||
}
|
||||
.rc-slider-tooltip-zoom-down-leave {
|
||||
animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
|
||||
}
|
||||
@keyframes rcSliderTooltipZoomDownIn {
|
||||
0% {
|
||||
opacity: 0;
|
||||
transform-origin: 50% 100%;
|
||||
transform: scale(0, 0);
|
||||
}
|
||||
100% {
|
||||
transform-origin: 50% 100%;
|
||||
transform: scale(1, 1);
|
||||
}
|
||||
}
|
||||
@keyframes rcSliderTooltipZoomDownOut {
|
||||
0% {
|
||||
transform-origin: 50% 100%;
|
||||
transform: scale(1, 1);
|
||||
}
|
||||
100% {
|
||||
opacity: 0;
|
||||
transform-origin: 50% 100%;
|
||||
transform: scale(0, 0);
|
||||
}
|
||||
}
|
||||
.rc-slider-tooltip {
|
||||
position: absolute;
|
||||
left: -9999px;
|
||||
top: -9999px;
|
||||
visibility: visible;
|
||||
box-sizing: border-box;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
.rc-slider-tooltip * {
|
||||
box-sizing: border-box;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
.rc-slider-tooltip-hidden {
|
||||
display: none;
|
||||
}
|
||||
.rc-slider-tooltip-placement-top {
|
||||
padding: 4px 0 8px 0;
|
||||
}
|
||||
.rc-slider-tooltip-inner {
|
||||
padding: 6px 2px;
|
||||
min-width: 24px;
|
||||
height: 24px;
|
||||
font-size: 12px;
|
||||
line-height: 1;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
background-color: #6c6c6c;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 0 4px #d9d9d9;
|
||||
}
|
||||
.rc-slider-tooltip-arrow {
|
||||
position: absolute;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-color: transparent;
|
||||
border-style: solid;
|
||||
}
|
||||
.rc-slider-tooltip-placement-top .rc-slider-tooltip-arrow {
|
||||
bottom: 4px;
|
||||
left: 50%;
|
||||
margin-left: -4px;
|
||||
border-width: 4px 4px 0;
|
||||
border-top-color: #6c6c6c;
|
||||
}
|
||||
259
web/node_modules/rc-slider/dist/rc-slider.css
generated
vendored
Normal file
259
web/node_modules/rc-slider/dist/rc-slider.css
generated
vendored
Normal file
@@ -0,0 +1,259 @@
|
||||
.rc-slider {
|
||||
position: relative;
|
||||
height: 14px;
|
||||
padding: 5px 0;
|
||||
width: 100%;
|
||||
border-radius: 6px;
|
||||
-ms-touch-action: none;
|
||||
touch-action: none;
|
||||
box-sizing: border-box;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
.rc-slider * {
|
||||
box-sizing: border-box;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
.rc-slider-rail {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
background-color: #e9e9e9;
|
||||
height: 4px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
.rc-slider-track {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
height: 4px;
|
||||
border-radius: 6px;
|
||||
background-color: #abe2fb;
|
||||
}
|
||||
.rc-slider-handle {
|
||||
position: absolute;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
cursor: pointer;
|
||||
cursor: -webkit-grab;
|
||||
margin-top: -5px;
|
||||
cursor: grab;
|
||||
border-radius: 50%;
|
||||
border: solid 2px #96dbfa;
|
||||
background-color: #fff;
|
||||
-ms-touch-action: pan-x;
|
||||
touch-action: pan-x;
|
||||
}
|
||||
.rc-slider-handle-dragging.rc-slider-handle-dragging.rc-slider-handle-dragging {
|
||||
border-color: #57c5f7;
|
||||
box-shadow: 0 0 0 5px #96dbfa;
|
||||
}
|
||||
.rc-slider-handle:focus {
|
||||
outline: none;
|
||||
}
|
||||
.rc-slider-handle-click-focused:focus {
|
||||
border-color: #96dbfa;
|
||||
box-shadow: unset;
|
||||
}
|
||||
.rc-slider-handle:hover {
|
||||
border-color: #57c5f7;
|
||||
}
|
||||
.rc-slider-handle:active {
|
||||
border-color: #57c5f7;
|
||||
box-shadow: 0 0 5px #57c5f7;
|
||||
cursor: -webkit-grabbing;
|
||||
cursor: grabbing;
|
||||
}
|
||||
.rc-slider-mark {
|
||||
position: absolute;
|
||||
top: 18px;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
font-size: 12px;
|
||||
}
|
||||
.rc-slider-mark-text {
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
color: #999;
|
||||
}
|
||||
.rc-slider-mark-text-active {
|
||||
color: #666;
|
||||
}
|
||||
.rc-slider-step {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 4px;
|
||||
background: transparent;
|
||||
}
|
||||
.rc-slider-dot {
|
||||
position: absolute;
|
||||
bottom: -2px;
|
||||
margin-left: -4px;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border: 2px solid #e9e9e9;
|
||||
background-color: #fff;
|
||||
cursor: pointer;
|
||||
border-radius: 50%;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.rc-slider-dot-active {
|
||||
border-color: #96dbfa;
|
||||
}
|
||||
.rc-slider-dot-reverse {
|
||||
margin-right: -4px;
|
||||
}
|
||||
.rc-slider-disabled {
|
||||
background-color: #e9e9e9;
|
||||
}
|
||||
.rc-slider-disabled .rc-slider-track {
|
||||
background-color: #ccc;
|
||||
}
|
||||
.rc-slider-disabled .rc-slider-handle,
|
||||
.rc-slider-disabled .rc-slider-dot {
|
||||
border-color: #ccc;
|
||||
box-shadow: none;
|
||||
background-color: #fff;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.rc-slider-disabled .rc-slider-mark-text,
|
||||
.rc-slider-disabled .rc-slider-dot {
|
||||
cursor: not-allowed !important;
|
||||
}
|
||||
.rc-slider-vertical {
|
||||
width: 14px;
|
||||
height: 100%;
|
||||
padding: 0 5px;
|
||||
}
|
||||
.rc-slider-vertical .rc-slider-rail {
|
||||
height: 100%;
|
||||
width: 4px;
|
||||
}
|
||||
.rc-slider-vertical .rc-slider-track {
|
||||
left: 5px;
|
||||
bottom: 0;
|
||||
width: 4px;
|
||||
}
|
||||
.rc-slider-vertical .rc-slider-handle {
|
||||
margin-left: -5px;
|
||||
-ms-touch-action: pan-y;
|
||||
touch-action: pan-y;
|
||||
}
|
||||
.rc-slider-vertical .rc-slider-mark {
|
||||
top: 0;
|
||||
left: 18px;
|
||||
height: 100%;
|
||||
}
|
||||
.rc-slider-vertical .rc-slider-step {
|
||||
height: 100%;
|
||||
width: 4px;
|
||||
}
|
||||
.rc-slider-vertical .rc-slider-dot {
|
||||
left: 2px;
|
||||
margin-bottom: -4px;
|
||||
}
|
||||
.rc-slider-vertical .rc-slider-dot:first-child {
|
||||
margin-bottom: -4px;
|
||||
}
|
||||
.rc-slider-vertical .rc-slider-dot:last-child {
|
||||
margin-bottom: -4px;
|
||||
}
|
||||
.rc-slider-tooltip-zoom-down-enter,
|
||||
.rc-slider-tooltip-zoom-down-appear {
|
||||
animation-duration: .3s;
|
||||
animation-fill-mode: both;
|
||||
display: block !important;
|
||||
animation-play-state: paused;
|
||||
}
|
||||
.rc-slider-tooltip-zoom-down-leave {
|
||||
animation-duration: .3s;
|
||||
animation-fill-mode: both;
|
||||
display: block !important;
|
||||
animation-play-state: paused;
|
||||
}
|
||||
.rc-slider-tooltip-zoom-down-enter.rc-slider-tooltip-zoom-down-enter-active,
|
||||
.rc-slider-tooltip-zoom-down-appear.rc-slider-tooltip-zoom-down-appear-active {
|
||||
animation-name: rcSliderTooltipZoomDownIn;
|
||||
animation-play-state: running;
|
||||
}
|
||||
.rc-slider-tooltip-zoom-down-leave.rc-slider-tooltip-zoom-down-leave-active {
|
||||
animation-name: rcSliderTooltipZoomDownOut;
|
||||
animation-play-state: running;
|
||||
}
|
||||
.rc-slider-tooltip-zoom-down-enter,
|
||||
.rc-slider-tooltip-zoom-down-appear {
|
||||
transform: scale(0, 0);
|
||||
animation-timing-function: cubic-bezier(0.23, 1, 0.32, 1);
|
||||
}
|
||||
.rc-slider-tooltip-zoom-down-leave {
|
||||
animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
|
||||
}
|
||||
@keyframes rcSliderTooltipZoomDownIn {
|
||||
0% {
|
||||
opacity: 0;
|
||||
transform-origin: 50% 100%;
|
||||
transform: scale(0, 0);
|
||||
}
|
||||
100% {
|
||||
transform-origin: 50% 100%;
|
||||
transform: scale(1, 1);
|
||||
}
|
||||
}
|
||||
@keyframes rcSliderTooltipZoomDownOut {
|
||||
0% {
|
||||
transform-origin: 50% 100%;
|
||||
transform: scale(1, 1);
|
||||
}
|
||||
100% {
|
||||
opacity: 0;
|
||||
transform-origin: 50% 100%;
|
||||
transform: scale(0, 0);
|
||||
}
|
||||
}
|
||||
.rc-slider-tooltip {
|
||||
position: absolute;
|
||||
left: -9999px;
|
||||
top: -9999px;
|
||||
visibility: visible;
|
||||
box-sizing: border-box;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
.rc-slider-tooltip * {
|
||||
box-sizing: border-box;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
.rc-slider-tooltip-hidden {
|
||||
display: none;
|
||||
}
|
||||
.rc-slider-tooltip-placement-top {
|
||||
padding: 4px 0 8px 0;
|
||||
}
|
||||
.rc-slider-tooltip-inner {
|
||||
padding: 6px 2px;
|
||||
min-width: 24px;
|
||||
height: 24px;
|
||||
font-size: 12px;
|
||||
line-height: 1;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
background-color: #6c6c6c;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 0 4px #d9d9d9;
|
||||
}
|
||||
.rc-slider-tooltip-arrow {
|
||||
position: absolute;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-color: transparent;
|
||||
border-style: solid;
|
||||
}
|
||||
.rc-slider-tooltip-placement-top .rc-slider-tooltip-arrow {
|
||||
bottom: 4px;
|
||||
left: 50%;
|
||||
margin-left: -4px;
|
||||
border-width: 4px 4px 0;
|
||||
border-top-color: #6c6c6c;
|
||||
}
|
||||
|
||||
/*# sourceMappingURL=rc-slider.css.map*/
|
||||
1
web/node_modules/rc-slider/dist/rc-slider.css.map
generated
vendored
Normal file
1
web/node_modules/rc-slider/dist/rc-slider.css.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
11608
web/node_modules/rc-slider/dist/rc-slider.js
generated
vendored
Normal file
11608
web/node_modules/rc-slider/dist/rc-slider.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
web/node_modules/rc-slider/dist/rc-slider.js.map
generated
vendored
Normal file
1
web/node_modules/rc-slider/dist/rc-slider.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
259
web/node_modules/rc-slider/dist/rc-slider.min.css
generated
vendored
Normal file
259
web/node_modules/rc-slider/dist/rc-slider.min.css
generated
vendored
Normal file
@@ -0,0 +1,259 @@
|
||||
.rc-slider {
|
||||
position: relative;
|
||||
height: 14px;
|
||||
padding: 5px 0;
|
||||
width: 100%;
|
||||
border-radius: 6px;
|
||||
-ms-touch-action: none;
|
||||
touch-action: none;
|
||||
box-sizing: border-box;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
.rc-slider * {
|
||||
box-sizing: border-box;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
.rc-slider-rail {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
background-color: #e9e9e9;
|
||||
height: 4px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
.rc-slider-track {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
height: 4px;
|
||||
border-radius: 6px;
|
||||
background-color: #abe2fb;
|
||||
}
|
||||
.rc-slider-handle {
|
||||
position: absolute;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
cursor: pointer;
|
||||
cursor: -webkit-grab;
|
||||
margin-top: -5px;
|
||||
cursor: grab;
|
||||
border-radius: 50%;
|
||||
border: solid 2px #96dbfa;
|
||||
background-color: #fff;
|
||||
-ms-touch-action: pan-x;
|
||||
touch-action: pan-x;
|
||||
}
|
||||
.rc-slider-handle-dragging.rc-slider-handle-dragging.rc-slider-handle-dragging {
|
||||
border-color: #57c5f7;
|
||||
box-shadow: 0 0 0 5px #96dbfa;
|
||||
}
|
||||
.rc-slider-handle:focus {
|
||||
outline: none;
|
||||
}
|
||||
.rc-slider-handle-click-focused:focus {
|
||||
border-color: #96dbfa;
|
||||
box-shadow: unset;
|
||||
}
|
||||
.rc-slider-handle:hover {
|
||||
border-color: #57c5f7;
|
||||
}
|
||||
.rc-slider-handle:active {
|
||||
border-color: #57c5f7;
|
||||
box-shadow: 0 0 5px #57c5f7;
|
||||
cursor: -webkit-grabbing;
|
||||
cursor: grabbing;
|
||||
}
|
||||
.rc-slider-mark {
|
||||
position: absolute;
|
||||
top: 18px;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
font-size: 12px;
|
||||
}
|
||||
.rc-slider-mark-text {
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
color: #999;
|
||||
}
|
||||
.rc-slider-mark-text-active {
|
||||
color: #666;
|
||||
}
|
||||
.rc-slider-step {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 4px;
|
||||
background: transparent;
|
||||
}
|
||||
.rc-slider-dot {
|
||||
position: absolute;
|
||||
bottom: -2px;
|
||||
margin-left: -4px;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border: 2px solid #e9e9e9;
|
||||
background-color: #fff;
|
||||
cursor: pointer;
|
||||
border-radius: 50%;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.rc-slider-dot-active {
|
||||
border-color: #96dbfa;
|
||||
}
|
||||
.rc-slider-dot-reverse {
|
||||
margin-right: -4px;
|
||||
}
|
||||
.rc-slider-disabled {
|
||||
background-color: #e9e9e9;
|
||||
}
|
||||
.rc-slider-disabled .rc-slider-track {
|
||||
background-color: #ccc;
|
||||
}
|
||||
.rc-slider-disabled .rc-slider-handle,
|
||||
.rc-slider-disabled .rc-slider-dot {
|
||||
border-color: #ccc;
|
||||
box-shadow: none;
|
||||
background-color: #fff;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.rc-slider-disabled .rc-slider-mark-text,
|
||||
.rc-slider-disabled .rc-slider-dot {
|
||||
cursor: not-allowed !important;
|
||||
}
|
||||
.rc-slider-vertical {
|
||||
width: 14px;
|
||||
height: 100%;
|
||||
padding: 0 5px;
|
||||
}
|
||||
.rc-slider-vertical .rc-slider-rail {
|
||||
height: 100%;
|
||||
width: 4px;
|
||||
}
|
||||
.rc-slider-vertical .rc-slider-track {
|
||||
left: 5px;
|
||||
bottom: 0;
|
||||
width: 4px;
|
||||
}
|
||||
.rc-slider-vertical .rc-slider-handle {
|
||||
margin-left: -5px;
|
||||
-ms-touch-action: pan-y;
|
||||
touch-action: pan-y;
|
||||
}
|
||||
.rc-slider-vertical .rc-slider-mark {
|
||||
top: 0;
|
||||
left: 18px;
|
||||
height: 100%;
|
||||
}
|
||||
.rc-slider-vertical .rc-slider-step {
|
||||
height: 100%;
|
||||
width: 4px;
|
||||
}
|
||||
.rc-slider-vertical .rc-slider-dot {
|
||||
left: 2px;
|
||||
margin-bottom: -4px;
|
||||
}
|
||||
.rc-slider-vertical .rc-slider-dot:first-child {
|
||||
margin-bottom: -4px;
|
||||
}
|
||||
.rc-slider-vertical .rc-slider-dot:last-child {
|
||||
margin-bottom: -4px;
|
||||
}
|
||||
.rc-slider-tooltip-zoom-down-enter,
|
||||
.rc-slider-tooltip-zoom-down-appear {
|
||||
animation-duration: .3s;
|
||||
animation-fill-mode: both;
|
||||
display: block !important;
|
||||
animation-play-state: paused;
|
||||
}
|
||||
.rc-slider-tooltip-zoom-down-leave {
|
||||
animation-duration: .3s;
|
||||
animation-fill-mode: both;
|
||||
display: block !important;
|
||||
animation-play-state: paused;
|
||||
}
|
||||
.rc-slider-tooltip-zoom-down-enter.rc-slider-tooltip-zoom-down-enter-active,
|
||||
.rc-slider-tooltip-zoom-down-appear.rc-slider-tooltip-zoom-down-appear-active {
|
||||
animation-name: rcSliderTooltipZoomDownIn;
|
||||
animation-play-state: running;
|
||||
}
|
||||
.rc-slider-tooltip-zoom-down-leave.rc-slider-tooltip-zoom-down-leave-active {
|
||||
animation-name: rcSliderTooltipZoomDownOut;
|
||||
animation-play-state: running;
|
||||
}
|
||||
.rc-slider-tooltip-zoom-down-enter,
|
||||
.rc-slider-tooltip-zoom-down-appear {
|
||||
transform: scale(0, 0);
|
||||
animation-timing-function: cubic-bezier(0.23, 1, 0.32, 1);
|
||||
}
|
||||
.rc-slider-tooltip-zoom-down-leave {
|
||||
animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
|
||||
}
|
||||
@keyframes rcSliderTooltipZoomDownIn {
|
||||
0% {
|
||||
opacity: 0;
|
||||
transform-origin: 50% 100%;
|
||||
transform: scale(0, 0);
|
||||
}
|
||||
100% {
|
||||
transform-origin: 50% 100%;
|
||||
transform: scale(1, 1);
|
||||
}
|
||||
}
|
||||
@keyframes rcSliderTooltipZoomDownOut {
|
||||
0% {
|
||||
transform-origin: 50% 100%;
|
||||
transform: scale(1, 1);
|
||||
}
|
||||
100% {
|
||||
opacity: 0;
|
||||
transform-origin: 50% 100%;
|
||||
transform: scale(0, 0);
|
||||
}
|
||||
}
|
||||
.rc-slider-tooltip {
|
||||
position: absolute;
|
||||
left: -9999px;
|
||||
top: -9999px;
|
||||
visibility: visible;
|
||||
box-sizing: border-box;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
.rc-slider-tooltip * {
|
||||
box-sizing: border-box;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
.rc-slider-tooltip-hidden {
|
||||
display: none;
|
||||
}
|
||||
.rc-slider-tooltip-placement-top {
|
||||
padding: 4px 0 8px 0;
|
||||
}
|
||||
.rc-slider-tooltip-inner {
|
||||
padding: 6px 2px;
|
||||
min-width: 24px;
|
||||
height: 24px;
|
||||
font-size: 12px;
|
||||
line-height: 1;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
background-color: #6c6c6c;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 0 4px #d9d9d9;
|
||||
}
|
||||
.rc-slider-tooltip-arrow {
|
||||
position: absolute;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-color: transparent;
|
||||
border-style: solid;
|
||||
}
|
||||
.rc-slider-tooltip-placement-top .rc-slider-tooltip-arrow {
|
||||
bottom: 4px;
|
||||
left: 50%;
|
||||
margin-left: -4px;
|
||||
border-width: 4px 4px 0;
|
||||
border-top-color: #6c6c6c;
|
||||
}
|
||||
|
||||
/*# sourceMappingURL=rc-slider.min.css.map*/
|
||||
1
web/node_modules/rc-slider/dist/rc-slider.min.css.map
generated
vendored
Normal file
1
web/node_modules/rc-slider/dist/rc-slider.min.css.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
web/node_modules/rc-slider/dist/rc-slider.min.js
generated
vendored
Normal file
1
web/node_modules/rc-slider/dist/rc-slider.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
140
web/node_modules/rc-slider/es/Handle.js
generated
vendored
Normal file
140
web/node_modules/rc-slider/es/Handle.js
generated
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
import _extends from 'babel-runtime/helpers/extends';
|
||||
import _defineProperty from 'babel-runtime/helpers/defineProperty';
|
||||
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
|
||||
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
|
||||
import _createClass from 'babel-runtime/helpers/createClass';
|
||||
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
|
||||
import _inherits from 'babel-runtime/helpers/inherits';
|
||||
import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import addEventListener from 'rc-util/es/Dom/addEventListener';
|
||||
|
||||
var Handle = function (_React$Component) {
|
||||
_inherits(Handle, _React$Component);
|
||||
|
||||
function Handle() {
|
||||
var _ref;
|
||||
|
||||
var _temp, _this, _ret;
|
||||
|
||||
_classCallCheck(this, Handle);
|
||||
|
||||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Handle.__proto__ || Object.getPrototypeOf(Handle)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
|
||||
clickFocused: false
|
||||
}, _this.setHandleRef = function (node) {
|
||||
_this.handle = node;
|
||||
}, _this.handleMouseUp = function () {
|
||||
if (document.activeElement === _this.handle) {
|
||||
_this.setClickFocus(true);
|
||||
}
|
||||
}, _this.handleMouseDown = function () {
|
||||
// fix https://github.com/ant-design/ant-design/issues/15324
|
||||
_this.focus();
|
||||
}, _this.handleBlur = function () {
|
||||
_this.setClickFocus(false);
|
||||
}, _this.handleKeyDown = function () {
|
||||
_this.setClickFocus(false);
|
||||
}, _temp), _possibleConstructorReturn(_this, _ret);
|
||||
}
|
||||
|
||||
_createClass(Handle, [{
|
||||
key: 'componentDidMount',
|
||||
value: function componentDidMount() {
|
||||
// mouseup won't trigger if mouse moved out of handle,
|
||||
// so we listen on document here.
|
||||
this.onMouseUpListener = addEventListener(document, 'mouseup', this.handleMouseUp);
|
||||
}
|
||||
}, {
|
||||
key: 'componentWillUnmount',
|
||||
value: function componentWillUnmount() {
|
||||
if (this.onMouseUpListener) {
|
||||
this.onMouseUpListener.remove();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'setClickFocus',
|
||||
value: function setClickFocus(focused) {
|
||||
this.setState({ clickFocused: focused });
|
||||
}
|
||||
}, {
|
||||
key: 'clickFocus',
|
||||
value: function clickFocus() {
|
||||
this.setClickFocus(true);
|
||||
this.focus();
|
||||
}
|
||||
}, {
|
||||
key: 'focus',
|
||||
value: function focus() {
|
||||
this.handle.focus();
|
||||
}
|
||||
}, {
|
||||
key: 'blur',
|
||||
value: function blur() {
|
||||
this.handle.blur();
|
||||
}
|
||||
}, {
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var _ref2, _ref3;
|
||||
|
||||
var _props = this.props,
|
||||
prefixCls = _props.prefixCls,
|
||||
vertical = _props.vertical,
|
||||
reverse = _props.reverse,
|
||||
offset = _props.offset,
|
||||
style = _props.style,
|
||||
disabled = _props.disabled,
|
||||
min = _props.min,
|
||||
max = _props.max,
|
||||
value = _props.value,
|
||||
tabIndex = _props.tabIndex,
|
||||
ariaLabel = _props.ariaLabel,
|
||||
ariaLabelledBy = _props.ariaLabelledBy,
|
||||
ariaValueTextFormatter = _props.ariaValueTextFormatter,
|
||||
restProps = _objectWithoutProperties(_props, ['prefixCls', 'vertical', 'reverse', 'offset', 'style', 'disabled', 'min', 'max', 'value', 'tabIndex', 'ariaLabel', 'ariaLabelledBy', 'ariaValueTextFormatter']);
|
||||
|
||||
var className = classNames(this.props.className, _defineProperty({}, prefixCls + '-handle-click-focused', this.state.clickFocused));
|
||||
var positionStyle = vertical ? (_ref2 = {}, _defineProperty(_ref2, reverse ? 'top' : 'bottom', offset + '%'), _defineProperty(_ref2, reverse ? 'bottom' : 'top', 'auto'), _defineProperty(_ref2, 'transform', reverse ? null : 'translateY(+50%)'), _ref2) : (_ref3 = {}, _defineProperty(_ref3, reverse ? 'right' : 'left', offset + '%'), _defineProperty(_ref3, reverse ? 'left' : 'right', 'auto'), _defineProperty(_ref3, 'transform', 'translateX(' + (reverse ? '+' : '-') + '50%)'), _ref3);
|
||||
var elStyle = _extends({}, style, positionStyle);
|
||||
|
||||
var _tabIndex = tabIndex || 0;
|
||||
if (disabled || tabIndex === null) {
|
||||
_tabIndex = null;
|
||||
}
|
||||
|
||||
var ariaValueText = void 0;
|
||||
if (ariaValueTextFormatter) {
|
||||
ariaValueText = ariaValueTextFormatter(value);
|
||||
}
|
||||
|
||||
return React.createElement('div', _extends({
|
||||
ref: this.setHandleRef,
|
||||
tabIndex: _tabIndex
|
||||
}, restProps, {
|
||||
className: className,
|
||||
style: elStyle,
|
||||
onBlur: this.handleBlur,
|
||||
onKeyDown: this.handleKeyDown,
|
||||
onMouseDown: this.handleMouseDown
|
||||
|
||||
// aria attribute
|
||||
, role: 'slider',
|
||||
'aria-valuemin': min,
|
||||
'aria-valuemax': max,
|
||||
'aria-valuenow': value,
|
||||
'aria-disabled': !!disabled,
|
||||
'aria-label': ariaLabel,
|
||||
'aria-labelledby': ariaLabelledBy,
|
||||
'aria-valuetext': ariaValueText
|
||||
}));
|
||||
}
|
||||
}]);
|
||||
|
||||
return Handle;
|
||||
}(React.Component);
|
||||
|
||||
export default Handle;
|
||||
525
web/node_modules/rc-slider/es/Range.js
generated
vendored
Normal file
525
web/node_modules/rc-slider/es/Range.js
generated
vendored
Normal file
@@ -0,0 +1,525 @@
|
||||
import _defineProperty from 'babel-runtime/helpers/defineProperty';
|
||||
import _extends from 'babel-runtime/helpers/extends';
|
||||
import _toConsumableArray from 'babel-runtime/helpers/toConsumableArray';
|
||||
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
|
||||
import _createClass from 'babel-runtime/helpers/createClass';
|
||||
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
|
||||
import _inherits from 'babel-runtime/helpers/inherits';
|
||||
import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import shallowEqual from 'shallowequal';
|
||||
import Track from './common/Track';
|
||||
import createSlider from './common/createSlider';
|
||||
import * as utils from './utils';
|
||||
|
||||
var _trimAlignValue = function _trimAlignValue(_ref) {
|
||||
var value = _ref.value,
|
||||
handle = _ref.handle,
|
||||
bounds = _ref.bounds,
|
||||
props = _ref.props;
|
||||
var allowCross = props.allowCross,
|
||||
pushable = props.pushable;
|
||||
|
||||
var thershold = Number(pushable);
|
||||
var valInRange = utils.ensureValueInRange(value, props);
|
||||
var valNotConflict = valInRange;
|
||||
if (!allowCross && handle != null && bounds !== undefined) {
|
||||
if (handle > 0 && valInRange <= bounds[handle - 1] + thershold) {
|
||||
valNotConflict = bounds[handle - 1] + thershold;
|
||||
}
|
||||
if (handle < bounds.length - 1 && valInRange >= bounds[handle + 1] - thershold) {
|
||||
valNotConflict = bounds[handle + 1] - thershold;
|
||||
}
|
||||
}
|
||||
return utils.ensureValuePrecision(valNotConflict, props);
|
||||
};
|
||||
|
||||
var Range = function (_React$Component) {
|
||||
_inherits(Range, _React$Component);
|
||||
|
||||
function Range(props) {
|
||||
_classCallCheck(this, Range);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, (Range.__proto__ || Object.getPrototypeOf(Range)).call(this, props));
|
||||
|
||||
_this.onEnd = function (force) {
|
||||
var handle = _this.state.handle;
|
||||
|
||||
_this.removeDocumentEvents();
|
||||
|
||||
if (handle !== null || force) {
|
||||
_this.props.onAfterChange(_this.getValue());
|
||||
}
|
||||
|
||||
_this.setState({
|
||||
handle: null
|
||||
});
|
||||
};
|
||||
|
||||
var count = props.count,
|
||||
min = props.min,
|
||||
max = props.max;
|
||||
|
||||
var initialValue = Array.apply(undefined, _toConsumableArray(Array(count + 1))).map(function () {
|
||||
return min;
|
||||
});
|
||||
var defaultValue = 'defaultValue' in props ? props.defaultValue : initialValue;
|
||||
var value = props.value !== undefined ? props.value : defaultValue;
|
||||
var bounds = value.map(function (v, i) {
|
||||
return _trimAlignValue({
|
||||
value: v,
|
||||
handle: i,
|
||||
props: props
|
||||
});
|
||||
});
|
||||
var recent = bounds[0] === max ? 0 : bounds.length - 1;
|
||||
|
||||
_this.state = {
|
||||
handle: null,
|
||||
recent: recent,
|
||||
bounds: bounds
|
||||
};
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(Range, [{
|
||||
key: 'componentDidUpdate',
|
||||
value: function componentDidUpdate(prevProps, prevState) {
|
||||
var _this2 = this;
|
||||
|
||||
if (!('value' in this.props || 'min' in this.props || 'max' in this.props)) {
|
||||
return;
|
||||
}
|
||||
if (this.props.min === prevProps.min && this.props.max === prevProps.max && shallowEqual(this.props.value, prevProps.value)) {
|
||||
return;
|
||||
}
|
||||
var _props = this.props,
|
||||
onChange = _props.onChange,
|
||||
value = _props.value;
|
||||
|
||||
var currentValue = value || prevState.bounds;
|
||||
if (currentValue.some(function (v) {
|
||||
return utils.isValueOutOfRange(v, _this2.props);
|
||||
})) {
|
||||
var newValues = currentValue.map(function (v) {
|
||||
return utils.ensureValueInRange(v, _this2.props);
|
||||
});
|
||||
onChange(newValues);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'onChange',
|
||||
value: function onChange(state) {
|
||||
var props = this.props;
|
||||
var isNotControlled = !('value' in props);
|
||||
if (isNotControlled) {
|
||||
this.setState(state);
|
||||
} else {
|
||||
var controlledState = {};
|
||||
|
||||
['handle', 'recent'].forEach(function (item) {
|
||||
if (state[item] !== undefined) {
|
||||
controlledState[item] = state[item];
|
||||
}
|
||||
});
|
||||
|
||||
if (Object.keys(controlledState).length) {
|
||||
this.setState(controlledState);
|
||||
}
|
||||
}
|
||||
|
||||
var data = _extends({}, this.state, state);
|
||||
var changedValue = data.bounds;
|
||||
props.onChange(changedValue);
|
||||
}
|
||||
}, {
|
||||
key: 'onStart',
|
||||
value: function onStart(position) {
|
||||
var props = this.props;
|
||||
var state = this.state;
|
||||
var bounds = this.getValue();
|
||||
props.onBeforeChange(bounds);
|
||||
|
||||
var value = this.calcValueByPos(position);
|
||||
this.startValue = value;
|
||||
this.startPosition = position;
|
||||
|
||||
var closestBound = this.getClosestBound(value);
|
||||
this.prevMovedHandleIndex = this.getBoundNeedMoving(value, closestBound);
|
||||
|
||||
this.setState({
|
||||
handle: this.prevMovedHandleIndex,
|
||||
recent: this.prevMovedHandleIndex
|
||||
});
|
||||
|
||||
var prevValue = bounds[this.prevMovedHandleIndex];
|
||||
if (value === prevValue) return;
|
||||
|
||||
var nextBounds = [].concat(_toConsumableArray(state.bounds));
|
||||
nextBounds[this.prevMovedHandleIndex] = value;
|
||||
this.onChange({ bounds: nextBounds });
|
||||
}
|
||||
}, {
|
||||
key: 'onMove',
|
||||
value: function onMove(e, position) {
|
||||
utils.pauseEvent(e);
|
||||
var state = this.state;
|
||||
|
||||
var value = this.calcValueByPos(position);
|
||||
var oldValue = state.bounds[state.handle];
|
||||
if (value === oldValue) return;
|
||||
|
||||
this.moveTo(value);
|
||||
}
|
||||
}, {
|
||||
key: 'onKeyboard',
|
||||
value: function onKeyboard(e) {
|
||||
var _props2 = this.props,
|
||||
reverse = _props2.reverse,
|
||||
vertical = _props2.vertical;
|
||||
|
||||
var valueMutator = utils.getKeyboardValueMutator(e, vertical, reverse);
|
||||
|
||||
if (valueMutator) {
|
||||
utils.pauseEvent(e);
|
||||
var state = this.state,
|
||||
props = this.props;
|
||||
var bounds = state.bounds,
|
||||
handle = state.handle;
|
||||
|
||||
var oldValue = bounds[handle === null ? state.recent : handle];
|
||||
var mutatedValue = valueMutator(oldValue, props);
|
||||
var value = _trimAlignValue({
|
||||
value: mutatedValue,
|
||||
handle: handle,
|
||||
bounds: state.bounds,
|
||||
props: props
|
||||
});
|
||||
if (value === oldValue) return;
|
||||
var isFromKeyboardEvent = true;
|
||||
this.moveTo(value, isFromKeyboardEvent);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'getValue',
|
||||
value: function getValue() {
|
||||
return this.state.bounds;
|
||||
}
|
||||
}, {
|
||||
key: 'getClosestBound',
|
||||
value: function getClosestBound(value) {
|
||||
var bounds = this.state.bounds;
|
||||
|
||||
var closestBound = 0;
|
||||
for (var i = 1; i < bounds.length - 1; ++i) {
|
||||
if (value >= bounds[i]) {
|
||||
closestBound = i;
|
||||
}
|
||||
}
|
||||
if (Math.abs(bounds[closestBound + 1] - value) < Math.abs(bounds[closestBound] - value)) {
|
||||
closestBound += 1;
|
||||
}
|
||||
return closestBound;
|
||||
}
|
||||
}, {
|
||||
key: 'getBoundNeedMoving',
|
||||
value: function getBoundNeedMoving(value, closestBound) {
|
||||
var _state = this.state,
|
||||
bounds = _state.bounds,
|
||||
recent = _state.recent;
|
||||
|
||||
var boundNeedMoving = closestBound;
|
||||
var isAtTheSamePoint = bounds[closestBound + 1] === bounds[closestBound];
|
||||
|
||||
if (isAtTheSamePoint && bounds[recent] === bounds[closestBound]) {
|
||||
boundNeedMoving = recent;
|
||||
}
|
||||
|
||||
if (isAtTheSamePoint && value !== bounds[closestBound + 1]) {
|
||||
boundNeedMoving = value < bounds[closestBound + 1] ? closestBound : closestBound + 1;
|
||||
}
|
||||
return boundNeedMoving;
|
||||
}
|
||||
}, {
|
||||
key: 'getLowerBound',
|
||||
value: function getLowerBound() {
|
||||
return this.state.bounds[0];
|
||||
}
|
||||
}, {
|
||||
key: 'getUpperBound',
|
||||
value: function getUpperBound() {
|
||||
var bounds = this.state.bounds;
|
||||
|
||||
return bounds[bounds.length - 1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of possible slider points, taking into account both
|
||||
* `marks` and `step`. The result is cached.
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'getPoints',
|
||||
value: function getPoints() {
|
||||
var _props3 = this.props,
|
||||
marks = _props3.marks,
|
||||
step = _props3.step,
|
||||
min = _props3.min,
|
||||
max = _props3.max;
|
||||
|
||||
var cache = this._getPointsCache;
|
||||
if (!cache || cache.marks !== marks || cache.step !== step) {
|
||||
var pointsObject = _extends({}, marks);
|
||||
if (step !== null) {
|
||||
for (var point = min; point <= max; point += step) {
|
||||
pointsObject[point] = point;
|
||||
}
|
||||
}
|
||||
var points = Object.keys(pointsObject).map(parseFloat);
|
||||
points.sort(function (a, b) {
|
||||
return a - b;
|
||||
});
|
||||
this._getPointsCache = { marks: marks, step: step, points: points };
|
||||
}
|
||||
return this._getPointsCache.points;
|
||||
}
|
||||
}, {
|
||||
key: 'moveTo',
|
||||
value: function moveTo(value, isFromKeyboardEvent) {
|
||||
var _this3 = this;
|
||||
|
||||
var state = this.state,
|
||||
props = this.props;
|
||||
|
||||
var nextBounds = [].concat(_toConsumableArray(state.bounds));
|
||||
var handle = state.handle === null ? state.recent : state.handle;
|
||||
nextBounds[handle] = value;
|
||||
var nextHandle = handle;
|
||||
if (props.pushable !== false) {
|
||||
this.pushSurroundingHandles(nextBounds, nextHandle);
|
||||
} else if (props.allowCross) {
|
||||
nextBounds.sort(function (a, b) {
|
||||
return a - b;
|
||||
});
|
||||
nextHandle = nextBounds.indexOf(value);
|
||||
}
|
||||
this.onChange({
|
||||
recent: nextHandle,
|
||||
handle: nextHandle,
|
||||
bounds: nextBounds
|
||||
});
|
||||
if (isFromKeyboardEvent) {
|
||||
// known problem: because setState is async,
|
||||
// so trigger focus will invoke handler's onEnd and another handler's onStart too early,
|
||||
// cause onBeforeChange and onAfterChange receive wrong value.
|
||||
// here use setState callback to hack,but not elegant
|
||||
this.props.onAfterChange(nextBounds);
|
||||
this.setState({}, function () {
|
||||
_this3.handlesRefs[nextHandle].focus();
|
||||
});
|
||||
this.onEnd();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'pushSurroundingHandles',
|
||||
value: function pushSurroundingHandles(bounds, handle) {
|
||||
var value = bounds[handle];
|
||||
var threshold = this.props.pushable;
|
||||
|
||||
threshold = Number(threshold);
|
||||
|
||||
var direction = 0;
|
||||
if (bounds[handle + 1] - value < threshold) {
|
||||
direction = +1; // push to right
|
||||
}
|
||||
if (value - bounds[handle - 1] < threshold) {
|
||||
direction = -1; // push to left
|
||||
}
|
||||
|
||||
if (direction === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var nextHandle = handle + direction;
|
||||
var diffToNext = direction * (bounds[nextHandle] - value);
|
||||
if (!this.pushHandle(bounds, nextHandle, direction, threshold - diffToNext)) {
|
||||
// revert to original value if pushing is impossible
|
||||
bounds[handle] = bounds[nextHandle] - direction * threshold;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'pushHandle',
|
||||
value: function pushHandle(bounds, handle, direction, amount) {
|
||||
var originalValue = bounds[handle];
|
||||
var currentValue = bounds[handle];
|
||||
while (direction * (currentValue - originalValue) < amount) {
|
||||
if (!this.pushHandleOnePoint(bounds, handle, direction)) {
|
||||
// can't push handle enough to create the needed `amount` gap, so we
|
||||
// revert its position to the original value
|
||||
bounds[handle] = originalValue;
|
||||
return false;
|
||||
}
|
||||
currentValue = bounds[handle];
|
||||
}
|
||||
// the handle was pushed enough to create the needed `amount` gap
|
||||
return true;
|
||||
}
|
||||
}, {
|
||||
key: 'pushHandleOnePoint',
|
||||
value: function pushHandleOnePoint(bounds, handle, direction) {
|
||||
var points = this.getPoints();
|
||||
var pointIndex = points.indexOf(bounds[handle]);
|
||||
var nextPointIndex = pointIndex + direction;
|
||||
if (nextPointIndex >= points.length || nextPointIndex < 0) {
|
||||
// reached the minimum or maximum available point, can't push anymore
|
||||
return false;
|
||||
}
|
||||
var nextHandle = handle + direction;
|
||||
var nextValue = points[nextPointIndex];
|
||||
var threshold = this.props.pushable;
|
||||
|
||||
var diffToNext = direction * (bounds[nextHandle] - nextValue);
|
||||
if (!this.pushHandle(bounds, nextHandle, direction, threshold - diffToNext)) {
|
||||
// couldn't push next handle, so we won't push this one either
|
||||
return false;
|
||||
}
|
||||
// push the handle
|
||||
bounds[handle] = nextValue;
|
||||
return true;
|
||||
}
|
||||
}, {
|
||||
key: 'trimAlignValue',
|
||||
value: function trimAlignValue(value) {
|
||||
var _state2 = this.state,
|
||||
handle = _state2.handle,
|
||||
bounds = _state2.bounds;
|
||||
|
||||
return _trimAlignValue({
|
||||
value: value,
|
||||
handle: handle,
|
||||
bounds: bounds,
|
||||
props: this.props
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var _this4 = this;
|
||||
|
||||
var _state3 = this.state,
|
||||
handle = _state3.handle,
|
||||
bounds = _state3.bounds;
|
||||
var _props4 = this.props,
|
||||
prefixCls = _props4.prefixCls,
|
||||
vertical = _props4.vertical,
|
||||
included = _props4.included,
|
||||
disabled = _props4.disabled,
|
||||
min = _props4.min,
|
||||
max = _props4.max,
|
||||
reverse = _props4.reverse,
|
||||
handleGenerator = _props4.handle,
|
||||
trackStyle = _props4.trackStyle,
|
||||
handleStyle = _props4.handleStyle,
|
||||
tabIndex = _props4.tabIndex,
|
||||
ariaLabelGroupForHandles = _props4.ariaLabelGroupForHandles,
|
||||
ariaLabelledByGroupForHandles = _props4.ariaLabelledByGroupForHandles,
|
||||
ariaValueTextFormatterGroupForHandles = _props4.ariaValueTextFormatterGroupForHandles;
|
||||
|
||||
|
||||
var offsets = bounds.map(function (v) {
|
||||
return _this4.calcOffset(v);
|
||||
});
|
||||
|
||||
var handleClassName = prefixCls + '-handle';
|
||||
var handles = bounds.map(function (v, i) {
|
||||
var _classNames;
|
||||
|
||||
var _tabIndex = tabIndex[i] || 0;
|
||||
if (disabled || tabIndex[i] === null) {
|
||||
_tabIndex = null;
|
||||
}
|
||||
var dragging = handle === i;
|
||||
return handleGenerator({
|
||||
className: classNames((_classNames = {}, _defineProperty(_classNames, handleClassName, true), _defineProperty(_classNames, handleClassName + '-' + (i + 1), true), _defineProperty(_classNames, handleClassName + '-dragging', dragging), _classNames)),
|
||||
prefixCls: prefixCls,
|
||||
vertical: vertical,
|
||||
dragging: dragging,
|
||||
offset: offsets[i],
|
||||
value: v,
|
||||
index: i,
|
||||
tabIndex: _tabIndex,
|
||||
min: min,
|
||||
max: max,
|
||||
reverse: reverse,
|
||||
disabled: disabled,
|
||||
style: handleStyle[i],
|
||||
ref: function ref(h) {
|
||||
return _this4.saveHandle(i, h);
|
||||
},
|
||||
ariaLabel: ariaLabelGroupForHandles[i],
|
||||
ariaLabelledBy: ariaLabelledByGroupForHandles[i],
|
||||
ariaValueTextFormatter: ariaValueTextFormatterGroupForHandles[i]
|
||||
});
|
||||
});
|
||||
|
||||
var tracks = bounds.slice(0, -1).map(function (_, index) {
|
||||
var _classNames2;
|
||||
|
||||
var i = index + 1;
|
||||
var trackClassName = classNames((_classNames2 = {}, _defineProperty(_classNames2, prefixCls + '-track', true), _defineProperty(_classNames2, prefixCls + '-track-' + i, true), _classNames2));
|
||||
return React.createElement(Track, {
|
||||
className: trackClassName,
|
||||
vertical: vertical,
|
||||
reverse: reverse,
|
||||
included: included,
|
||||
offset: offsets[i - 1],
|
||||
length: offsets[i] - offsets[i - 1],
|
||||
style: trackStyle[index],
|
||||
key: i
|
||||
});
|
||||
});
|
||||
|
||||
return { tracks: tracks, handles: handles };
|
||||
}
|
||||
}], [{
|
||||
key: 'getDerivedStateFromProps',
|
||||
value: function getDerivedStateFromProps(props, state) {
|
||||
if ('value' in props || 'min' in props || 'max' in props) {
|
||||
var value = props.value || state.bounds;
|
||||
var nextBounds = value.map(function (v, i) {
|
||||
return _trimAlignValue({
|
||||
value: v,
|
||||
handle: i,
|
||||
bounds: state.bounds,
|
||||
props: props
|
||||
});
|
||||
});
|
||||
if (nextBounds.length === state.bounds.length && nextBounds.every(function (v, i) {
|
||||
return v === state.bounds[i];
|
||||
})) {
|
||||
return null;
|
||||
}
|
||||
return _extends({}, state, {
|
||||
bounds: nextBounds
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Range;
|
||||
}(React.Component);
|
||||
|
||||
Range.displayName = 'Range';
|
||||
Range.defaultProps = {
|
||||
count: 1,
|
||||
allowCross: true,
|
||||
pushable: false,
|
||||
tabIndex: [],
|
||||
ariaLabelGroupForHandles: [],
|
||||
ariaLabelledByGroupForHandles: [],
|
||||
ariaValueTextFormatterGroupForHandles: []
|
||||
};
|
||||
|
||||
|
||||
export default createSlider(Range);
|
||||
222
web/node_modules/rc-slider/es/Slider.js
generated
vendored
Normal file
222
web/node_modules/rc-slider/es/Slider.js
generated
vendored
Normal file
@@ -0,0 +1,222 @@
|
||||
import _extends from 'babel-runtime/helpers/extends';
|
||||
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
|
||||
import _createClass from 'babel-runtime/helpers/createClass';
|
||||
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
|
||||
import _inherits from 'babel-runtime/helpers/inherits';
|
||||
import React from 'react';
|
||||
import warning from 'warning';
|
||||
import Track from './common/Track';
|
||||
import createSlider from './common/createSlider';
|
||||
import * as utils from './utils';
|
||||
|
||||
var Slider = function (_React$Component) {
|
||||
_inherits(Slider, _React$Component);
|
||||
|
||||
function Slider(props) {
|
||||
_classCallCheck(this, Slider);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, (Slider.__proto__ || Object.getPrototypeOf(Slider)).call(this, props));
|
||||
|
||||
_this.onEnd = function (force) {
|
||||
var dragging = _this.state.dragging;
|
||||
|
||||
_this.removeDocumentEvents();
|
||||
if (dragging || force) {
|
||||
_this.props.onAfterChange(_this.getValue());
|
||||
}
|
||||
_this.setState({ dragging: false });
|
||||
};
|
||||
|
||||
var defaultValue = props.defaultValue !== undefined ? props.defaultValue : props.min;
|
||||
var value = props.value !== undefined ? props.value : defaultValue;
|
||||
|
||||
_this.state = {
|
||||
value: _this.trimAlignValue(value),
|
||||
dragging: false
|
||||
};
|
||||
|
||||
warning(!('minimumTrackStyle' in props), 'minimumTrackStyle will be deprecated, please use trackStyle instead.');
|
||||
warning(!('maximumTrackStyle' in props), 'maximumTrackStyle will be deprecated, please use railStyle instead.');
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(Slider, [{
|
||||
key: 'componentDidUpdate',
|
||||
value: function componentDidUpdate(prevProps, prevState) {
|
||||
if (!('value' in this.props || 'min' in this.props || 'max' in this.props)) {
|
||||
return;
|
||||
}
|
||||
var _props = this.props,
|
||||
value = _props.value,
|
||||
onChange = _props.onChange;
|
||||
|
||||
var theValue = value !== undefined ? value : prevState.value;
|
||||
var nextValue = this.trimAlignValue(theValue, this.props);
|
||||
if (nextValue !== prevState.value) {
|
||||
// eslint-disable-next-line
|
||||
this.setState({ value: nextValue });
|
||||
if (utils.isValueOutOfRange(theValue, this.props)) {
|
||||
onChange(nextValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'onChange',
|
||||
value: function onChange(state) {
|
||||
var props = this.props;
|
||||
var isNotControlled = !('value' in props);
|
||||
var nextState = state.value > this.props.max ? _extends({}, state, { value: this.props.max }) : state;
|
||||
if (isNotControlled) {
|
||||
this.setState(nextState);
|
||||
}
|
||||
|
||||
var changedValue = nextState.value;
|
||||
props.onChange(changedValue);
|
||||
}
|
||||
}, {
|
||||
key: 'onStart',
|
||||
value: function onStart(position) {
|
||||
this.setState({ dragging: true });
|
||||
var props = this.props;
|
||||
var prevValue = this.getValue();
|
||||
props.onBeforeChange(prevValue);
|
||||
|
||||
var value = this.calcValueByPos(position);
|
||||
this.startValue = value;
|
||||
this.startPosition = position;
|
||||
|
||||
if (value === prevValue) return;
|
||||
|
||||
this.prevMovedHandleIndex = 0;
|
||||
|
||||
this.onChange({ value: value });
|
||||
}
|
||||
}, {
|
||||
key: 'onMove',
|
||||
value: function onMove(e, position) {
|
||||
utils.pauseEvent(e);
|
||||
var oldValue = this.state.value;
|
||||
|
||||
var value = this.calcValueByPos(position);
|
||||
if (value === oldValue) return;
|
||||
|
||||
this.onChange({ value: value });
|
||||
}
|
||||
}, {
|
||||
key: 'onKeyboard',
|
||||
value: function onKeyboard(e) {
|
||||
var _props2 = this.props,
|
||||
reverse = _props2.reverse,
|
||||
vertical = _props2.vertical;
|
||||
|
||||
var valueMutator = utils.getKeyboardValueMutator(e, vertical, reverse);
|
||||
if (valueMutator) {
|
||||
utils.pauseEvent(e);
|
||||
var state = this.state;
|
||||
var oldValue = state.value;
|
||||
var mutatedValue = valueMutator(oldValue, this.props);
|
||||
var value = this.trimAlignValue(mutatedValue);
|
||||
if (value === oldValue) return;
|
||||
|
||||
this.onChange({ value: value });
|
||||
this.props.onAfterChange(value);
|
||||
this.onEnd();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'getValue',
|
||||
value: function getValue() {
|
||||
return this.state.value;
|
||||
}
|
||||
}, {
|
||||
key: 'getLowerBound',
|
||||
value: function getLowerBound() {
|
||||
return this.props.min;
|
||||
}
|
||||
}, {
|
||||
key: 'getUpperBound',
|
||||
value: function getUpperBound() {
|
||||
return this.state.value;
|
||||
}
|
||||
}, {
|
||||
key: 'trimAlignValue',
|
||||
value: function trimAlignValue(v) {
|
||||
var nextProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
|
||||
if (v === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var mergedProps = _extends({}, this.props, nextProps);
|
||||
var val = utils.ensureValueInRange(v, mergedProps);
|
||||
return utils.ensureValuePrecision(val, mergedProps);
|
||||
}
|
||||
}, {
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var _this2 = this;
|
||||
|
||||
var _props3 = this.props,
|
||||
prefixCls = _props3.prefixCls,
|
||||
vertical = _props3.vertical,
|
||||
included = _props3.included,
|
||||
disabled = _props3.disabled,
|
||||
minimumTrackStyle = _props3.minimumTrackStyle,
|
||||
trackStyle = _props3.trackStyle,
|
||||
handleStyle = _props3.handleStyle,
|
||||
tabIndex = _props3.tabIndex,
|
||||
ariaLabelForHandle = _props3.ariaLabelForHandle,
|
||||
ariaLabelledByForHandle = _props3.ariaLabelledByForHandle,
|
||||
ariaValueTextFormatterForHandle = _props3.ariaValueTextFormatterForHandle,
|
||||
min = _props3.min,
|
||||
max = _props3.max,
|
||||
startPoint = _props3.startPoint,
|
||||
reverse = _props3.reverse,
|
||||
handleGenerator = _props3.handle;
|
||||
var _state = this.state,
|
||||
value = _state.value,
|
||||
dragging = _state.dragging;
|
||||
|
||||
var offset = this.calcOffset(value);
|
||||
var handle = handleGenerator({
|
||||
className: prefixCls + '-handle',
|
||||
prefixCls: prefixCls,
|
||||
vertical: vertical,
|
||||
offset: offset,
|
||||
value: value,
|
||||
dragging: dragging,
|
||||
disabled: disabled,
|
||||
min: min,
|
||||
max: max,
|
||||
reverse: reverse,
|
||||
index: 0,
|
||||
tabIndex: tabIndex,
|
||||
ariaLabel: ariaLabelForHandle,
|
||||
ariaLabelledBy: ariaLabelledByForHandle,
|
||||
ariaValueTextFormatter: ariaValueTextFormatterForHandle,
|
||||
style: handleStyle[0] || handleStyle,
|
||||
ref: function ref(h) {
|
||||
return _this2.saveHandle(0, h);
|
||||
}
|
||||
});
|
||||
|
||||
var trackOffset = startPoint !== undefined ? this.calcOffset(startPoint) : 0;
|
||||
var _trackStyle = trackStyle[0] || trackStyle;
|
||||
var track = React.createElement(Track, {
|
||||
className: prefixCls + '-track',
|
||||
vertical: vertical,
|
||||
included: included,
|
||||
offset: trackOffset,
|
||||
reverse: reverse,
|
||||
length: offset - trackOffset,
|
||||
style: _extends({}, minimumTrackStyle, _trackStyle)
|
||||
});
|
||||
|
||||
return { tracks: track, handles: handle };
|
||||
}
|
||||
}]);
|
||||
|
||||
return Slider;
|
||||
}(React.Component);
|
||||
|
||||
export default createSlider(Slider);
|
||||
71
web/node_modules/rc-slider/es/common/Marks.js
generated
vendored
Normal file
71
web/node_modules/rc-slider/es/common/Marks.js
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
import _extends from 'babel-runtime/helpers/extends';
|
||||
import _defineProperty from 'babel-runtime/helpers/defineProperty';
|
||||
import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
|
||||
var Marks = function Marks(_ref) {
|
||||
var className = _ref.className,
|
||||
vertical = _ref.vertical,
|
||||
reverse = _ref.reverse,
|
||||
marks = _ref.marks,
|
||||
included = _ref.included,
|
||||
upperBound = _ref.upperBound,
|
||||
lowerBound = _ref.lowerBound,
|
||||
max = _ref.max,
|
||||
min = _ref.min,
|
||||
onClickLabel = _ref.onClickLabel;
|
||||
|
||||
var marksKeys = Object.keys(marks);
|
||||
|
||||
var range = max - min;
|
||||
var elements = marksKeys.map(parseFloat).sort(function (a, b) {
|
||||
return a - b;
|
||||
}).map(function (point) {
|
||||
var _classNames;
|
||||
|
||||
var markPoint = marks[point];
|
||||
var markPointIsObject = typeof markPoint === 'object' && !React.isValidElement(markPoint);
|
||||
var markLabel = markPointIsObject ? markPoint.label : markPoint;
|
||||
if (!markLabel && markLabel !== 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var isActive = !included && point === upperBound || included && point <= upperBound && point >= lowerBound;
|
||||
var markClassName = classNames((_classNames = {}, _defineProperty(_classNames, className + '-text', true), _defineProperty(_classNames, className + '-text-active', isActive), _classNames));
|
||||
|
||||
var bottomStyle = _defineProperty({
|
||||
marginBottom: '-50%'
|
||||
}, reverse ? 'top' : 'bottom', (point - min) / range * 100 + '%');
|
||||
|
||||
var leftStyle = _defineProperty({
|
||||
transform: 'translateX(' + (reverse ? '50%' : '-50%') + ')',
|
||||
msTransform: 'translateX(' + (reverse ? '50%' : '-50%') + ')'
|
||||
}, reverse ? 'right' : 'left', (point - min) / range * 100 + '%');
|
||||
|
||||
var style = vertical ? bottomStyle : leftStyle;
|
||||
var markStyle = markPointIsObject ? _extends({}, style, markPoint.style) : style;
|
||||
return React.createElement(
|
||||
'span',
|
||||
{
|
||||
className: markClassName,
|
||||
style: markStyle,
|
||||
key: point,
|
||||
onMouseDown: function onMouseDown(e) {
|
||||
return onClickLabel(e, point);
|
||||
},
|
||||
onTouchStart: function onTouchStart(e) {
|
||||
return onClickLabel(e, point);
|
||||
}
|
||||
},
|
||||
markLabel
|
||||
);
|
||||
});
|
||||
|
||||
return React.createElement(
|
||||
'div',
|
||||
{ className: className },
|
||||
elements
|
||||
);
|
||||
};
|
||||
|
||||
export default Marks;
|
||||
61
web/node_modules/rc-slider/es/common/Steps.js
generated
vendored
Normal file
61
web/node_modules/rc-slider/es/common/Steps.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
import _defineProperty from 'babel-runtime/helpers/defineProperty';
|
||||
import _extends from 'babel-runtime/helpers/extends';
|
||||
import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import warning from 'warning';
|
||||
|
||||
var calcPoints = function calcPoints(vertical, marks, dots, step, min, max) {
|
||||
warning(dots ? step > 0 : true, '`Slider[step]` should be a positive number in order to make Slider[dots] work.');
|
||||
var points = Object.keys(marks).map(parseFloat).sort(function (a, b) {
|
||||
return a - b;
|
||||
});
|
||||
if (dots && step) {
|
||||
for (var i = min; i <= max; i += step) {
|
||||
if (points.indexOf(i) === -1) {
|
||||
points.push(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
return points;
|
||||
};
|
||||
|
||||
var Steps = function Steps(_ref) {
|
||||
var prefixCls = _ref.prefixCls,
|
||||
vertical = _ref.vertical,
|
||||
reverse = _ref.reverse,
|
||||
marks = _ref.marks,
|
||||
dots = _ref.dots,
|
||||
step = _ref.step,
|
||||
included = _ref.included,
|
||||
lowerBound = _ref.lowerBound,
|
||||
upperBound = _ref.upperBound,
|
||||
max = _ref.max,
|
||||
min = _ref.min,
|
||||
dotStyle = _ref.dotStyle,
|
||||
activeDotStyle = _ref.activeDotStyle;
|
||||
|
||||
var range = max - min;
|
||||
var elements = calcPoints(vertical, marks, dots, step, min, max).map(function (point) {
|
||||
var _classNames;
|
||||
|
||||
var offset = Math.abs(point - min) / range * 100 + '%';
|
||||
|
||||
var isActived = !included && point === upperBound || included && point <= upperBound && point >= lowerBound;
|
||||
var style = vertical ? _extends({}, dotStyle, _defineProperty({}, reverse ? 'top' : 'bottom', offset)) : _extends({}, dotStyle, _defineProperty({}, reverse ? 'right' : 'left', offset));
|
||||
if (isActived) {
|
||||
style = _extends({}, style, activeDotStyle);
|
||||
}
|
||||
|
||||
var pointClassName = classNames((_classNames = {}, _defineProperty(_classNames, prefixCls + '-dot', true), _defineProperty(_classNames, prefixCls + '-dot-active', isActived), _defineProperty(_classNames, prefixCls + '-dot-reverse', reverse), _classNames));
|
||||
|
||||
return React.createElement('span', { className: pointClassName, style: style, key: point });
|
||||
});
|
||||
|
||||
return React.createElement(
|
||||
'div',
|
||||
{ className: prefixCls + '-step' },
|
||||
elements
|
||||
);
|
||||
};
|
||||
|
||||
export default Steps;
|
||||
28
web/node_modules/rc-slider/es/common/Track.js
generated
vendored
Normal file
28
web/node_modules/rc-slider/es/common/Track.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
import _extends from 'babel-runtime/helpers/extends';
|
||||
import _defineProperty from 'babel-runtime/helpers/defineProperty';
|
||||
import React from 'react';
|
||||
|
||||
var Track = function Track(props) {
|
||||
var _ref, _ref2;
|
||||
|
||||
var className = props.className,
|
||||
included = props.included,
|
||||
vertical = props.vertical,
|
||||
style = props.style;
|
||||
var length = props.length,
|
||||
offset = props.offset,
|
||||
reverse = props.reverse;
|
||||
|
||||
if (length < 0) {
|
||||
reverse = !reverse;
|
||||
length = Math.abs(length);
|
||||
offset = 100 - offset;
|
||||
}
|
||||
|
||||
var positonStyle = vertical ? (_ref = {}, _defineProperty(_ref, reverse ? 'top' : 'bottom', offset + '%'), _defineProperty(_ref, reverse ? 'bottom' : 'top', 'auto'), _defineProperty(_ref, 'height', length + '%'), _ref) : (_ref2 = {}, _defineProperty(_ref2, reverse ? 'right' : 'left', offset + '%'), _defineProperty(_ref2, reverse ? 'left' : 'right', 'auto'), _defineProperty(_ref2, 'width', length + '%'), _ref2);
|
||||
|
||||
var elStyle = _extends({}, style, positonStyle);
|
||||
return included ? React.createElement('div', { className: className, style: elStyle }) : null;
|
||||
};
|
||||
|
||||
export default Track;
|
||||
383
web/node_modules/rc-slider/es/common/createSlider.js
generated
vendored
Normal file
383
web/node_modules/rc-slider/es/common/createSlider.js
generated
vendored
Normal file
@@ -0,0 +1,383 @@
|
||||
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
|
||||
import _extends from 'babel-runtime/helpers/extends';
|
||||
import _defineProperty from 'babel-runtime/helpers/defineProperty';
|
||||
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
|
||||
import _createClass from 'babel-runtime/helpers/createClass';
|
||||
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
|
||||
import _get from 'babel-runtime/helpers/get';
|
||||
import _inherits from 'babel-runtime/helpers/inherits';
|
||||
import React from 'react';
|
||||
import addEventListener from 'rc-util/es/Dom/addEventListener';
|
||||
import classNames from 'classnames';
|
||||
import warning from 'warning';
|
||||
import Steps from './Steps';
|
||||
import Marks from './Marks';
|
||||
import Handle from '../Handle';
|
||||
import * as utils from '../utils';
|
||||
|
||||
function noop() {}
|
||||
|
||||
export default function createSlider(Component) {
|
||||
var _class, _temp;
|
||||
|
||||
return _temp = _class = function (_Component) {
|
||||
_inherits(ComponentEnhancer, _Component);
|
||||
|
||||
function ComponentEnhancer(props) {
|
||||
_classCallCheck(this, ComponentEnhancer);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, (ComponentEnhancer.__proto__ || Object.getPrototypeOf(ComponentEnhancer)).call(this, props));
|
||||
|
||||
_this.onMouseDown = function (e) {
|
||||
if (e.button !== 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var isVertical = _this.props.vertical;
|
||||
var position = utils.getMousePosition(isVertical, e);
|
||||
if (!utils.isEventFromHandle(e, _this.handlesRefs)) {
|
||||
_this.dragOffset = 0;
|
||||
} else {
|
||||
var handlePosition = utils.getHandleCenterPosition(isVertical, e.target);
|
||||
_this.dragOffset = position - handlePosition;
|
||||
position = handlePosition;
|
||||
}
|
||||
_this.removeDocumentEvents();
|
||||
_this.onStart(position);
|
||||
_this.addDocumentMouseEvents();
|
||||
};
|
||||
|
||||
_this.onTouchStart = function (e) {
|
||||
if (utils.isNotTouchEvent(e)) return;
|
||||
|
||||
var isVertical = _this.props.vertical;
|
||||
var position = utils.getTouchPosition(isVertical, e);
|
||||
if (!utils.isEventFromHandle(e, _this.handlesRefs)) {
|
||||
_this.dragOffset = 0;
|
||||
} else {
|
||||
var handlePosition = utils.getHandleCenterPosition(isVertical, e.target);
|
||||
_this.dragOffset = position - handlePosition;
|
||||
position = handlePosition;
|
||||
}
|
||||
_this.onStart(position);
|
||||
_this.addDocumentTouchEvents();
|
||||
utils.pauseEvent(e);
|
||||
};
|
||||
|
||||
_this.onFocus = function (e) {
|
||||
var _this$props = _this.props,
|
||||
onFocus = _this$props.onFocus,
|
||||
vertical = _this$props.vertical;
|
||||
|
||||
if (utils.isEventFromHandle(e, _this.handlesRefs)) {
|
||||
var handlePosition = utils.getHandleCenterPosition(vertical, e.target);
|
||||
_this.dragOffset = 0;
|
||||
_this.onStart(handlePosition);
|
||||
utils.pauseEvent(e);
|
||||
if (onFocus) {
|
||||
onFocus(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_this.onBlur = function (e) {
|
||||
var onBlur = _this.props.onBlur;
|
||||
|
||||
_this.onEnd();
|
||||
if (onBlur) {
|
||||
onBlur(e);
|
||||
}
|
||||
};
|
||||
|
||||
_this.onMouseUp = function () {
|
||||
if (_this.handlesRefs[_this.prevMovedHandleIndex]) {
|
||||
_this.handlesRefs[_this.prevMovedHandleIndex].clickFocus();
|
||||
}
|
||||
};
|
||||
|
||||
_this.onMouseMove = function (e) {
|
||||
if (!_this.sliderRef) {
|
||||
_this.onEnd();
|
||||
return;
|
||||
}
|
||||
var position = utils.getMousePosition(_this.props.vertical, e);
|
||||
_this.onMove(e, position - _this.dragOffset);
|
||||
};
|
||||
|
||||
_this.onTouchMove = function (e) {
|
||||
if (utils.isNotTouchEvent(e) || !_this.sliderRef) {
|
||||
_this.onEnd();
|
||||
return;
|
||||
}
|
||||
|
||||
var position = utils.getTouchPosition(_this.props.vertical, e);
|
||||
_this.onMove(e, position - _this.dragOffset);
|
||||
};
|
||||
|
||||
_this.onKeyDown = function (e) {
|
||||
if (_this.sliderRef && utils.isEventFromHandle(e, _this.handlesRefs)) {
|
||||
_this.onKeyboard(e);
|
||||
}
|
||||
};
|
||||
|
||||
_this.onClickMarkLabel = function (e, value) {
|
||||
e.stopPropagation();
|
||||
_this.onChange({ value: value });
|
||||
_this.setState({ value: value }, function () {
|
||||
return _this.onEnd(true);
|
||||
});
|
||||
};
|
||||
|
||||
_this.saveSlider = function (slider) {
|
||||
_this.sliderRef = slider;
|
||||
};
|
||||
|
||||
var step = props.step,
|
||||
max = props.max,
|
||||
min = props.min;
|
||||
|
||||
var isPointDiffEven = isFinite(max - min) ? (max - min) % step === 0 : true; // eslint-disable-line
|
||||
warning(step && Math.floor(step) === step ? isPointDiffEven : true, 'Slider[max] - Slider[min] (%s) should be a multiple of Slider[step] (%s)', max - min, step);
|
||||
_this.handlesRefs = {};
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(ComponentEnhancer, [{
|
||||
key: 'componentDidMount',
|
||||
value: function componentDidMount() {
|
||||
// Snapshot testing cannot handle refs, so be sure to null-check this.
|
||||
this.document = this.sliderRef && this.sliderRef.ownerDocument;
|
||||
|
||||
var _props = this.props,
|
||||
autoFocus = _props.autoFocus,
|
||||
disabled = _props.disabled;
|
||||
|
||||
if (autoFocus && !disabled) {
|
||||
this.focus();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'componentWillUnmount',
|
||||
value: function componentWillUnmount() {
|
||||
if (_get(ComponentEnhancer.prototype.__proto__ || Object.getPrototypeOf(ComponentEnhancer.prototype), 'componentWillUnmount', this)) _get(ComponentEnhancer.prototype.__proto__ || Object.getPrototypeOf(ComponentEnhancer.prototype), 'componentWillUnmount', this).call(this);
|
||||
this.removeDocumentEvents();
|
||||
}
|
||||
}, {
|
||||
key: 'getSliderStart',
|
||||
value: function getSliderStart() {
|
||||
var slider = this.sliderRef;
|
||||
var _props2 = this.props,
|
||||
vertical = _props2.vertical,
|
||||
reverse = _props2.reverse;
|
||||
|
||||
var rect = slider.getBoundingClientRect();
|
||||
if (vertical) {
|
||||
return reverse ? rect.bottom : rect.top;
|
||||
}
|
||||
return window.pageXOffset + (reverse ? rect.right : rect.left);
|
||||
}
|
||||
}, {
|
||||
key: 'getSliderLength',
|
||||
value: function getSliderLength() {
|
||||
var slider = this.sliderRef;
|
||||
if (!slider) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
var coords = slider.getBoundingClientRect();
|
||||
return this.props.vertical ? coords.height : coords.width;
|
||||
}
|
||||
}, {
|
||||
key: 'addDocumentTouchEvents',
|
||||
value: function addDocumentTouchEvents() {
|
||||
// just work for Chrome iOS Safari and Android Browser
|
||||
this.onTouchMoveListener = addEventListener(this.document, 'touchmove', this.onTouchMove);
|
||||
this.onTouchUpListener = addEventListener(this.document, 'touchend', this.onEnd);
|
||||
}
|
||||
}, {
|
||||
key: 'addDocumentMouseEvents',
|
||||
value: function addDocumentMouseEvents() {
|
||||
this.onMouseMoveListener = addEventListener(this.document, 'mousemove', this.onMouseMove);
|
||||
this.onMouseUpListener = addEventListener(this.document, 'mouseup', this.onEnd);
|
||||
}
|
||||
}, {
|
||||
key: 'removeDocumentEvents',
|
||||
value: function removeDocumentEvents() {
|
||||
/* eslint-disable no-unused-expressions */
|
||||
this.onTouchMoveListener && this.onTouchMoveListener.remove();
|
||||
this.onTouchUpListener && this.onTouchUpListener.remove();
|
||||
|
||||
this.onMouseMoveListener && this.onMouseMoveListener.remove();
|
||||
this.onMouseUpListener && this.onMouseUpListener.remove();
|
||||
/* eslint-enable no-unused-expressions */
|
||||
}
|
||||
}, {
|
||||
key: 'focus',
|
||||
value: function focus() {
|
||||
if (!this.props.disabled) {
|
||||
this.handlesRefs[0].focus();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'blur',
|
||||
value: function blur() {
|
||||
var _this2 = this;
|
||||
|
||||
if (!this.props.disabled) {
|
||||
Object.keys(this.handlesRefs).forEach(function (key) {
|
||||
if (_this2.handlesRefs[key] && _this2.handlesRefs[key].blur) {
|
||||
_this2.handlesRefs[key].blur();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'calcValue',
|
||||
value: function calcValue(offset) {
|
||||
var _props3 = this.props,
|
||||
vertical = _props3.vertical,
|
||||
min = _props3.min,
|
||||
max = _props3.max;
|
||||
|
||||
var ratio = Math.abs(Math.max(offset, 0) / this.getSliderLength());
|
||||
var value = vertical ? (1 - ratio) * (max - min) + min : ratio * (max - min) + min;
|
||||
return value;
|
||||
}
|
||||
}, {
|
||||
key: 'calcValueByPos',
|
||||
value: function calcValueByPos(position) {
|
||||
var sign = this.props.reverse ? -1 : +1;
|
||||
var pixelOffset = sign * (position - this.getSliderStart());
|
||||
var nextValue = this.trimAlignValue(this.calcValue(pixelOffset));
|
||||
return nextValue;
|
||||
}
|
||||
}, {
|
||||
key: 'calcOffset',
|
||||
value: function calcOffset(value) {
|
||||
var _props4 = this.props,
|
||||
min = _props4.min,
|
||||
max = _props4.max;
|
||||
|
||||
var ratio = (value - min) / (max - min);
|
||||
return Math.max(0, ratio * 100);
|
||||
}
|
||||
}, {
|
||||
key: 'saveHandle',
|
||||
value: function saveHandle(index, handle) {
|
||||
this.handlesRefs[index] = handle;
|
||||
}
|
||||
}, {
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var _classNames;
|
||||
|
||||
var _props5 = this.props,
|
||||
prefixCls = _props5.prefixCls,
|
||||
className = _props5.className,
|
||||
marks = _props5.marks,
|
||||
dots = _props5.dots,
|
||||
step = _props5.step,
|
||||
included = _props5.included,
|
||||
disabled = _props5.disabled,
|
||||
vertical = _props5.vertical,
|
||||
reverse = _props5.reverse,
|
||||
min = _props5.min,
|
||||
max = _props5.max,
|
||||
children = _props5.children,
|
||||
maximumTrackStyle = _props5.maximumTrackStyle,
|
||||
style = _props5.style,
|
||||
railStyle = _props5.railStyle,
|
||||
dotStyle = _props5.dotStyle,
|
||||
activeDotStyle = _props5.activeDotStyle;
|
||||
|
||||
var _get$call = _get(ComponentEnhancer.prototype.__proto__ || Object.getPrototypeOf(ComponentEnhancer.prototype), 'render', this).call(this),
|
||||
tracks = _get$call.tracks,
|
||||
handles = _get$call.handles;
|
||||
|
||||
var sliderClassName = classNames(prefixCls, (_classNames = {}, _defineProperty(_classNames, prefixCls + '-with-marks', Object.keys(marks).length), _defineProperty(_classNames, prefixCls + '-disabled', disabled), _defineProperty(_classNames, prefixCls + '-vertical', vertical), _defineProperty(_classNames, className, className), _classNames));
|
||||
return React.createElement(
|
||||
'div',
|
||||
{
|
||||
ref: this.saveSlider,
|
||||
className: sliderClassName,
|
||||
onTouchStart: disabled ? noop : this.onTouchStart,
|
||||
onMouseDown: disabled ? noop : this.onMouseDown,
|
||||
onMouseUp: disabled ? noop : this.onMouseUp,
|
||||
onKeyDown: disabled ? noop : this.onKeyDown,
|
||||
onFocus: disabled ? noop : this.onFocus,
|
||||
onBlur: disabled ? noop : this.onBlur,
|
||||
style: style
|
||||
},
|
||||
React.createElement('div', {
|
||||
className: prefixCls + '-rail',
|
||||
style: _extends({}, maximumTrackStyle, railStyle)
|
||||
}),
|
||||
tracks,
|
||||
React.createElement(Steps, {
|
||||
prefixCls: prefixCls,
|
||||
vertical: vertical,
|
||||
reverse: reverse,
|
||||
marks: marks,
|
||||
dots: dots,
|
||||
step: step,
|
||||
included: included,
|
||||
lowerBound: this.getLowerBound(),
|
||||
upperBound: this.getUpperBound(),
|
||||
max: max,
|
||||
min: min,
|
||||
dotStyle: dotStyle,
|
||||
activeDotStyle: activeDotStyle
|
||||
}),
|
||||
handles,
|
||||
React.createElement(Marks, {
|
||||
className: prefixCls + '-mark',
|
||||
onClickLabel: disabled ? noop : this.onClickMarkLabel,
|
||||
vertical: vertical,
|
||||
marks: marks,
|
||||
included: included,
|
||||
lowerBound: this.getLowerBound(),
|
||||
upperBound: this.getUpperBound(),
|
||||
max: max,
|
||||
min: min,
|
||||
reverse: reverse
|
||||
}),
|
||||
children
|
||||
);
|
||||
}
|
||||
}]);
|
||||
|
||||
return ComponentEnhancer;
|
||||
}(Component), _class.displayName = 'ComponentEnhancer(' + Component.displayName + ')', _class.defaultProps = _extends({}, Component.defaultProps, {
|
||||
prefixCls: 'rc-slider',
|
||||
className: '',
|
||||
min: 0,
|
||||
max: 100,
|
||||
step: 1,
|
||||
marks: {},
|
||||
handle: function handle(_ref) {
|
||||
var index = _ref.index,
|
||||
restProps = _objectWithoutProperties(_ref, ['index']);
|
||||
|
||||
delete restProps.dragging;
|
||||
if (restProps.value === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return React.createElement(Handle, _extends({}, restProps, { key: index }));
|
||||
},
|
||||
|
||||
onBeforeChange: noop,
|
||||
onChange: noop,
|
||||
onAfterChange: noop,
|
||||
included: true,
|
||||
disabled: false,
|
||||
dots: false,
|
||||
vertical: false,
|
||||
reverse: false,
|
||||
trackStyle: [{}],
|
||||
handleStyle: [{}],
|
||||
railStyle: {},
|
||||
dotStyle: {},
|
||||
activeDotStyle: {}
|
||||
}), _temp;
|
||||
}
|
||||
110
web/node_modules/rc-slider/es/createSliderWithTooltip.js
generated
vendored
Normal file
110
web/node_modules/rc-slider/es/createSliderWithTooltip.js
generated
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
|
||||
import _defineProperty from 'babel-runtime/helpers/defineProperty';
|
||||
import _extends from 'babel-runtime/helpers/extends';
|
||||
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
|
||||
import _createClass from 'babel-runtime/helpers/createClass';
|
||||
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
|
||||
import _inherits from 'babel-runtime/helpers/inherits';
|
||||
import React from 'react';
|
||||
import Tooltip from 'rc-tooltip';
|
||||
import Handle from './Handle';
|
||||
|
||||
export default function createSliderWithTooltip(Component) {
|
||||
var _class, _temp2;
|
||||
|
||||
return _temp2 = _class = function (_React$Component) {
|
||||
_inherits(ComponentWrapper, _React$Component);
|
||||
|
||||
function ComponentWrapper() {
|
||||
var _ref;
|
||||
|
||||
var _temp, _this, _ret;
|
||||
|
||||
_classCallCheck(this, ComponentWrapper);
|
||||
|
||||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = ComponentWrapper.__proto__ || Object.getPrototypeOf(ComponentWrapper)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
|
||||
visibles: {}
|
||||
}, _this.handleTooltipVisibleChange = function (index, visible) {
|
||||
_this.setState(function (prevState) {
|
||||
return {
|
||||
visibles: _extends({}, prevState.visibles, _defineProperty({}, index, visible))
|
||||
};
|
||||
});
|
||||
}, _this.handleWithTooltip = function (_ref2) {
|
||||
var value = _ref2.value,
|
||||
dragging = _ref2.dragging,
|
||||
index = _ref2.index,
|
||||
disabled = _ref2.disabled,
|
||||
restProps = _objectWithoutProperties(_ref2, ['value', 'dragging', 'index', 'disabled']);
|
||||
|
||||
var _this$props = _this.props,
|
||||
tipFormatter = _this$props.tipFormatter,
|
||||
tipProps = _this$props.tipProps,
|
||||
handleStyle = _this$props.handleStyle,
|
||||
getTooltipContainer = _this$props.getTooltipContainer;
|
||||
|
||||
var _tipProps$prefixCls = tipProps.prefixCls,
|
||||
prefixCls = _tipProps$prefixCls === undefined ? 'rc-slider-tooltip' : _tipProps$prefixCls,
|
||||
_tipProps$overlay = tipProps.overlay,
|
||||
overlay = _tipProps$overlay === undefined ? tipFormatter(value) : _tipProps$overlay,
|
||||
_tipProps$placement = tipProps.placement,
|
||||
placement = _tipProps$placement === undefined ? 'top' : _tipProps$placement,
|
||||
_tipProps$visible = tipProps.visible,
|
||||
visible = _tipProps$visible === undefined ? false : _tipProps$visible,
|
||||
restTooltipProps = _objectWithoutProperties(tipProps, ['prefixCls', 'overlay', 'placement', 'visible']);
|
||||
|
||||
var handleStyleWithIndex = void 0;
|
||||
if (Array.isArray(handleStyle)) {
|
||||
handleStyleWithIndex = handleStyle[index] || handleStyle[0];
|
||||
} else {
|
||||
handleStyleWithIndex = handleStyle;
|
||||
}
|
||||
|
||||
return React.createElement(
|
||||
Tooltip,
|
||||
_extends({}, restTooltipProps, {
|
||||
getTooltipContainer: getTooltipContainer,
|
||||
prefixCls: prefixCls,
|
||||
overlay: overlay,
|
||||
placement: placement,
|
||||
visible: !disabled && (_this.state.visibles[index] || dragging) || visible,
|
||||
key: index
|
||||
}),
|
||||
React.createElement(Handle, _extends({}, restProps, {
|
||||
style: _extends({}, handleStyleWithIndex),
|
||||
value: value,
|
||||
onMouseEnter: function onMouseEnter() {
|
||||
return _this.handleTooltipVisibleChange(index, true);
|
||||
},
|
||||
onMouseLeave: function onMouseLeave() {
|
||||
return _this.handleTooltipVisibleChange(index, false);
|
||||
}
|
||||
}))
|
||||
);
|
||||
}, _temp), _possibleConstructorReturn(_this, _ret);
|
||||
}
|
||||
|
||||
_createClass(ComponentWrapper, [{
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
return React.createElement(Component, _extends({}, this.props, { handle: this.handleWithTooltip }));
|
||||
}
|
||||
}]);
|
||||
|
||||
return ComponentWrapper;
|
||||
}(React.Component), _class.defaultProps = {
|
||||
tipFormatter: function tipFormatter(value) {
|
||||
return value;
|
||||
},
|
||||
|
||||
handleStyle: [{}],
|
||||
tipProps: {},
|
||||
getTooltipContainer: function getTooltipContainer(node) {
|
||||
return node.parentNode;
|
||||
}
|
||||
}, _temp2;
|
||||
}
|
||||
10
web/node_modules/rc-slider/es/index.js
generated
vendored
Normal file
10
web/node_modules/rc-slider/es/index.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import Slider from './Slider';
|
||||
import Range from './Range';
|
||||
import Handle from './Handle';
|
||||
import createSliderWithTooltip from './createSliderWithTooltip';
|
||||
|
||||
Slider.Range = Range;
|
||||
Slider.Handle = Handle;
|
||||
Slider.createSliderWithTooltip = createSliderWithTooltip;
|
||||
export default Slider;
|
||||
export { Range, Handle, createSliderWithTooltip };
|
||||
150
web/node_modules/rc-slider/es/utils.js
generated
vendored
Normal file
150
web/node_modules/rc-slider/es/utils.js
generated
vendored
Normal file
@@ -0,0 +1,150 @@
|
||||
import _toConsumableArray from 'babel-runtime/helpers/toConsumableArray';
|
||||
import { findDOMNode } from 'react-dom';
|
||||
import keyCode from 'rc-util/es/KeyCode';
|
||||
|
||||
export function isEventFromHandle(e, handles) {
|
||||
try {
|
||||
return Object.keys(handles).some(function (key) {
|
||||
return e.target === findDOMNode(handles[key]);
|
||||
});
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export function isValueOutOfRange(value, _ref) {
|
||||
var min = _ref.min,
|
||||
max = _ref.max;
|
||||
|
||||
return value < min || value > max;
|
||||
}
|
||||
|
||||
export function isNotTouchEvent(e) {
|
||||
return e.touches.length > 1 || e.type.toLowerCase() === 'touchend' && e.touches.length > 0;
|
||||
}
|
||||
|
||||
export function getClosestPoint(val, _ref2) {
|
||||
var marks = _ref2.marks,
|
||||
step = _ref2.step,
|
||||
min = _ref2.min,
|
||||
max = _ref2.max;
|
||||
|
||||
var points = Object.keys(marks).map(parseFloat);
|
||||
if (step !== null) {
|
||||
var maxSteps = Math.floor((max - min) / step);
|
||||
var steps = Math.min((val - min) / step, maxSteps);
|
||||
var closestStep = Math.round(steps) * step + min;
|
||||
points.push(closestStep);
|
||||
}
|
||||
var diffs = points.map(function (point) {
|
||||
return Math.abs(val - point);
|
||||
});
|
||||
return points[diffs.indexOf(Math.min.apply(Math, _toConsumableArray(diffs)))];
|
||||
}
|
||||
|
||||
export function getPrecision(step) {
|
||||
var stepString = step.toString();
|
||||
var precision = 0;
|
||||
if (stepString.indexOf('.') >= 0) {
|
||||
precision = stepString.length - stepString.indexOf('.') - 1;
|
||||
}
|
||||
return precision;
|
||||
}
|
||||
|
||||
export function getMousePosition(vertical, e) {
|
||||
return vertical ? e.clientY : e.pageX;
|
||||
}
|
||||
|
||||
export function getTouchPosition(vertical, e) {
|
||||
return vertical ? e.touches[0].clientY : e.touches[0].pageX;
|
||||
}
|
||||
|
||||
export function getHandleCenterPosition(vertical, handle) {
|
||||
var coords = handle.getBoundingClientRect();
|
||||
return vertical ? coords.top + coords.height * 0.5 : window.pageXOffset + coords.left + coords.width * 0.5;
|
||||
}
|
||||
|
||||
export function ensureValueInRange(val, _ref3) {
|
||||
var max = _ref3.max,
|
||||
min = _ref3.min;
|
||||
|
||||
if (val <= min) {
|
||||
return min;
|
||||
}
|
||||
if (val >= max) {
|
||||
return max;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
export function ensureValuePrecision(val, props) {
|
||||
var step = props.step;
|
||||
|
||||
var closestPoint = isFinite(getClosestPoint(val, props)) ? getClosestPoint(val, props) : 0; // eslint-disable-line
|
||||
return step === null ? closestPoint : parseFloat(closestPoint.toFixed(getPrecision(step)));
|
||||
}
|
||||
|
||||
export function pauseEvent(e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
export function calculateNextValue(func, value, props) {
|
||||
var operations = {
|
||||
increase: function increase(a, b) {
|
||||
return a + b;
|
||||
},
|
||||
decrease: function decrease(a, b) {
|
||||
return a - b;
|
||||
}
|
||||
};
|
||||
|
||||
var indexToGet = operations[func](Object.keys(props.marks).indexOf(JSON.stringify(value)), 1);
|
||||
var keyToGet = Object.keys(props.marks)[indexToGet];
|
||||
|
||||
if (props.step) {
|
||||
return operations[func](value, props.step);
|
||||
} else if (!!Object.keys(props.marks).length && !!props.marks[keyToGet]) {
|
||||
return props.marks[keyToGet];
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
export function getKeyboardValueMutator(e, vertical, reverse) {
|
||||
var increase = 'increase';
|
||||
var decrease = 'decrease';
|
||||
var method = increase;
|
||||
switch (e.keyCode) {
|
||||
case keyCode.UP:
|
||||
method = vertical && reverse ? decrease : increase;break;
|
||||
case keyCode.RIGHT:
|
||||
method = !vertical && reverse ? decrease : increase;break;
|
||||
case keyCode.DOWN:
|
||||
method = vertical && reverse ? increase : decrease;break;
|
||||
case keyCode.LEFT:
|
||||
method = !vertical && reverse ? increase : decrease;break;
|
||||
|
||||
case keyCode.END:
|
||||
return function (value, props) {
|
||||
return props.max;
|
||||
};
|
||||
case keyCode.HOME:
|
||||
return function (value, props) {
|
||||
return props.min;
|
||||
};
|
||||
case keyCode.PAGE_UP:
|
||||
return function (value, props) {
|
||||
return value + props.step * 2;
|
||||
};
|
||||
case keyCode.PAGE_DOWN:
|
||||
return function (value, props) {
|
||||
return value - props.step * 2;
|
||||
};
|
||||
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
return function (value, props) {
|
||||
return calculateNextValue(method, value, props);
|
||||
};
|
||||
}
|
||||
178
web/node_modules/rc-slider/lib/Handle.js
generated
vendored
Normal file
178
web/node_modules/rc-slider/lib/Handle.js
generated
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _extends2 = require('babel-runtime/helpers/extends');
|
||||
|
||||
var _extends3 = _interopRequireDefault(_extends2);
|
||||
|
||||
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
|
||||
|
||||
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
|
||||
|
||||
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
|
||||
|
||||
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
|
||||
|
||||
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
|
||||
|
||||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
||||
|
||||
var _createClass2 = require('babel-runtime/helpers/createClass');
|
||||
|
||||
var _createClass3 = _interopRequireDefault(_createClass2);
|
||||
|
||||
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
|
||||
|
||||
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
||||
|
||||
var _inherits2 = require('babel-runtime/helpers/inherits');
|
||||
|
||||
var _inherits3 = _interopRequireDefault(_inherits2);
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _classnames = require('classnames');
|
||||
|
||||
var _classnames2 = _interopRequireDefault(_classnames);
|
||||
|
||||
var _addEventListener = require('rc-util/lib/Dom/addEventListener');
|
||||
|
||||
var _addEventListener2 = _interopRequireDefault(_addEventListener);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
||||
|
||||
var Handle = function (_React$Component) {
|
||||
(0, _inherits3['default'])(Handle, _React$Component);
|
||||
|
||||
function Handle() {
|
||||
var _ref;
|
||||
|
||||
var _temp, _this, _ret;
|
||||
|
||||
(0, _classCallCheck3['default'])(this, Handle);
|
||||
|
||||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3['default'])(this, (_ref = Handle.__proto__ || Object.getPrototypeOf(Handle)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
|
||||
clickFocused: false
|
||||
}, _this.setHandleRef = function (node) {
|
||||
_this.handle = node;
|
||||
}, _this.handleMouseUp = function () {
|
||||
if (document.activeElement === _this.handle) {
|
||||
_this.setClickFocus(true);
|
||||
}
|
||||
}, _this.handleMouseDown = function () {
|
||||
// fix https://github.com/ant-design/ant-design/issues/15324
|
||||
_this.focus();
|
||||
}, _this.handleBlur = function () {
|
||||
_this.setClickFocus(false);
|
||||
}, _this.handleKeyDown = function () {
|
||||
_this.setClickFocus(false);
|
||||
}, _temp), (0, _possibleConstructorReturn3['default'])(_this, _ret);
|
||||
}
|
||||
|
||||
(0, _createClass3['default'])(Handle, [{
|
||||
key: 'componentDidMount',
|
||||
value: function componentDidMount() {
|
||||
// mouseup won't trigger if mouse moved out of handle,
|
||||
// so we listen on document here.
|
||||
this.onMouseUpListener = (0, _addEventListener2['default'])(document, 'mouseup', this.handleMouseUp);
|
||||
}
|
||||
}, {
|
||||
key: 'componentWillUnmount',
|
||||
value: function componentWillUnmount() {
|
||||
if (this.onMouseUpListener) {
|
||||
this.onMouseUpListener.remove();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'setClickFocus',
|
||||
value: function setClickFocus(focused) {
|
||||
this.setState({ clickFocused: focused });
|
||||
}
|
||||
}, {
|
||||
key: 'clickFocus',
|
||||
value: function clickFocus() {
|
||||
this.setClickFocus(true);
|
||||
this.focus();
|
||||
}
|
||||
}, {
|
||||
key: 'focus',
|
||||
value: function focus() {
|
||||
this.handle.focus();
|
||||
}
|
||||
}, {
|
||||
key: 'blur',
|
||||
value: function blur() {
|
||||
this.handle.blur();
|
||||
}
|
||||
}, {
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var _ref2, _ref3;
|
||||
|
||||
var _props = this.props,
|
||||
prefixCls = _props.prefixCls,
|
||||
vertical = _props.vertical,
|
||||
reverse = _props.reverse,
|
||||
offset = _props.offset,
|
||||
style = _props.style,
|
||||
disabled = _props.disabled,
|
||||
min = _props.min,
|
||||
max = _props.max,
|
||||
value = _props.value,
|
||||
tabIndex = _props.tabIndex,
|
||||
ariaLabel = _props.ariaLabel,
|
||||
ariaLabelledBy = _props.ariaLabelledBy,
|
||||
ariaValueTextFormatter = _props.ariaValueTextFormatter,
|
||||
restProps = (0, _objectWithoutProperties3['default'])(_props, ['prefixCls', 'vertical', 'reverse', 'offset', 'style', 'disabled', 'min', 'max', 'value', 'tabIndex', 'ariaLabel', 'ariaLabelledBy', 'ariaValueTextFormatter']);
|
||||
|
||||
|
||||
var className = (0, _classnames2['default'])(this.props.className, (0, _defineProperty3['default'])({}, prefixCls + '-handle-click-focused', this.state.clickFocused));
|
||||
var positionStyle = vertical ? (_ref2 = {}, (0, _defineProperty3['default'])(_ref2, reverse ? 'top' : 'bottom', offset + '%'), (0, _defineProperty3['default'])(_ref2, reverse ? 'bottom' : 'top', 'auto'), (0, _defineProperty3['default'])(_ref2, 'transform', reverse ? null : 'translateY(+50%)'), _ref2) : (_ref3 = {}, (0, _defineProperty3['default'])(_ref3, reverse ? 'right' : 'left', offset + '%'), (0, _defineProperty3['default'])(_ref3, reverse ? 'left' : 'right', 'auto'), (0, _defineProperty3['default'])(_ref3, 'transform', 'translateX(' + (reverse ? '+' : '-') + '50%)'), _ref3);
|
||||
var elStyle = (0, _extends3['default'])({}, style, positionStyle);
|
||||
|
||||
var _tabIndex = tabIndex || 0;
|
||||
if (disabled || tabIndex === null) {
|
||||
_tabIndex = null;
|
||||
}
|
||||
|
||||
var ariaValueText = void 0;
|
||||
if (ariaValueTextFormatter) {
|
||||
ariaValueText = ariaValueTextFormatter(value);
|
||||
}
|
||||
|
||||
return _react2['default'].createElement('div', (0, _extends3['default'])({
|
||||
ref: this.setHandleRef,
|
||||
tabIndex: _tabIndex
|
||||
}, restProps, {
|
||||
className: className,
|
||||
style: elStyle,
|
||||
onBlur: this.handleBlur,
|
||||
onKeyDown: this.handleKeyDown,
|
||||
onMouseDown: this.handleMouseDown
|
||||
|
||||
// aria attribute
|
||||
, role: 'slider',
|
||||
'aria-valuemin': min,
|
||||
'aria-valuemax': max,
|
||||
'aria-valuenow': value,
|
||||
'aria-disabled': !!disabled,
|
||||
'aria-label': ariaLabel,
|
||||
'aria-labelledby': ariaLabelledBy,
|
||||
'aria-valuetext': ariaValueText
|
||||
}));
|
||||
}
|
||||
}]);
|
||||
return Handle;
|
||||
}(_react2['default'].Component);
|
||||
|
||||
exports['default'] = Handle;
|
||||
module.exports = exports['default'];
|
||||
571
web/node_modules/rc-slider/lib/Range.js
generated
vendored
Normal file
571
web/node_modules/rc-slider/lib/Range.js
generated
vendored
Normal file
@@ -0,0 +1,571 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
|
||||
|
||||
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
|
||||
|
||||
var _extends2 = require('babel-runtime/helpers/extends');
|
||||
|
||||
var _extends3 = _interopRequireDefault(_extends2);
|
||||
|
||||
var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray');
|
||||
|
||||
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
|
||||
|
||||
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
|
||||
|
||||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
||||
|
||||
var _createClass2 = require('babel-runtime/helpers/createClass');
|
||||
|
||||
var _createClass3 = _interopRequireDefault(_createClass2);
|
||||
|
||||
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
|
||||
|
||||
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
||||
|
||||
var _inherits2 = require('babel-runtime/helpers/inherits');
|
||||
|
||||
var _inherits3 = _interopRequireDefault(_inherits2);
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _classnames = require('classnames');
|
||||
|
||||
var _classnames2 = _interopRequireDefault(_classnames);
|
||||
|
||||
var _shallowequal = require('shallowequal');
|
||||
|
||||
var _shallowequal2 = _interopRequireDefault(_shallowequal);
|
||||
|
||||
var _Track = require('./common/Track');
|
||||
|
||||
var _Track2 = _interopRequireDefault(_Track);
|
||||
|
||||
var _createSlider = require('./common/createSlider');
|
||||
|
||||
var _createSlider2 = _interopRequireDefault(_createSlider);
|
||||
|
||||
var _utils = require('./utils');
|
||||
|
||||
var utils = _interopRequireWildcard(_utils);
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
||||
|
||||
var _trimAlignValue = function _trimAlignValue(_ref) {
|
||||
var value = _ref.value,
|
||||
handle = _ref.handle,
|
||||
bounds = _ref.bounds,
|
||||
props = _ref.props;
|
||||
var allowCross = props.allowCross,
|
||||
pushable = props.pushable;
|
||||
|
||||
var thershold = Number(pushable);
|
||||
var valInRange = utils.ensureValueInRange(value, props);
|
||||
var valNotConflict = valInRange;
|
||||
if (!allowCross && handle != null && bounds !== undefined) {
|
||||
if (handle > 0 && valInRange <= bounds[handle - 1] + thershold) {
|
||||
valNotConflict = bounds[handle - 1] + thershold;
|
||||
}
|
||||
if (handle < bounds.length - 1 && valInRange >= bounds[handle + 1] - thershold) {
|
||||
valNotConflict = bounds[handle + 1] - thershold;
|
||||
}
|
||||
}
|
||||
return utils.ensureValuePrecision(valNotConflict, props);
|
||||
};
|
||||
|
||||
var Range = function (_React$Component) {
|
||||
(0, _inherits3['default'])(Range, _React$Component);
|
||||
|
||||
function Range(props) {
|
||||
(0, _classCallCheck3['default'])(this, Range);
|
||||
|
||||
var _this = (0, _possibleConstructorReturn3['default'])(this, (Range.__proto__ || Object.getPrototypeOf(Range)).call(this, props));
|
||||
|
||||
_this.onEnd = function (force) {
|
||||
var handle = _this.state.handle;
|
||||
|
||||
_this.removeDocumentEvents();
|
||||
|
||||
if (handle !== null || force) {
|
||||
_this.props.onAfterChange(_this.getValue());
|
||||
}
|
||||
|
||||
_this.setState({
|
||||
handle: null
|
||||
});
|
||||
};
|
||||
|
||||
var count = props.count,
|
||||
min = props.min,
|
||||
max = props.max;
|
||||
|
||||
var initialValue = Array.apply(undefined, (0, _toConsumableArray3['default'])(Array(count + 1))).map(function () {
|
||||
return min;
|
||||
});
|
||||
var defaultValue = 'defaultValue' in props ? props.defaultValue : initialValue;
|
||||
var value = props.value !== undefined ? props.value : defaultValue;
|
||||
var bounds = value.map(function (v, i) {
|
||||
return _trimAlignValue({
|
||||
value: v,
|
||||
handle: i,
|
||||
props: props
|
||||
});
|
||||
});
|
||||
var recent = bounds[0] === max ? 0 : bounds.length - 1;
|
||||
|
||||
_this.state = {
|
||||
handle: null,
|
||||
recent: recent,
|
||||
bounds: bounds
|
||||
};
|
||||
return _this;
|
||||
}
|
||||
|
||||
(0, _createClass3['default'])(Range, [{
|
||||
key: 'componentDidUpdate',
|
||||
value: function componentDidUpdate(prevProps, prevState) {
|
||||
var _this2 = this;
|
||||
|
||||
if (!('value' in this.props || 'min' in this.props || 'max' in this.props)) {
|
||||
return;
|
||||
}
|
||||
if (this.props.min === prevProps.min && this.props.max === prevProps.max && (0, _shallowequal2['default'])(this.props.value, prevProps.value)) {
|
||||
return;
|
||||
}
|
||||
var _props = this.props,
|
||||
onChange = _props.onChange,
|
||||
value = _props.value;
|
||||
|
||||
var currentValue = value || prevState.bounds;
|
||||
if (currentValue.some(function (v) {
|
||||
return utils.isValueOutOfRange(v, _this2.props);
|
||||
})) {
|
||||
var newValues = currentValue.map(function (v) {
|
||||
return utils.ensureValueInRange(v, _this2.props);
|
||||
});
|
||||
onChange(newValues);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'onChange',
|
||||
value: function onChange(state) {
|
||||
var props = this.props;
|
||||
var isNotControlled = !('value' in props);
|
||||
if (isNotControlled) {
|
||||
this.setState(state);
|
||||
} else {
|
||||
var controlledState = {};
|
||||
|
||||
['handle', 'recent'].forEach(function (item) {
|
||||
if (state[item] !== undefined) {
|
||||
controlledState[item] = state[item];
|
||||
}
|
||||
});
|
||||
|
||||
if (Object.keys(controlledState).length) {
|
||||
this.setState(controlledState);
|
||||
}
|
||||
}
|
||||
|
||||
var data = (0, _extends3['default'])({}, this.state, state);
|
||||
var changedValue = data.bounds;
|
||||
props.onChange(changedValue);
|
||||
}
|
||||
}, {
|
||||
key: 'onStart',
|
||||
value: function onStart(position) {
|
||||
var props = this.props;
|
||||
var state = this.state;
|
||||
var bounds = this.getValue();
|
||||
props.onBeforeChange(bounds);
|
||||
|
||||
var value = this.calcValueByPos(position);
|
||||
this.startValue = value;
|
||||
this.startPosition = position;
|
||||
|
||||
var closestBound = this.getClosestBound(value);
|
||||
this.prevMovedHandleIndex = this.getBoundNeedMoving(value, closestBound);
|
||||
|
||||
this.setState({
|
||||
handle: this.prevMovedHandleIndex,
|
||||
recent: this.prevMovedHandleIndex
|
||||
});
|
||||
|
||||
var prevValue = bounds[this.prevMovedHandleIndex];
|
||||
if (value === prevValue) return;
|
||||
|
||||
var nextBounds = [].concat((0, _toConsumableArray3['default'])(state.bounds));
|
||||
nextBounds[this.prevMovedHandleIndex] = value;
|
||||
this.onChange({ bounds: nextBounds });
|
||||
}
|
||||
}, {
|
||||
key: 'onMove',
|
||||
value: function onMove(e, position) {
|
||||
utils.pauseEvent(e);
|
||||
var state = this.state;
|
||||
|
||||
var value = this.calcValueByPos(position);
|
||||
var oldValue = state.bounds[state.handle];
|
||||
if (value === oldValue) return;
|
||||
|
||||
this.moveTo(value);
|
||||
}
|
||||
}, {
|
||||
key: 'onKeyboard',
|
||||
value: function onKeyboard(e) {
|
||||
var _props2 = this.props,
|
||||
reverse = _props2.reverse,
|
||||
vertical = _props2.vertical;
|
||||
|
||||
var valueMutator = utils.getKeyboardValueMutator(e, vertical, reverse);
|
||||
|
||||
if (valueMutator) {
|
||||
utils.pauseEvent(e);
|
||||
var state = this.state,
|
||||
props = this.props;
|
||||
var bounds = state.bounds,
|
||||
handle = state.handle;
|
||||
|
||||
var oldValue = bounds[handle === null ? state.recent : handle];
|
||||
var mutatedValue = valueMutator(oldValue, props);
|
||||
var value = _trimAlignValue({
|
||||
value: mutatedValue,
|
||||
handle: handle,
|
||||
bounds: state.bounds,
|
||||
props: props
|
||||
});
|
||||
if (value === oldValue) return;
|
||||
var isFromKeyboardEvent = true;
|
||||
this.moveTo(value, isFromKeyboardEvent);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'getValue',
|
||||
value: function getValue() {
|
||||
return this.state.bounds;
|
||||
}
|
||||
}, {
|
||||
key: 'getClosestBound',
|
||||
value: function getClosestBound(value) {
|
||||
var bounds = this.state.bounds;
|
||||
|
||||
var closestBound = 0;
|
||||
for (var i = 1; i < bounds.length - 1; ++i) {
|
||||
if (value >= bounds[i]) {
|
||||
closestBound = i;
|
||||
}
|
||||
}
|
||||
if (Math.abs(bounds[closestBound + 1] - value) < Math.abs(bounds[closestBound] - value)) {
|
||||
closestBound += 1;
|
||||
}
|
||||
return closestBound;
|
||||
}
|
||||
}, {
|
||||
key: 'getBoundNeedMoving',
|
||||
value: function getBoundNeedMoving(value, closestBound) {
|
||||
var _state = this.state,
|
||||
bounds = _state.bounds,
|
||||
recent = _state.recent;
|
||||
|
||||
var boundNeedMoving = closestBound;
|
||||
var isAtTheSamePoint = bounds[closestBound + 1] === bounds[closestBound];
|
||||
|
||||
if (isAtTheSamePoint && bounds[recent] === bounds[closestBound]) {
|
||||
boundNeedMoving = recent;
|
||||
}
|
||||
|
||||
if (isAtTheSamePoint && value !== bounds[closestBound + 1]) {
|
||||
boundNeedMoving = value < bounds[closestBound + 1] ? closestBound : closestBound + 1;
|
||||
}
|
||||
return boundNeedMoving;
|
||||
}
|
||||
}, {
|
||||
key: 'getLowerBound',
|
||||
value: function getLowerBound() {
|
||||
return this.state.bounds[0];
|
||||
}
|
||||
}, {
|
||||
key: 'getUpperBound',
|
||||
value: function getUpperBound() {
|
||||
var bounds = this.state.bounds;
|
||||
|
||||
return bounds[bounds.length - 1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of possible slider points, taking into account both
|
||||
* `marks` and `step`. The result is cached.
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'getPoints',
|
||||
value: function getPoints() {
|
||||
var _props3 = this.props,
|
||||
marks = _props3.marks,
|
||||
step = _props3.step,
|
||||
min = _props3.min,
|
||||
max = _props3.max;
|
||||
|
||||
var cache = this._getPointsCache;
|
||||
if (!cache || cache.marks !== marks || cache.step !== step) {
|
||||
var pointsObject = (0, _extends3['default'])({}, marks);
|
||||
if (step !== null) {
|
||||
for (var point = min; point <= max; point += step) {
|
||||
pointsObject[point] = point;
|
||||
}
|
||||
}
|
||||
var points = Object.keys(pointsObject).map(parseFloat);
|
||||
points.sort(function (a, b) {
|
||||
return a - b;
|
||||
});
|
||||
this._getPointsCache = { marks: marks, step: step, points: points };
|
||||
}
|
||||
return this._getPointsCache.points;
|
||||
}
|
||||
}, {
|
||||
key: 'moveTo',
|
||||
value: function moveTo(value, isFromKeyboardEvent) {
|
||||
var _this3 = this;
|
||||
|
||||
var state = this.state,
|
||||
props = this.props;
|
||||
|
||||
var nextBounds = [].concat((0, _toConsumableArray3['default'])(state.bounds));
|
||||
var handle = state.handle === null ? state.recent : state.handle;
|
||||
nextBounds[handle] = value;
|
||||
var nextHandle = handle;
|
||||
if (props.pushable !== false) {
|
||||
this.pushSurroundingHandles(nextBounds, nextHandle);
|
||||
} else if (props.allowCross) {
|
||||
nextBounds.sort(function (a, b) {
|
||||
return a - b;
|
||||
});
|
||||
nextHandle = nextBounds.indexOf(value);
|
||||
}
|
||||
this.onChange({
|
||||
recent: nextHandle,
|
||||
handle: nextHandle,
|
||||
bounds: nextBounds
|
||||
});
|
||||
if (isFromKeyboardEvent) {
|
||||
// known problem: because setState is async,
|
||||
// so trigger focus will invoke handler's onEnd and another handler's onStart too early,
|
||||
// cause onBeforeChange and onAfterChange receive wrong value.
|
||||
// here use setState callback to hack,but not elegant
|
||||
this.props.onAfterChange(nextBounds);
|
||||
this.setState({}, function () {
|
||||
_this3.handlesRefs[nextHandle].focus();
|
||||
});
|
||||
this.onEnd();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'pushSurroundingHandles',
|
||||
value: function pushSurroundingHandles(bounds, handle) {
|
||||
var value = bounds[handle];
|
||||
var threshold = this.props.pushable;
|
||||
|
||||
threshold = Number(threshold);
|
||||
|
||||
var direction = 0;
|
||||
if (bounds[handle + 1] - value < threshold) {
|
||||
direction = +1; // push to right
|
||||
}
|
||||
if (value - bounds[handle - 1] < threshold) {
|
||||
direction = -1; // push to left
|
||||
}
|
||||
|
||||
if (direction === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var nextHandle = handle + direction;
|
||||
var diffToNext = direction * (bounds[nextHandle] - value);
|
||||
if (!this.pushHandle(bounds, nextHandle, direction, threshold - diffToNext)) {
|
||||
// revert to original value if pushing is impossible
|
||||
bounds[handle] = bounds[nextHandle] - direction * threshold;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'pushHandle',
|
||||
value: function pushHandle(bounds, handle, direction, amount) {
|
||||
var originalValue = bounds[handle];
|
||||
var currentValue = bounds[handle];
|
||||
while (direction * (currentValue - originalValue) < amount) {
|
||||
if (!this.pushHandleOnePoint(bounds, handle, direction)) {
|
||||
// can't push handle enough to create the needed `amount` gap, so we
|
||||
// revert its position to the original value
|
||||
bounds[handle] = originalValue;
|
||||
return false;
|
||||
}
|
||||
currentValue = bounds[handle];
|
||||
}
|
||||
// the handle was pushed enough to create the needed `amount` gap
|
||||
return true;
|
||||
}
|
||||
}, {
|
||||
key: 'pushHandleOnePoint',
|
||||
value: function pushHandleOnePoint(bounds, handle, direction) {
|
||||
var points = this.getPoints();
|
||||
var pointIndex = points.indexOf(bounds[handle]);
|
||||
var nextPointIndex = pointIndex + direction;
|
||||
if (nextPointIndex >= points.length || nextPointIndex < 0) {
|
||||
// reached the minimum or maximum available point, can't push anymore
|
||||
return false;
|
||||
}
|
||||
var nextHandle = handle + direction;
|
||||
var nextValue = points[nextPointIndex];
|
||||
var threshold = this.props.pushable;
|
||||
|
||||
var diffToNext = direction * (bounds[nextHandle] - nextValue);
|
||||
if (!this.pushHandle(bounds, nextHandle, direction, threshold - diffToNext)) {
|
||||
// couldn't push next handle, so we won't push this one either
|
||||
return false;
|
||||
}
|
||||
// push the handle
|
||||
bounds[handle] = nextValue;
|
||||
return true;
|
||||
}
|
||||
}, {
|
||||
key: 'trimAlignValue',
|
||||
value: function trimAlignValue(value) {
|
||||
var _state2 = this.state,
|
||||
handle = _state2.handle,
|
||||
bounds = _state2.bounds;
|
||||
|
||||
return _trimAlignValue({
|
||||
value: value,
|
||||
handle: handle,
|
||||
bounds: bounds,
|
||||
props: this.props
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var _this4 = this;
|
||||
|
||||
var _state3 = this.state,
|
||||
handle = _state3.handle,
|
||||
bounds = _state3.bounds;
|
||||
var _props4 = this.props,
|
||||
prefixCls = _props4.prefixCls,
|
||||
vertical = _props4.vertical,
|
||||
included = _props4.included,
|
||||
disabled = _props4.disabled,
|
||||
min = _props4.min,
|
||||
max = _props4.max,
|
||||
reverse = _props4.reverse,
|
||||
handleGenerator = _props4.handle,
|
||||
trackStyle = _props4.trackStyle,
|
||||
handleStyle = _props4.handleStyle,
|
||||
tabIndex = _props4.tabIndex,
|
||||
ariaLabelGroupForHandles = _props4.ariaLabelGroupForHandles,
|
||||
ariaLabelledByGroupForHandles = _props4.ariaLabelledByGroupForHandles,
|
||||
ariaValueTextFormatterGroupForHandles = _props4.ariaValueTextFormatterGroupForHandles;
|
||||
|
||||
|
||||
var offsets = bounds.map(function (v) {
|
||||
return _this4.calcOffset(v);
|
||||
});
|
||||
|
||||
var handleClassName = prefixCls + '-handle';
|
||||
var handles = bounds.map(function (v, i) {
|
||||
var _classNames;
|
||||
|
||||
var _tabIndex = tabIndex[i] || 0;
|
||||
if (disabled || tabIndex[i] === null) {
|
||||
_tabIndex = null;
|
||||
}
|
||||
var dragging = handle === i;
|
||||
return handleGenerator({
|
||||
className: (0, _classnames2['default'])((_classNames = {}, (0, _defineProperty3['default'])(_classNames, handleClassName, true), (0, _defineProperty3['default'])(_classNames, handleClassName + '-' + (i + 1), true), (0, _defineProperty3['default'])(_classNames, handleClassName + '-dragging', dragging), _classNames)),
|
||||
prefixCls: prefixCls,
|
||||
vertical: vertical,
|
||||
dragging: dragging,
|
||||
offset: offsets[i],
|
||||
value: v,
|
||||
index: i,
|
||||
tabIndex: _tabIndex,
|
||||
min: min,
|
||||
max: max,
|
||||
reverse: reverse,
|
||||
disabled: disabled,
|
||||
style: handleStyle[i],
|
||||
ref: function ref(h) {
|
||||
return _this4.saveHandle(i, h);
|
||||
},
|
||||
ariaLabel: ariaLabelGroupForHandles[i],
|
||||
ariaLabelledBy: ariaLabelledByGroupForHandles[i],
|
||||
ariaValueTextFormatter: ariaValueTextFormatterGroupForHandles[i]
|
||||
});
|
||||
});
|
||||
|
||||
var tracks = bounds.slice(0, -1).map(function (_, index) {
|
||||
var _classNames2;
|
||||
|
||||
var i = index + 1;
|
||||
var trackClassName = (0, _classnames2['default'])((_classNames2 = {}, (0, _defineProperty3['default'])(_classNames2, prefixCls + '-track', true), (0, _defineProperty3['default'])(_classNames2, prefixCls + '-track-' + i, true), _classNames2));
|
||||
return _react2['default'].createElement(_Track2['default'], {
|
||||
className: trackClassName,
|
||||
vertical: vertical,
|
||||
reverse: reverse,
|
||||
included: included,
|
||||
offset: offsets[i - 1],
|
||||
length: offsets[i] - offsets[i - 1],
|
||||
style: trackStyle[index],
|
||||
key: i
|
||||
});
|
||||
});
|
||||
|
||||
return { tracks: tracks, handles: handles };
|
||||
}
|
||||
}], [{
|
||||
key: 'getDerivedStateFromProps',
|
||||
value: function getDerivedStateFromProps(props, state) {
|
||||
if ('value' in props || 'min' in props || 'max' in props) {
|
||||
var value = props.value || state.bounds;
|
||||
var nextBounds = value.map(function (v, i) {
|
||||
return _trimAlignValue({
|
||||
value: v,
|
||||
handle: i,
|
||||
bounds: state.bounds,
|
||||
props: props
|
||||
});
|
||||
});
|
||||
if (nextBounds.length === state.bounds.length && nextBounds.every(function (v, i) {
|
||||
return v === state.bounds[i];
|
||||
})) {
|
||||
return null;
|
||||
}
|
||||
return (0, _extends3['default'])({}, state, {
|
||||
bounds: nextBounds
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}]);
|
||||
return Range;
|
||||
}(_react2['default'].Component);
|
||||
|
||||
Range.displayName = 'Range';
|
||||
Range.defaultProps = {
|
||||
count: 1,
|
||||
allowCross: true,
|
||||
pushable: false,
|
||||
tabIndex: [],
|
||||
ariaLabelGroupForHandles: [],
|
||||
ariaLabelledByGroupForHandles: [],
|
||||
ariaValueTextFormatterGroupForHandles: []
|
||||
};
|
||||
exports['default'] = (0, _createSlider2['default'])(Range);
|
||||
module.exports = exports['default'];
|
||||
261
web/node_modules/rc-slider/lib/Slider.js
generated
vendored
Normal file
261
web/node_modules/rc-slider/lib/Slider.js
generated
vendored
Normal file
@@ -0,0 +1,261 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _extends2 = require('babel-runtime/helpers/extends');
|
||||
|
||||
var _extends3 = _interopRequireDefault(_extends2);
|
||||
|
||||
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
|
||||
|
||||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
||||
|
||||
var _createClass2 = require('babel-runtime/helpers/createClass');
|
||||
|
||||
var _createClass3 = _interopRequireDefault(_createClass2);
|
||||
|
||||
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
|
||||
|
||||
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
||||
|
||||
var _inherits2 = require('babel-runtime/helpers/inherits');
|
||||
|
||||
var _inherits3 = _interopRequireDefault(_inherits2);
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _warning = require('warning');
|
||||
|
||||
var _warning2 = _interopRequireDefault(_warning);
|
||||
|
||||
var _Track = require('./common/Track');
|
||||
|
||||
var _Track2 = _interopRequireDefault(_Track);
|
||||
|
||||
var _createSlider = require('./common/createSlider');
|
||||
|
||||
var _createSlider2 = _interopRequireDefault(_createSlider);
|
||||
|
||||
var _utils = require('./utils');
|
||||
|
||||
var utils = _interopRequireWildcard(_utils);
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
||||
|
||||
var Slider = function (_React$Component) {
|
||||
(0, _inherits3['default'])(Slider, _React$Component);
|
||||
|
||||
function Slider(props) {
|
||||
(0, _classCallCheck3['default'])(this, Slider);
|
||||
|
||||
var _this = (0, _possibleConstructorReturn3['default'])(this, (Slider.__proto__ || Object.getPrototypeOf(Slider)).call(this, props));
|
||||
|
||||
_this.onEnd = function (force) {
|
||||
var dragging = _this.state.dragging;
|
||||
|
||||
_this.removeDocumentEvents();
|
||||
if (dragging || force) {
|
||||
_this.props.onAfterChange(_this.getValue());
|
||||
}
|
||||
_this.setState({ dragging: false });
|
||||
};
|
||||
|
||||
var defaultValue = props.defaultValue !== undefined ? props.defaultValue : props.min;
|
||||
var value = props.value !== undefined ? props.value : defaultValue;
|
||||
|
||||
_this.state = {
|
||||
value: _this.trimAlignValue(value),
|
||||
dragging: false
|
||||
};
|
||||
|
||||
(0, _warning2['default'])(!('minimumTrackStyle' in props), 'minimumTrackStyle will be deprecated, please use trackStyle instead.');
|
||||
(0, _warning2['default'])(!('maximumTrackStyle' in props), 'maximumTrackStyle will be deprecated, please use railStyle instead.');
|
||||
return _this;
|
||||
}
|
||||
|
||||
(0, _createClass3['default'])(Slider, [{
|
||||
key: 'componentDidUpdate',
|
||||
value: function componentDidUpdate(prevProps, prevState) {
|
||||
if (!('value' in this.props || 'min' in this.props || 'max' in this.props)) {
|
||||
return;
|
||||
}
|
||||
var _props = this.props,
|
||||
value = _props.value,
|
||||
onChange = _props.onChange;
|
||||
|
||||
var theValue = value !== undefined ? value : prevState.value;
|
||||
var nextValue = this.trimAlignValue(theValue, this.props);
|
||||
if (nextValue !== prevState.value) {
|
||||
// eslint-disable-next-line
|
||||
this.setState({ value: nextValue });
|
||||
if (utils.isValueOutOfRange(theValue, this.props)) {
|
||||
onChange(nextValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'onChange',
|
||||
value: function onChange(state) {
|
||||
var props = this.props;
|
||||
var isNotControlled = !('value' in props);
|
||||
var nextState = state.value > this.props.max ? (0, _extends3['default'])({}, state, { value: this.props.max }) : state;
|
||||
if (isNotControlled) {
|
||||
this.setState(nextState);
|
||||
}
|
||||
|
||||
var changedValue = nextState.value;
|
||||
props.onChange(changedValue);
|
||||
}
|
||||
}, {
|
||||
key: 'onStart',
|
||||
value: function onStart(position) {
|
||||
this.setState({ dragging: true });
|
||||
var props = this.props;
|
||||
var prevValue = this.getValue();
|
||||
props.onBeforeChange(prevValue);
|
||||
|
||||
var value = this.calcValueByPos(position);
|
||||
this.startValue = value;
|
||||
this.startPosition = position;
|
||||
|
||||
if (value === prevValue) return;
|
||||
|
||||
this.prevMovedHandleIndex = 0;
|
||||
|
||||
this.onChange({ value: value });
|
||||
}
|
||||
}, {
|
||||
key: 'onMove',
|
||||
value: function onMove(e, position) {
|
||||
utils.pauseEvent(e);
|
||||
var oldValue = this.state.value;
|
||||
|
||||
var value = this.calcValueByPos(position);
|
||||
if (value === oldValue) return;
|
||||
|
||||
this.onChange({ value: value });
|
||||
}
|
||||
}, {
|
||||
key: 'onKeyboard',
|
||||
value: function onKeyboard(e) {
|
||||
var _props2 = this.props,
|
||||
reverse = _props2.reverse,
|
||||
vertical = _props2.vertical;
|
||||
|
||||
var valueMutator = utils.getKeyboardValueMutator(e, vertical, reverse);
|
||||
if (valueMutator) {
|
||||
utils.pauseEvent(e);
|
||||
var state = this.state;
|
||||
var oldValue = state.value;
|
||||
var mutatedValue = valueMutator(oldValue, this.props);
|
||||
var value = this.trimAlignValue(mutatedValue);
|
||||
if (value === oldValue) return;
|
||||
|
||||
this.onChange({ value: value });
|
||||
this.props.onAfterChange(value);
|
||||
this.onEnd();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'getValue',
|
||||
value: function getValue() {
|
||||
return this.state.value;
|
||||
}
|
||||
}, {
|
||||
key: 'getLowerBound',
|
||||
value: function getLowerBound() {
|
||||
return this.props.min;
|
||||
}
|
||||
}, {
|
||||
key: 'getUpperBound',
|
||||
value: function getUpperBound() {
|
||||
return this.state.value;
|
||||
}
|
||||
}, {
|
||||
key: 'trimAlignValue',
|
||||
value: function trimAlignValue(v) {
|
||||
var nextProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
|
||||
if (v === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var mergedProps = (0, _extends3['default'])({}, this.props, nextProps);
|
||||
var val = utils.ensureValueInRange(v, mergedProps);
|
||||
return utils.ensureValuePrecision(val, mergedProps);
|
||||
}
|
||||
}, {
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var _this2 = this;
|
||||
|
||||
var _props3 = this.props,
|
||||
prefixCls = _props3.prefixCls,
|
||||
vertical = _props3.vertical,
|
||||
included = _props3.included,
|
||||
disabled = _props3.disabled,
|
||||
minimumTrackStyle = _props3.minimumTrackStyle,
|
||||
trackStyle = _props3.trackStyle,
|
||||
handleStyle = _props3.handleStyle,
|
||||
tabIndex = _props3.tabIndex,
|
||||
ariaLabelForHandle = _props3.ariaLabelForHandle,
|
||||
ariaLabelledByForHandle = _props3.ariaLabelledByForHandle,
|
||||
ariaValueTextFormatterForHandle = _props3.ariaValueTextFormatterForHandle,
|
||||
min = _props3.min,
|
||||
max = _props3.max,
|
||||
startPoint = _props3.startPoint,
|
||||
reverse = _props3.reverse,
|
||||
handleGenerator = _props3.handle;
|
||||
var _state = this.state,
|
||||
value = _state.value,
|
||||
dragging = _state.dragging;
|
||||
|
||||
var offset = this.calcOffset(value);
|
||||
var handle = handleGenerator({
|
||||
className: prefixCls + '-handle',
|
||||
prefixCls: prefixCls,
|
||||
vertical: vertical,
|
||||
offset: offset,
|
||||
value: value,
|
||||
dragging: dragging,
|
||||
disabled: disabled,
|
||||
min: min,
|
||||
max: max,
|
||||
reverse: reverse,
|
||||
index: 0,
|
||||
tabIndex: tabIndex,
|
||||
ariaLabel: ariaLabelForHandle,
|
||||
ariaLabelledBy: ariaLabelledByForHandle,
|
||||
ariaValueTextFormatter: ariaValueTextFormatterForHandle,
|
||||
style: handleStyle[0] || handleStyle,
|
||||
ref: function ref(h) {
|
||||
return _this2.saveHandle(0, h);
|
||||
}
|
||||
});
|
||||
|
||||
var trackOffset = startPoint !== undefined ? this.calcOffset(startPoint) : 0;
|
||||
var _trackStyle = trackStyle[0] || trackStyle;
|
||||
var track = _react2['default'].createElement(_Track2['default'], {
|
||||
className: prefixCls + '-track',
|
||||
vertical: vertical,
|
||||
included: included,
|
||||
offset: trackOffset,
|
||||
reverse: reverse,
|
||||
length: offset - trackOffset,
|
||||
style: (0, _extends3['default'])({}, minimumTrackStyle, _trackStyle)
|
||||
});
|
||||
|
||||
return { tracks: track, handles: handle };
|
||||
}
|
||||
}]);
|
||||
return Slider;
|
||||
}(_react2['default'].Component);
|
||||
|
||||
exports['default'] = (0, _createSlider2['default'])(Slider);
|
||||
module.exports = exports['default'];
|
||||
91
web/node_modules/rc-slider/lib/common/Marks.js
generated
vendored
Normal file
91
web/node_modules/rc-slider/lib/common/Marks.js
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _extends2 = require('babel-runtime/helpers/extends');
|
||||
|
||||
var _extends3 = _interopRequireDefault(_extends2);
|
||||
|
||||
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
|
||||
|
||||
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _classnames = require('classnames');
|
||||
|
||||
var _classnames2 = _interopRequireDefault(_classnames);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
||||
|
||||
var Marks = function Marks(_ref) {
|
||||
var className = _ref.className,
|
||||
vertical = _ref.vertical,
|
||||
reverse = _ref.reverse,
|
||||
marks = _ref.marks,
|
||||
included = _ref.included,
|
||||
upperBound = _ref.upperBound,
|
||||
lowerBound = _ref.lowerBound,
|
||||
max = _ref.max,
|
||||
min = _ref.min,
|
||||
onClickLabel = _ref.onClickLabel;
|
||||
|
||||
var marksKeys = Object.keys(marks);
|
||||
|
||||
var range = max - min;
|
||||
var elements = marksKeys.map(parseFloat).sort(function (a, b) {
|
||||
return a - b;
|
||||
}).map(function (point) {
|
||||
var _classNames;
|
||||
|
||||
var markPoint = marks[point];
|
||||
var markPointIsObject = typeof markPoint === 'object' && !_react2['default'].isValidElement(markPoint);
|
||||
var markLabel = markPointIsObject ? markPoint.label : markPoint;
|
||||
if (!markLabel && markLabel !== 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var isActive = !included && point === upperBound || included && point <= upperBound && point >= lowerBound;
|
||||
var markClassName = (0, _classnames2['default'])((_classNames = {}, (0, _defineProperty3['default'])(_classNames, className + '-text', true), (0, _defineProperty3['default'])(_classNames, className + '-text-active', isActive), _classNames));
|
||||
|
||||
var bottomStyle = (0, _defineProperty3['default'])({
|
||||
marginBottom: '-50%'
|
||||
}, reverse ? 'top' : 'bottom', (point - min) / range * 100 + '%');
|
||||
|
||||
var leftStyle = (0, _defineProperty3['default'])({
|
||||
transform: 'translateX(' + (reverse ? '50%' : '-50%') + ')',
|
||||
msTransform: 'translateX(' + (reverse ? '50%' : '-50%') + ')'
|
||||
}, reverse ? 'right' : 'left', (point - min) / range * 100 + '%');
|
||||
|
||||
var style = vertical ? bottomStyle : leftStyle;
|
||||
var markStyle = markPointIsObject ? (0, _extends3['default'])({}, style, markPoint.style) : style;
|
||||
return _react2['default'].createElement(
|
||||
'span',
|
||||
{
|
||||
className: markClassName,
|
||||
style: markStyle,
|
||||
key: point,
|
||||
onMouseDown: function onMouseDown(e) {
|
||||
return onClickLabel(e, point);
|
||||
},
|
||||
onTouchStart: function onTouchStart(e) {
|
||||
return onClickLabel(e, point);
|
||||
}
|
||||
},
|
||||
markLabel
|
||||
);
|
||||
});
|
||||
|
||||
return _react2['default'].createElement(
|
||||
'div',
|
||||
{ className: className },
|
||||
elements
|
||||
);
|
||||
};
|
||||
|
||||
exports['default'] = Marks;
|
||||
module.exports = exports['default'];
|
||||
84
web/node_modules/rc-slider/lib/common/Steps.js
generated
vendored
Normal file
84
web/node_modules/rc-slider/lib/common/Steps.js
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
|
||||
|
||||
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
|
||||
|
||||
var _extends4 = require('babel-runtime/helpers/extends');
|
||||
|
||||
var _extends5 = _interopRequireDefault(_extends4);
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _classnames = require('classnames');
|
||||
|
||||
var _classnames2 = _interopRequireDefault(_classnames);
|
||||
|
||||
var _warning = require('warning');
|
||||
|
||||
var _warning2 = _interopRequireDefault(_warning);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
||||
|
||||
var calcPoints = function calcPoints(vertical, marks, dots, step, min, max) {
|
||||
(0, _warning2['default'])(dots ? step > 0 : true, '`Slider[step]` should be a positive number in order to make Slider[dots] work.');
|
||||
var points = Object.keys(marks).map(parseFloat).sort(function (a, b) {
|
||||
return a - b;
|
||||
});
|
||||
if (dots && step) {
|
||||
for (var i = min; i <= max; i += step) {
|
||||
if (points.indexOf(i) === -1) {
|
||||
points.push(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
return points;
|
||||
};
|
||||
|
||||
var Steps = function Steps(_ref) {
|
||||
var prefixCls = _ref.prefixCls,
|
||||
vertical = _ref.vertical,
|
||||
reverse = _ref.reverse,
|
||||
marks = _ref.marks,
|
||||
dots = _ref.dots,
|
||||
step = _ref.step,
|
||||
included = _ref.included,
|
||||
lowerBound = _ref.lowerBound,
|
||||
upperBound = _ref.upperBound,
|
||||
max = _ref.max,
|
||||
min = _ref.min,
|
||||
dotStyle = _ref.dotStyle,
|
||||
activeDotStyle = _ref.activeDotStyle;
|
||||
|
||||
var range = max - min;
|
||||
var elements = calcPoints(vertical, marks, dots, step, min, max).map(function (point) {
|
||||
var _classNames;
|
||||
|
||||
var offset = Math.abs(point - min) / range * 100 + '%';
|
||||
|
||||
var isActived = !included && point === upperBound || included && point <= upperBound && point >= lowerBound;
|
||||
var style = vertical ? (0, _extends5['default'])({}, dotStyle, (0, _defineProperty3['default'])({}, reverse ? 'top' : 'bottom', offset)) : (0, _extends5['default'])({}, dotStyle, (0, _defineProperty3['default'])({}, reverse ? 'right' : 'left', offset));
|
||||
if (isActived) {
|
||||
style = (0, _extends5['default'])({}, style, activeDotStyle);
|
||||
}
|
||||
|
||||
var pointClassName = (0, _classnames2['default'])((_classNames = {}, (0, _defineProperty3['default'])(_classNames, prefixCls + '-dot', true), (0, _defineProperty3['default'])(_classNames, prefixCls + '-dot-active', isActived), (0, _defineProperty3['default'])(_classNames, prefixCls + '-dot-reverse', reverse), _classNames));
|
||||
|
||||
return _react2['default'].createElement('span', { className: pointClassName, style: style, key: point });
|
||||
});
|
||||
|
||||
return _react2['default'].createElement(
|
||||
'div',
|
||||
{ className: prefixCls + '-step' },
|
||||
elements
|
||||
);
|
||||
};
|
||||
|
||||
exports['default'] = Steps;
|
||||
module.exports = exports['default'];
|
||||
45
web/node_modules/rc-slider/lib/common/Track.js
generated
vendored
Normal file
45
web/node_modules/rc-slider/lib/common/Track.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _extends2 = require('babel-runtime/helpers/extends');
|
||||
|
||||
var _extends3 = _interopRequireDefault(_extends2);
|
||||
|
||||
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
|
||||
|
||||
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
||||
|
||||
var Track = function Track(props) {
|
||||
var _ref, _ref2;
|
||||
|
||||
var className = props.className,
|
||||
included = props.included,
|
||||
vertical = props.vertical,
|
||||
style = props.style;
|
||||
var length = props.length,
|
||||
offset = props.offset,
|
||||
reverse = props.reverse;
|
||||
|
||||
if (length < 0) {
|
||||
reverse = !reverse;
|
||||
length = Math.abs(length);
|
||||
offset = 100 - offset;
|
||||
}
|
||||
|
||||
var positonStyle = vertical ? (_ref = {}, (0, _defineProperty3['default'])(_ref, reverse ? 'top' : 'bottom', offset + '%'), (0, _defineProperty3['default'])(_ref, reverse ? 'bottom' : 'top', 'auto'), (0, _defineProperty3['default'])(_ref, 'height', length + '%'), _ref) : (_ref2 = {}, (0, _defineProperty3['default'])(_ref2, reverse ? 'right' : 'left', offset + '%'), (0, _defineProperty3['default'])(_ref2, reverse ? 'left' : 'right', 'auto'), (0, _defineProperty3['default'])(_ref2, 'width', length + '%'), _ref2);
|
||||
|
||||
var elStyle = (0, _extends3['default'])({}, style, positonStyle);
|
||||
return included ? _react2['default'].createElement('div', { className: className, style: elStyle }) : null;
|
||||
};
|
||||
|
||||
exports['default'] = Track;
|
||||
module.exports = exports['default'];
|
||||
442
web/node_modules/rc-slider/lib/common/createSlider.js
generated
vendored
Normal file
442
web/node_modules/rc-slider/lib/common/createSlider.js
generated
vendored
Normal file
@@ -0,0 +1,442 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
|
||||
|
||||
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
|
||||
|
||||
var _extends2 = require('babel-runtime/helpers/extends');
|
||||
|
||||
var _extends3 = _interopRequireDefault(_extends2);
|
||||
|
||||
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
|
||||
|
||||
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
|
||||
|
||||
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
|
||||
|
||||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
||||
|
||||
var _createClass2 = require('babel-runtime/helpers/createClass');
|
||||
|
||||
var _createClass3 = _interopRequireDefault(_createClass2);
|
||||
|
||||
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
|
||||
|
||||
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
||||
|
||||
var _get2 = require('babel-runtime/helpers/get');
|
||||
|
||||
var _get3 = _interopRequireDefault(_get2);
|
||||
|
||||
var _inherits2 = require('babel-runtime/helpers/inherits');
|
||||
|
||||
var _inherits3 = _interopRequireDefault(_inherits2);
|
||||
|
||||
exports['default'] = createSlider;
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _addEventListener = require('rc-util/lib/Dom/addEventListener');
|
||||
|
||||
var _addEventListener2 = _interopRequireDefault(_addEventListener);
|
||||
|
||||
var _classnames = require('classnames');
|
||||
|
||||
var _classnames2 = _interopRequireDefault(_classnames);
|
||||
|
||||
var _warning = require('warning');
|
||||
|
||||
var _warning2 = _interopRequireDefault(_warning);
|
||||
|
||||
var _Steps = require('./Steps');
|
||||
|
||||
var _Steps2 = _interopRequireDefault(_Steps);
|
||||
|
||||
var _Marks = require('./Marks');
|
||||
|
||||
var _Marks2 = _interopRequireDefault(_Marks);
|
||||
|
||||
var _Handle = require('../Handle');
|
||||
|
||||
var _Handle2 = _interopRequireDefault(_Handle);
|
||||
|
||||
var _utils = require('../utils');
|
||||
|
||||
var utils = _interopRequireWildcard(_utils);
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
||||
|
||||
function noop() {}
|
||||
|
||||
function createSlider(Component) {
|
||||
var _class, _temp;
|
||||
|
||||
return _temp = _class = function (_Component) {
|
||||
(0, _inherits3['default'])(ComponentEnhancer, _Component);
|
||||
|
||||
function ComponentEnhancer(props) {
|
||||
(0, _classCallCheck3['default'])(this, ComponentEnhancer);
|
||||
|
||||
var _this = (0, _possibleConstructorReturn3['default'])(this, (ComponentEnhancer.__proto__ || Object.getPrototypeOf(ComponentEnhancer)).call(this, props));
|
||||
|
||||
_this.onMouseDown = function (e) {
|
||||
if (e.button !== 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var isVertical = _this.props.vertical;
|
||||
var position = utils.getMousePosition(isVertical, e);
|
||||
if (!utils.isEventFromHandle(e, _this.handlesRefs)) {
|
||||
_this.dragOffset = 0;
|
||||
} else {
|
||||
var handlePosition = utils.getHandleCenterPosition(isVertical, e.target);
|
||||
_this.dragOffset = position - handlePosition;
|
||||
position = handlePosition;
|
||||
}
|
||||
_this.removeDocumentEvents();
|
||||
_this.onStart(position);
|
||||
_this.addDocumentMouseEvents();
|
||||
};
|
||||
|
||||
_this.onTouchStart = function (e) {
|
||||
if (utils.isNotTouchEvent(e)) return;
|
||||
|
||||
var isVertical = _this.props.vertical;
|
||||
var position = utils.getTouchPosition(isVertical, e);
|
||||
if (!utils.isEventFromHandle(e, _this.handlesRefs)) {
|
||||
_this.dragOffset = 0;
|
||||
} else {
|
||||
var handlePosition = utils.getHandleCenterPosition(isVertical, e.target);
|
||||
_this.dragOffset = position - handlePosition;
|
||||
position = handlePosition;
|
||||
}
|
||||
_this.onStart(position);
|
||||
_this.addDocumentTouchEvents();
|
||||
utils.pauseEvent(e);
|
||||
};
|
||||
|
||||
_this.onFocus = function (e) {
|
||||
var _this$props = _this.props,
|
||||
onFocus = _this$props.onFocus,
|
||||
vertical = _this$props.vertical;
|
||||
|
||||
if (utils.isEventFromHandle(e, _this.handlesRefs)) {
|
||||
var handlePosition = utils.getHandleCenterPosition(vertical, e.target);
|
||||
_this.dragOffset = 0;
|
||||
_this.onStart(handlePosition);
|
||||
utils.pauseEvent(e);
|
||||
if (onFocus) {
|
||||
onFocus(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_this.onBlur = function (e) {
|
||||
var onBlur = _this.props.onBlur;
|
||||
|
||||
_this.onEnd();
|
||||
if (onBlur) {
|
||||
onBlur(e);
|
||||
}
|
||||
};
|
||||
|
||||
_this.onMouseUp = function () {
|
||||
if (_this.handlesRefs[_this.prevMovedHandleIndex]) {
|
||||
_this.handlesRefs[_this.prevMovedHandleIndex].clickFocus();
|
||||
}
|
||||
};
|
||||
|
||||
_this.onMouseMove = function (e) {
|
||||
if (!_this.sliderRef) {
|
||||
_this.onEnd();
|
||||
return;
|
||||
}
|
||||
var position = utils.getMousePosition(_this.props.vertical, e);
|
||||
_this.onMove(e, position - _this.dragOffset);
|
||||
};
|
||||
|
||||
_this.onTouchMove = function (e) {
|
||||
if (utils.isNotTouchEvent(e) || !_this.sliderRef) {
|
||||
_this.onEnd();
|
||||
return;
|
||||
}
|
||||
|
||||
var position = utils.getTouchPosition(_this.props.vertical, e);
|
||||
_this.onMove(e, position - _this.dragOffset);
|
||||
};
|
||||
|
||||
_this.onKeyDown = function (e) {
|
||||
if (_this.sliderRef && utils.isEventFromHandle(e, _this.handlesRefs)) {
|
||||
_this.onKeyboard(e);
|
||||
}
|
||||
};
|
||||
|
||||
_this.onClickMarkLabel = function (e, value) {
|
||||
e.stopPropagation();
|
||||
_this.onChange({ value: value });
|
||||
_this.setState({ value: value }, function () {
|
||||
return _this.onEnd(true);
|
||||
});
|
||||
};
|
||||
|
||||
_this.saveSlider = function (slider) {
|
||||
_this.sliderRef = slider;
|
||||
};
|
||||
|
||||
var step = props.step,
|
||||
max = props.max,
|
||||
min = props.min;
|
||||
|
||||
var isPointDiffEven = isFinite(max - min) ? (max - min) % step === 0 : true; // eslint-disable-line
|
||||
(0, _warning2['default'])(step && Math.floor(step) === step ? isPointDiffEven : true, 'Slider[max] - Slider[min] (%s) should be a multiple of Slider[step] (%s)', max - min, step);
|
||||
_this.handlesRefs = {};
|
||||
return _this;
|
||||
}
|
||||
|
||||
(0, _createClass3['default'])(ComponentEnhancer, [{
|
||||
key: 'componentDidMount',
|
||||
value: function componentDidMount() {
|
||||
// Snapshot testing cannot handle refs, so be sure to null-check this.
|
||||
this.document = this.sliderRef && this.sliderRef.ownerDocument;
|
||||
|
||||
var _props = this.props,
|
||||
autoFocus = _props.autoFocus,
|
||||
disabled = _props.disabled;
|
||||
|
||||
if (autoFocus && !disabled) {
|
||||
this.focus();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'componentWillUnmount',
|
||||
value: function componentWillUnmount() {
|
||||
if ((0, _get3['default'])(ComponentEnhancer.prototype.__proto__ || Object.getPrototypeOf(ComponentEnhancer.prototype), 'componentWillUnmount', this)) (0, _get3['default'])(ComponentEnhancer.prototype.__proto__ || Object.getPrototypeOf(ComponentEnhancer.prototype), 'componentWillUnmount', this).call(this);
|
||||
this.removeDocumentEvents();
|
||||
}
|
||||
}, {
|
||||
key: 'getSliderStart',
|
||||
value: function getSliderStart() {
|
||||
var slider = this.sliderRef;
|
||||
var _props2 = this.props,
|
||||
vertical = _props2.vertical,
|
||||
reverse = _props2.reverse;
|
||||
|
||||
var rect = slider.getBoundingClientRect();
|
||||
if (vertical) {
|
||||
return reverse ? rect.bottom : rect.top;
|
||||
}
|
||||
return window.pageXOffset + (reverse ? rect.right : rect.left);
|
||||
}
|
||||
}, {
|
||||
key: 'getSliderLength',
|
||||
value: function getSliderLength() {
|
||||
var slider = this.sliderRef;
|
||||
if (!slider) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
var coords = slider.getBoundingClientRect();
|
||||
return this.props.vertical ? coords.height : coords.width;
|
||||
}
|
||||
}, {
|
||||
key: 'addDocumentTouchEvents',
|
||||
value: function addDocumentTouchEvents() {
|
||||
// just work for Chrome iOS Safari and Android Browser
|
||||
this.onTouchMoveListener = (0, _addEventListener2['default'])(this.document, 'touchmove', this.onTouchMove);
|
||||
this.onTouchUpListener = (0, _addEventListener2['default'])(this.document, 'touchend', this.onEnd);
|
||||
}
|
||||
}, {
|
||||
key: 'addDocumentMouseEvents',
|
||||
value: function addDocumentMouseEvents() {
|
||||
this.onMouseMoveListener = (0, _addEventListener2['default'])(this.document, 'mousemove', this.onMouseMove);
|
||||
this.onMouseUpListener = (0, _addEventListener2['default'])(this.document, 'mouseup', this.onEnd);
|
||||
}
|
||||
}, {
|
||||
key: 'removeDocumentEvents',
|
||||
value: function removeDocumentEvents() {
|
||||
/* eslint-disable no-unused-expressions */
|
||||
this.onTouchMoveListener && this.onTouchMoveListener.remove();
|
||||
this.onTouchUpListener && this.onTouchUpListener.remove();
|
||||
|
||||
this.onMouseMoveListener && this.onMouseMoveListener.remove();
|
||||
this.onMouseUpListener && this.onMouseUpListener.remove();
|
||||
/* eslint-enable no-unused-expressions */
|
||||
}
|
||||
}, {
|
||||
key: 'focus',
|
||||
value: function focus() {
|
||||
if (!this.props.disabled) {
|
||||
this.handlesRefs[0].focus();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'blur',
|
||||
value: function blur() {
|
||||
var _this2 = this;
|
||||
|
||||
if (!this.props.disabled) {
|
||||
Object.keys(this.handlesRefs).forEach(function (key) {
|
||||
if (_this2.handlesRefs[key] && _this2.handlesRefs[key].blur) {
|
||||
_this2.handlesRefs[key].blur();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'calcValue',
|
||||
value: function calcValue(offset) {
|
||||
var _props3 = this.props,
|
||||
vertical = _props3.vertical,
|
||||
min = _props3.min,
|
||||
max = _props3.max;
|
||||
|
||||
var ratio = Math.abs(Math.max(offset, 0) / this.getSliderLength());
|
||||
var value = vertical ? (1 - ratio) * (max - min) + min : ratio * (max - min) + min;
|
||||
return value;
|
||||
}
|
||||
}, {
|
||||
key: 'calcValueByPos',
|
||||
value: function calcValueByPos(position) {
|
||||
var sign = this.props.reverse ? -1 : +1;
|
||||
var pixelOffset = sign * (position - this.getSliderStart());
|
||||
var nextValue = this.trimAlignValue(this.calcValue(pixelOffset));
|
||||
return nextValue;
|
||||
}
|
||||
}, {
|
||||
key: 'calcOffset',
|
||||
value: function calcOffset(value) {
|
||||
var _props4 = this.props,
|
||||
min = _props4.min,
|
||||
max = _props4.max;
|
||||
|
||||
var ratio = (value - min) / (max - min);
|
||||
return Math.max(0, ratio * 100);
|
||||
}
|
||||
}, {
|
||||
key: 'saveHandle',
|
||||
value: function saveHandle(index, handle) {
|
||||
this.handlesRefs[index] = handle;
|
||||
}
|
||||
}, {
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var _classNames;
|
||||
|
||||
var _props5 = this.props,
|
||||
prefixCls = _props5.prefixCls,
|
||||
className = _props5.className,
|
||||
marks = _props5.marks,
|
||||
dots = _props5.dots,
|
||||
step = _props5.step,
|
||||
included = _props5.included,
|
||||
disabled = _props5.disabled,
|
||||
vertical = _props5.vertical,
|
||||
reverse = _props5.reverse,
|
||||
min = _props5.min,
|
||||
max = _props5.max,
|
||||
children = _props5.children,
|
||||
maximumTrackStyle = _props5.maximumTrackStyle,
|
||||
style = _props5.style,
|
||||
railStyle = _props5.railStyle,
|
||||
dotStyle = _props5.dotStyle,
|
||||
activeDotStyle = _props5.activeDotStyle;
|
||||
|
||||
var _get$call = (0, _get3['default'])(ComponentEnhancer.prototype.__proto__ || Object.getPrototypeOf(ComponentEnhancer.prototype), 'render', this).call(this),
|
||||
tracks = _get$call.tracks,
|
||||
handles = _get$call.handles;
|
||||
|
||||
var sliderClassName = (0, _classnames2['default'])(prefixCls, (_classNames = {}, (0, _defineProperty3['default'])(_classNames, prefixCls + '-with-marks', Object.keys(marks).length), (0, _defineProperty3['default'])(_classNames, prefixCls + '-disabled', disabled), (0, _defineProperty3['default'])(_classNames, prefixCls + '-vertical', vertical), (0, _defineProperty3['default'])(_classNames, className, className), _classNames));
|
||||
return _react2['default'].createElement(
|
||||
'div',
|
||||
{
|
||||
ref: this.saveSlider,
|
||||
className: sliderClassName,
|
||||
onTouchStart: disabled ? noop : this.onTouchStart,
|
||||
onMouseDown: disabled ? noop : this.onMouseDown,
|
||||
onMouseUp: disabled ? noop : this.onMouseUp,
|
||||
onKeyDown: disabled ? noop : this.onKeyDown,
|
||||
onFocus: disabled ? noop : this.onFocus,
|
||||
onBlur: disabled ? noop : this.onBlur,
|
||||
style: style
|
||||
},
|
||||
_react2['default'].createElement('div', {
|
||||
className: prefixCls + '-rail',
|
||||
style: (0, _extends3['default'])({}, maximumTrackStyle, railStyle)
|
||||
}),
|
||||
tracks,
|
||||
_react2['default'].createElement(_Steps2['default'], {
|
||||
prefixCls: prefixCls,
|
||||
vertical: vertical,
|
||||
reverse: reverse,
|
||||
marks: marks,
|
||||
dots: dots,
|
||||
step: step,
|
||||
included: included,
|
||||
lowerBound: this.getLowerBound(),
|
||||
upperBound: this.getUpperBound(),
|
||||
max: max,
|
||||
min: min,
|
||||
dotStyle: dotStyle,
|
||||
activeDotStyle: activeDotStyle
|
||||
}),
|
||||
handles,
|
||||
_react2['default'].createElement(_Marks2['default'], {
|
||||
className: prefixCls + '-mark',
|
||||
onClickLabel: disabled ? noop : this.onClickMarkLabel,
|
||||
vertical: vertical,
|
||||
marks: marks,
|
||||
included: included,
|
||||
lowerBound: this.getLowerBound(),
|
||||
upperBound: this.getUpperBound(),
|
||||
max: max,
|
||||
min: min,
|
||||
reverse: reverse
|
||||
}),
|
||||
children
|
||||
);
|
||||
}
|
||||
}]);
|
||||
return ComponentEnhancer;
|
||||
}(Component), _class.displayName = 'ComponentEnhancer(' + Component.displayName + ')', _class.defaultProps = (0, _extends3['default'])({}, Component.defaultProps, {
|
||||
prefixCls: 'rc-slider',
|
||||
className: '',
|
||||
min: 0,
|
||||
max: 100,
|
||||
step: 1,
|
||||
marks: {},
|
||||
handle: function handle(_ref) {
|
||||
var index = _ref.index,
|
||||
restProps = (0, _objectWithoutProperties3['default'])(_ref, ['index']);
|
||||
|
||||
delete restProps.dragging;
|
||||
if (restProps.value === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return _react2['default'].createElement(_Handle2['default'], (0, _extends3['default'])({}, restProps, { key: index }));
|
||||
},
|
||||
|
||||
onBeforeChange: noop,
|
||||
onChange: noop,
|
||||
onAfterChange: noop,
|
||||
included: true,
|
||||
disabled: false,
|
||||
dots: false,
|
||||
vertical: false,
|
||||
reverse: false,
|
||||
trackStyle: [{}],
|
||||
handleStyle: [{}],
|
||||
railStyle: {},
|
||||
dotStyle: {},
|
||||
activeDotStyle: {}
|
||||
}), _temp;
|
||||
}
|
||||
module.exports = exports['default'];
|
||||
148
web/node_modules/rc-slider/lib/createSliderWithTooltip.js
generated
vendored
Normal file
148
web/node_modules/rc-slider/lib/createSliderWithTooltip.js
generated
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
|
||||
|
||||
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
|
||||
|
||||
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
|
||||
|
||||
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
|
||||
|
||||
var _extends3 = require('babel-runtime/helpers/extends');
|
||||
|
||||
var _extends4 = _interopRequireDefault(_extends3);
|
||||
|
||||
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
|
||||
|
||||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
||||
|
||||
var _createClass2 = require('babel-runtime/helpers/createClass');
|
||||
|
||||
var _createClass3 = _interopRequireDefault(_createClass2);
|
||||
|
||||
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
|
||||
|
||||
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
||||
|
||||
var _inherits2 = require('babel-runtime/helpers/inherits');
|
||||
|
||||
var _inherits3 = _interopRequireDefault(_inherits2);
|
||||
|
||||
exports['default'] = createSliderWithTooltip;
|
||||
|
||||
var _react = require('react');
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _rcTooltip = require('rc-tooltip');
|
||||
|
||||
var _rcTooltip2 = _interopRequireDefault(_rcTooltip);
|
||||
|
||||
var _Handle = require('./Handle');
|
||||
|
||||
var _Handle2 = _interopRequireDefault(_Handle);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
||||
|
||||
function createSliderWithTooltip(Component) {
|
||||
var _class, _temp2;
|
||||
|
||||
return _temp2 = _class = function (_React$Component) {
|
||||
(0, _inherits3['default'])(ComponentWrapper, _React$Component);
|
||||
|
||||
function ComponentWrapper() {
|
||||
var _ref;
|
||||
|
||||
var _temp, _this, _ret;
|
||||
|
||||
(0, _classCallCheck3['default'])(this, ComponentWrapper);
|
||||
|
||||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3['default'])(this, (_ref = ComponentWrapper.__proto__ || Object.getPrototypeOf(ComponentWrapper)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
|
||||
visibles: {}
|
||||
}, _this.handleTooltipVisibleChange = function (index, visible) {
|
||||
_this.setState(function (prevState) {
|
||||
return {
|
||||
visibles: (0, _extends4['default'])({}, prevState.visibles, (0, _defineProperty3['default'])({}, index, visible))
|
||||
};
|
||||
});
|
||||
}, _this.handleWithTooltip = function (_ref2) {
|
||||
var value = _ref2.value,
|
||||
dragging = _ref2.dragging,
|
||||
index = _ref2.index,
|
||||
disabled = _ref2.disabled,
|
||||
restProps = (0, _objectWithoutProperties3['default'])(_ref2, ['value', 'dragging', 'index', 'disabled']);
|
||||
var _this$props = _this.props,
|
||||
tipFormatter = _this$props.tipFormatter,
|
||||
tipProps = _this$props.tipProps,
|
||||
handleStyle = _this$props.handleStyle,
|
||||
getTooltipContainer = _this$props.getTooltipContainer;
|
||||
var _tipProps$prefixCls = tipProps.prefixCls,
|
||||
prefixCls = _tipProps$prefixCls === undefined ? 'rc-slider-tooltip' : _tipProps$prefixCls,
|
||||
_tipProps$overlay = tipProps.overlay,
|
||||
overlay = _tipProps$overlay === undefined ? tipFormatter(value) : _tipProps$overlay,
|
||||
_tipProps$placement = tipProps.placement,
|
||||
placement = _tipProps$placement === undefined ? 'top' : _tipProps$placement,
|
||||
_tipProps$visible = tipProps.visible,
|
||||
visible = _tipProps$visible === undefined ? false : _tipProps$visible,
|
||||
restTooltipProps = (0, _objectWithoutProperties3['default'])(tipProps, ['prefixCls', 'overlay', 'placement', 'visible']);
|
||||
|
||||
|
||||
var handleStyleWithIndex = void 0;
|
||||
if (Array.isArray(handleStyle)) {
|
||||
handleStyleWithIndex = handleStyle[index] || handleStyle[0];
|
||||
} else {
|
||||
handleStyleWithIndex = handleStyle;
|
||||
}
|
||||
|
||||
return _react2['default'].createElement(
|
||||
_rcTooltip2['default'],
|
||||
(0, _extends4['default'])({}, restTooltipProps, {
|
||||
getTooltipContainer: getTooltipContainer,
|
||||
prefixCls: prefixCls,
|
||||
overlay: overlay,
|
||||
placement: placement,
|
||||
visible: !disabled && (_this.state.visibles[index] || dragging) || visible,
|
||||
key: index
|
||||
}),
|
||||
_react2['default'].createElement(_Handle2['default'], (0, _extends4['default'])({}, restProps, {
|
||||
style: (0, _extends4['default'])({}, handleStyleWithIndex),
|
||||
value: value,
|
||||
onMouseEnter: function onMouseEnter() {
|
||||
return _this.handleTooltipVisibleChange(index, true);
|
||||
},
|
||||
onMouseLeave: function onMouseLeave() {
|
||||
return _this.handleTooltipVisibleChange(index, false);
|
||||
}
|
||||
}))
|
||||
);
|
||||
}, _temp), (0, _possibleConstructorReturn3['default'])(_this, _ret);
|
||||
}
|
||||
|
||||
(0, _createClass3['default'])(ComponentWrapper, [{
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
return _react2['default'].createElement(Component, (0, _extends4['default'])({}, this.props, { handle: this.handleWithTooltip }));
|
||||
}
|
||||
}]);
|
||||
return ComponentWrapper;
|
||||
}(_react2['default'].Component), _class.defaultProps = {
|
||||
tipFormatter: function tipFormatter(value) {
|
||||
return value;
|
||||
},
|
||||
|
||||
handleStyle: [{}],
|
||||
tipProps: {},
|
||||
getTooltipContainer: function getTooltipContainer(node) {
|
||||
return node.parentNode;
|
||||
}
|
||||
}, _temp2;
|
||||
}
|
||||
module.exports = exports['default'];
|
||||
32
web/node_modules/rc-slider/lib/index.js
generated
vendored
Normal file
32
web/node_modules/rc-slider/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.createSliderWithTooltip = exports.Handle = exports.Range = undefined;
|
||||
|
||||
var _Slider = require('./Slider');
|
||||
|
||||
var _Slider2 = _interopRequireDefault(_Slider);
|
||||
|
||||
var _Range = require('./Range');
|
||||
|
||||
var _Range2 = _interopRequireDefault(_Range);
|
||||
|
||||
var _Handle = require('./Handle');
|
||||
|
||||
var _Handle2 = _interopRequireDefault(_Handle);
|
||||
|
||||
var _createSliderWithTooltip = require('./createSliderWithTooltip');
|
||||
|
||||
var _createSliderWithTooltip2 = _interopRequireDefault(_createSliderWithTooltip);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
||||
|
||||
_Slider2['default'].Range = _Range2['default'];
|
||||
_Slider2['default'].Handle = _Handle2['default'];
|
||||
_Slider2['default'].createSliderWithTooltip = _createSliderWithTooltip2['default'];
|
||||
exports['default'] = _Slider2['default'];
|
||||
exports.Range = _Range2['default'];
|
||||
exports.Handle = _Handle2['default'];
|
||||
exports.createSliderWithTooltip = _createSliderWithTooltip2['default'];
|
||||
178
web/node_modules/rc-slider/lib/utils.js
generated
vendored
Normal file
178
web/node_modules/rc-slider/lib/utils.js
generated
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray');
|
||||
|
||||
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
|
||||
|
||||
exports.isEventFromHandle = isEventFromHandle;
|
||||
exports.isValueOutOfRange = isValueOutOfRange;
|
||||
exports.isNotTouchEvent = isNotTouchEvent;
|
||||
exports.getClosestPoint = getClosestPoint;
|
||||
exports.getPrecision = getPrecision;
|
||||
exports.getMousePosition = getMousePosition;
|
||||
exports.getTouchPosition = getTouchPosition;
|
||||
exports.getHandleCenterPosition = getHandleCenterPosition;
|
||||
exports.ensureValueInRange = ensureValueInRange;
|
||||
exports.ensureValuePrecision = ensureValuePrecision;
|
||||
exports.pauseEvent = pauseEvent;
|
||||
exports.calculateNextValue = calculateNextValue;
|
||||
exports.getKeyboardValueMutator = getKeyboardValueMutator;
|
||||
|
||||
var _reactDom = require('react-dom');
|
||||
|
||||
var _KeyCode = require('rc-util/lib/KeyCode');
|
||||
|
||||
var _KeyCode2 = _interopRequireDefault(_KeyCode);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
||||
|
||||
function isEventFromHandle(e, handles) {
|
||||
try {
|
||||
return Object.keys(handles).some(function (key) {
|
||||
return e.target === (0, _reactDom.findDOMNode)(handles[key]);
|
||||
});
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function isValueOutOfRange(value, _ref) {
|
||||
var min = _ref.min,
|
||||
max = _ref.max;
|
||||
|
||||
return value < min || value > max;
|
||||
}
|
||||
|
||||
function isNotTouchEvent(e) {
|
||||
return e.touches.length > 1 || e.type.toLowerCase() === 'touchend' && e.touches.length > 0;
|
||||
}
|
||||
|
||||
function getClosestPoint(val, _ref2) {
|
||||
var marks = _ref2.marks,
|
||||
step = _ref2.step,
|
||||
min = _ref2.min,
|
||||
max = _ref2.max;
|
||||
|
||||
var points = Object.keys(marks).map(parseFloat);
|
||||
if (step !== null) {
|
||||
var maxSteps = Math.floor((max - min) / step);
|
||||
var steps = Math.min((val - min) / step, maxSteps);
|
||||
var closestStep = Math.round(steps) * step + min;
|
||||
points.push(closestStep);
|
||||
}
|
||||
var diffs = points.map(function (point) {
|
||||
return Math.abs(val - point);
|
||||
});
|
||||
return points[diffs.indexOf(Math.min.apply(Math, (0, _toConsumableArray3['default'])(diffs)))];
|
||||
}
|
||||
|
||||
function getPrecision(step) {
|
||||
var stepString = step.toString();
|
||||
var precision = 0;
|
||||
if (stepString.indexOf('.') >= 0) {
|
||||
precision = stepString.length - stepString.indexOf('.') - 1;
|
||||
}
|
||||
return precision;
|
||||
}
|
||||
|
||||
function getMousePosition(vertical, e) {
|
||||
return vertical ? e.clientY : e.pageX;
|
||||
}
|
||||
|
||||
function getTouchPosition(vertical, e) {
|
||||
return vertical ? e.touches[0].clientY : e.touches[0].pageX;
|
||||
}
|
||||
|
||||
function getHandleCenterPosition(vertical, handle) {
|
||||
var coords = handle.getBoundingClientRect();
|
||||
return vertical ? coords.top + coords.height * 0.5 : window.pageXOffset + coords.left + coords.width * 0.5;
|
||||
}
|
||||
|
||||
function ensureValueInRange(val, _ref3) {
|
||||
var max = _ref3.max,
|
||||
min = _ref3.min;
|
||||
|
||||
if (val <= min) {
|
||||
return min;
|
||||
}
|
||||
if (val >= max) {
|
||||
return max;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
function ensureValuePrecision(val, props) {
|
||||
var step = props.step;
|
||||
|
||||
var closestPoint = isFinite(getClosestPoint(val, props)) ? getClosestPoint(val, props) : 0; // eslint-disable-line
|
||||
return step === null ? closestPoint : parseFloat(closestPoint.toFixed(getPrecision(step)));
|
||||
}
|
||||
|
||||
function pauseEvent(e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
function calculateNextValue(func, value, props) {
|
||||
var operations = {
|
||||
increase: function increase(a, b) {
|
||||
return a + b;
|
||||
},
|
||||
decrease: function decrease(a, b) {
|
||||
return a - b;
|
||||
}
|
||||
};
|
||||
|
||||
var indexToGet = operations[func](Object.keys(props.marks).indexOf(JSON.stringify(value)), 1);
|
||||
var keyToGet = Object.keys(props.marks)[indexToGet];
|
||||
|
||||
if (props.step) {
|
||||
return operations[func](value, props.step);
|
||||
} else if (!!Object.keys(props.marks).length && !!props.marks[keyToGet]) {
|
||||
return props.marks[keyToGet];
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
function getKeyboardValueMutator(e, vertical, reverse) {
|
||||
var increase = 'increase';
|
||||
var decrease = 'decrease';
|
||||
var method = increase;
|
||||
switch (e.keyCode) {
|
||||
case _KeyCode2['default'].UP:
|
||||
method = vertical && reverse ? decrease : increase;break;
|
||||
case _KeyCode2['default'].RIGHT:
|
||||
method = !vertical && reverse ? decrease : increase;break;
|
||||
case _KeyCode2['default'].DOWN:
|
||||
method = vertical && reverse ? increase : decrease;break;
|
||||
case _KeyCode2['default'].LEFT:
|
||||
method = !vertical && reverse ? increase : decrease;break;
|
||||
|
||||
case _KeyCode2['default'].END:
|
||||
return function (value, props) {
|
||||
return props.max;
|
||||
};
|
||||
case _KeyCode2['default'].HOME:
|
||||
return function (value, props) {
|
||||
return props.min;
|
||||
};
|
||||
case _KeyCode2['default'].PAGE_UP:
|
||||
return function (value, props) {
|
||||
return value + props.step * 2;
|
||||
};
|
||||
case _KeyCode2['default'].PAGE_DOWN:
|
||||
return function (value, props) {
|
||||
return value - props.step * 2;
|
||||
};
|
||||
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
return function (value, props) {
|
||||
return calculateNextValue(method, value, props);
|
||||
};
|
||||
}
|
||||
114
web/node_modules/rc-slider/package.json
generated
vendored
Normal file
114
web/node_modules/rc-slider/package.json
generated
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
{
|
||||
"_from": "rc-slider@~9.2.3",
|
||||
"_id": "rc-slider@9.2.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-wSr7vz+WtzzGqsGU2rTQ4mmLz9fkuIDMPYMYm8ygYFvxQ2Rh4uRhOWHYI0R8krNK5k1bGycckYxmQqUIvLAh3w==",
|
||||
"_location": "/rc-slider",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "rc-slider@~9.2.3",
|
||||
"name": "rc-slider",
|
||||
"escapedName": "rc-slider",
|
||||
"rawSpec": "~9.2.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~9.2.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/antd"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/rc-slider/-/rc-slider-9.2.4.tgz",
|
||||
"_shasum": "92e2b58c53def9921ae0fc2822727ab5785b9ed0",
|
||||
"_spec": "rc-slider@~9.2.3",
|
||||
"_where": "/Users/thilina/TestProjects/icehrm-pro/web/node_modules/antd",
|
||||
"bugs": {
|
||||
"url": "http://github.com/react-component/slider/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"config": {
|
||||
"port": 8005,
|
||||
"entry": {
|
||||
"rc-slider": [
|
||||
"./assets/index.less",
|
||||
"./src/index.js"
|
||||
]
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"babel-runtime": "6.x",
|
||||
"classnames": "^2.2.5",
|
||||
"rc-tooltip": "^4.0.0",
|
||||
"rc-util": "^4.0.4",
|
||||
"shallowequal": "^1.1.0",
|
||||
"warning": "^4.0.3"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Slider UI component for React",
|
||||
"devDependencies": {
|
||||
"enzyme": "^3.0.0",
|
||||
"enzyme-adapter-react-16": "^1.0.1",
|
||||
"enzyme-to-json": "^3.0.0",
|
||||
"jest": "^23.0.0",
|
||||
"pre-commit": "1.x",
|
||||
"rc-tools": "8.x",
|
||||
"rc-trigger": "^4.0.2",
|
||||
"react": "^16.0.0",
|
||||
"react-dom": "^16.0.0",
|
||||
"react-test-renderer": "^16.0.0"
|
||||
},
|
||||
"files": [
|
||||
"assets/*.css",
|
||||
"lib",
|
||||
"es",
|
||||
"dist"
|
||||
],
|
||||
"homepage": "http://github.com/react-component/slider/",
|
||||
"jest": {
|
||||
"setupFiles": [
|
||||
"./tests/setup.js"
|
||||
],
|
||||
"snapshotSerializers": [
|
||||
"enzyme-to-json/serializer"
|
||||
],
|
||||
"collectCoverageFrom": [
|
||||
"src/**/*.{js,jsx}"
|
||||
],
|
||||
"transform": {
|
||||
"\\.tsx?$": "./node_modules/rc-tools/scripts/jestPreprocessor.js",
|
||||
"\\.jsx?$": "./node_modules/rc-tools/scripts/jestPreprocessor.js"
|
||||
}
|
||||
},
|
||||
"keywords": [
|
||||
"react",
|
||||
"react-component",
|
||||
"react-slider",
|
||||
"slider",
|
||||
"input",
|
||||
"range"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./lib/index.js",
|
||||
"module": "./es/index",
|
||||
"name": "rc-slider",
|
||||
"pre-commit": [
|
||||
"lint"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/react-component/slider.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rc-tools run build",
|
||||
"compile": "rc-tools run compile --babel-runtime",
|
||||
"coverage": "jest --coverage",
|
||||
"dist": "rc-tools run dist",
|
||||
"gh-pages": "rc-tools run gh-pages",
|
||||
"lint": "rc-tools run lint",
|
||||
"pub": "rc-tools run pub --babel-runtime",
|
||||
"start": "rc-tools run server",
|
||||
"test": "jest"
|
||||
},
|
||||
"style": "./assets/index.css",
|
||||
"version": "9.2.4"
|
||||
}
|
||||
Reference in New Issue
Block a user