Skip to content

Commit

Permalink
Merge branch 'main' into fix/2305
Browse files Browse the repository at this point in the history
  • Loading branch information
pointhalo authored Jul 12, 2024
2 parents 77380b8 + 46e633f commit e790a8a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/semi-foundation/slider/foundation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export interface SliderProps{
handleDot?: {
size?: string;
color?: string
} & ({
} | ({
size?: string;
color?: string
}[])
Expand Down
22 changes: 14 additions & 8 deletions packages/semi-ui/slider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export default class Slider extends BaseComponent<SliderProps, SliderState> {
const offsetParentRect = this.sliderEl.current.offsetParent?.getBoundingClientRect();

const offset = {
x: offsetParentRect ? (rect.left - offsetParentRect.left): this.sliderEl.current.offsetLeft,
x: offsetParentRect ? (rect.left - offsetParentRect.left) : this.sliderEl.current.offsetLeft,
y: offsetParentRect ? (rect.top - offsetParentRect.top) : this.sliderEl.current.offsetTop,
};
return {
Expand Down Expand Up @@ -333,7 +333,13 @@ export default class Slider extends BaseComponent<SliderProps, SliderState> {
'aria-disabled': disabled
};
vertical && Object.assign(commonAria, { 'aria-orientation': 'vertical' });

const handleDot = this.props.handleDot as {
size?: string;
color?: string
} & ({
size?: string;
color?: string
}[]);
const handleContents = !range ? (
<Tooltip
content={tipChildren.min}
Expand Down Expand Up @@ -387,9 +393,9 @@ export default class Slider extends BaseComponent<SliderProps, SliderState> {
aria-valuemax={max}
aria-valuemin={min}
>
{this.props.handleDot && <div className={cssClasses.HANDLE_DOT} style={{
...(this.props.handleDot?.size ? { width: this.props.handleDot.size, height: this.props.handleDot.size } : {}),
...(this.props.handleDot?.color ? { backgroundColor: this.props.handleDot.color } : {}),
{handleDot && <div className={cssClasses.HANDLE_DOT} style={{
...(handleDot?.size ? { width: handleDot.size, height: handleDot.size } : {}),
...(handleDot?.color ? { backgroundColor: handleDot.color } : {}),
}} />}
</span>
</Tooltip>
Expand Down Expand Up @@ -445,9 +451,9 @@ export default class Slider extends BaseComponent<SliderProps, SliderState> {
aria-valuemax={currentValue[1]}
aria-valuemin={min}
>
{this.props.handleDot?.[0] && <div className={cssClasses.HANDLE_DOT} style={{
...(this.props.handleDot[0]?.size ? { width: this.props.handleDot[0].size, height: this.props.handleDot[0].size } : {}),
...(this.props.handleDot[0]?.color ? { backgroundColor: this.props.handleDot[0].color } : {}),
{handleDot?.[0] && <div className={cssClasses.HANDLE_DOT} style={{
...(handleDot[0]?.size ? { width: handleDot[0].size, height: handleDot[0].size } : {}),
...(handleDot[0]?.color ? { backgroundColor: handleDot[0].color } : {}),
}} />}
</span>
</Tooltip>
Expand Down

0 comments on commit e790a8a

Please sign in to comment.