mirror of
https://github.com/wassname/slider.git
synced 2026-09-10 12:38:09 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c021cadcbb | ||
|
|
4a59745a23 | ||
|
|
3e78e9ac4a | ||
|
|
82179e613a | ||
|
|
0a6fb5a570 | ||
|
|
53aa61faf2 | ||
|
|
9655483bf5 | ||
|
|
faa4f384a3 | ||
|
|
18ddbb796c | ||
|
|
051fef6603 |
+20
-8
@@ -23,13 +23,19 @@
|
||||
|
||||
.@{prefixClass} {
|
||||
position: relative;
|
||||
height: 4px;
|
||||
height: 14px;
|
||||
padding: 5px 0;
|
||||
width: 100%;
|
||||
border-radius: @border-radius-base;
|
||||
background-color: #e9e9e9;
|
||||
|
||||
.borderBox();
|
||||
|
||||
&-rail {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
background-color: #e9e9e9;
|
||||
height: 4px;
|
||||
}
|
||||
|
||||
&-track {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
@@ -62,7 +68,7 @@
|
||||
|
||||
&-mark {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
top: 18px;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
font-size: 12px;
|
||||
@@ -85,7 +91,6 @@
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 4px;
|
||||
margin: 5px 0;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
@@ -131,23 +136,30 @@
|
||||
}
|
||||
|
||||
.@{prefixClass}-vertical {
|
||||
width: 4px;
|
||||
width: 14px;
|
||||
height: 100%;
|
||||
padding: 0 5px;
|
||||
|
||||
.@{prefixClass} {
|
||||
&-rail {
|
||||
height: 100%;
|
||||
width: 4px;
|
||||
}
|
||||
|
||||
&-track {
|
||||
left: 5px;
|
||||
bottom: 0;
|
||||
width: 4px;
|
||||
}
|
||||
|
||||
&-handle {
|
||||
position: absolute;
|
||||
margin-left: -5px;
|
||||
margin-bottom: -7px;
|
||||
}
|
||||
|
||||
&-mark {
|
||||
top: 0;
|
||||
left: 10px;
|
||||
left: 18px;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
|
||||
+13
-10
@@ -18,16 +18,19 @@ const handleStyle = {
|
||||
textAlign: 'center',
|
||||
};
|
||||
|
||||
const CustomHandle = props => {
|
||||
const style = Object.assign({ left: `${props.offset}%` }, handleStyle);
|
||||
return (
|
||||
<div style={style}>val: {props.value}</div>
|
||||
);
|
||||
};
|
||||
CustomHandle.propTypes = {
|
||||
value: React.PropTypes.any,
|
||||
offset: React.PropTypes.number,
|
||||
};
|
||||
const CustomHandle = React.createClass({
|
||||
propTypes: {
|
||||
value: React.PropTypes.any,
|
||||
offset: React.PropTypes.number,
|
||||
},
|
||||
render() {
|
||||
const props = this.props;
|
||||
const style = Object.assign({ left: `${props.offset}%` }, handleStyle);
|
||||
return (
|
||||
<div style={style}>val: {props.value}</div>
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
ReactDOM.render(
|
||||
<div>
|
||||
|
||||
+6
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "rc-slider",
|
||||
"version": "5.1.3",
|
||||
"version": "5.3.5",
|
||||
"description": "slider ui component for react",
|
||||
"keywords": [
|
||||
"react",
|
||||
@@ -19,10 +19,14 @@
|
||||
},
|
||||
"files": [
|
||||
"assets/*.css",
|
||||
"lib"
|
||||
"lib",
|
||||
"dist"
|
||||
],
|
||||
"licenses": "MIT",
|
||||
"main": "./lib/index.js",
|
||||
"entry": {
|
||||
"rc-slider": ["./assets/index.less", "./src/index.js"]
|
||||
},
|
||||
"style": "./assets/index.css",
|
||||
"config": {
|
||||
"port": 8005
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ const Marks = ({ className, vertical, marks, included, upperBound, lowerBound, m
|
||||
|
||||
const bottomStyle = {
|
||||
// height: markWidth + '%',
|
||||
marginBottom: '-200%',
|
||||
marginBottom: '-50%',
|
||||
bottom: `${(point - min) / range * 100}%`,
|
||||
};
|
||||
|
||||
|
||||
+4
-2
@@ -101,7 +101,7 @@ class Slider extends React.Component {
|
||||
const isNotControlled = !('value' in props);
|
||||
if (isNotControlled) {
|
||||
this.setState(state);
|
||||
} else if (state.handle) {
|
||||
} else if (state.handle !== undefined) {
|
||||
this.setState({ handle: state.handle });
|
||||
}
|
||||
|
||||
@@ -508,9 +508,10 @@ class Slider extends React.Component {
|
||||
|
||||
const sliderClassName = classNames({
|
||||
[prefixCls]: true,
|
||||
[`${prefixCls}-with-marks`]: Object.keys(marks).length,
|
||||
[`${prefixCls}-disabled`]: disabled,
|
||||
[className]: !!className,
|
||||
[`${prefixCls}-vertical`]: this.props.vertical,
|
||||
[className]: !!className,
|
||||
});
|
||||
|
||||
return (
|
||||
@@ -518,6 +519,7 @@ class Slider extends React.Component {
|
||||
onTouchStart={disabled ? noop : this.onTouchStart.bind(this)}
|
||||
onMouseDown={disabled ? noop : this.onMouseDown.bind(this)}
|
||||
>
|
||||
<div className={`${prefixCls}-rail`} />
|
||||
{tracks}
|
||||
<Steps prefixCls={prefixCls} vertical = {vertical} marks={marks} dots={dots} step={step}
|
||||
included={isIncluded} lowerBound={bounds[0]}
|
||||
|
||||
Reference in New Issue
Block a user