Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions src/common/Steps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,37 @@ const Steps = ({
min,
dotStyle,
activeDotStyle,
onClick,
}) => {
const range = max - min;
const elements = calcPoints(vertical, marks, dots, step, min, max).map(point => {
const offset = `${(Math.abs(point - min) / range) * 100}%`;

const isActived =
const isActive =
(!included && point === upperBound) ||
(included && point <= upperBound && point >= lowerBound);
let style = vertical
? { ...dotStyle, [reverse ? 'top' : 'bottom']: offset }
: { ...dotStyle, [reverse ? 'right' : 'left']: offset };
if (isActived) {
if (isActive) {
style = { ...style, ...activeDotStyle };
}

const pointClassName = classNames({
[`${prefixCls}-dot`]: true,
[`${prefixCls}-dot-active`]: isActived,
[`${prefixCls}-dot-active`]: isActive,
[`${prefixCls}-dot-reverse`]: reverse,
});

return <span className={pointClassName} style={style} key={point} />;
return (
<span
className={pointClassName}
style={style}
key={point}
onMouseDown={e => onClick(e, point)}
onTouchStart={e => onClick(e, point)}
/>
);
});

return <div className={`${prefixCls}-step`}>{elements}</div>;
Expand Down
1 change: 1 addition & 0 deletions src/common/createSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ export default function createSlider<
min={min}
dotStyle={dotStyle}
activeDotStyle={activeDotStyle}
onClick={disabled ? noop : this.onClickMarkLabel}
/>
{handles}
<Marks
Expand Down