From 7ffd01e5a7d0b884d8d20bda2ca4c0f1552bc3f7 Mon Sep 17 00:00:00 2001 From: andyjxli Date: Wed, 23 Feb 2022 17:18:01 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=E5=88=BB=E5=BA=A6=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=8Cinput=20number=20=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/slider/Slider.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/slider/Slider.tsx b/src/slider/Slider.tsx index f60769afa..c1ea05b60 100644 --- a/src/slider/Slider.tsx +++ b/src/slider/Slider.tsx @@ -55,7 +55,7 @@ const Slider = forwardRef( } return marks.map((mark) => ({ value: mark, - position: (mark - min) / max, + position: (mark - min) / (max - min), label: mark, })); } @@ -91,6 +91,8 @@ const Slider = forwardRef( return result; }, [max, min, step]); + if (min === -10) console.log(allDots, dots); + const startDirection = isVertical ? 'bottom' : 'left'; const stepDirection = isVertical ? 'top' : 'left'; const sizeKey = isVertical ? 'height' : 'width'; @@ -118,7 +120,6 @@ const Slider = forwardRef( return ( handleInputChange(Number(value), nodeIndex)} className={classNames(`${classPrefix}-slider-input`, { @@ -126,6 +127,7 @@ const Slider = forwardRef( })} disabled={disabled} {...inputProps} + theme="column" /> ); }; @@ -211,7 +213,7 @@ const Slider = forwardRef( > {range ? createHandleButton(LEFT_NODE, { [startDirection]: numberToPercent(start) }) : null} {createHandleButton(RIGHT_NODE, { [startDirection]: numberToPercent(end) })} -
+
{renderDots.map(({ position, value }) => (
( })} > {range && createInput(LEFT_NODE)} + {range &&
} {createInput(RIGHT_NODE)}
) : null} From f5377a1bae1074eba4992862ea507244adf48fee Mon Sep 17 00:00:00 2001 From: andyjxli Date: Wed, 23 Feb 2022 17:21:00 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20=E6=97=A0=E7=94=A8=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/slider/Slider.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/slider/Slider.tsx b/src/slider/Slider.tsx index c1ea05b60..cc1cbdc53 100644 --- a/src/slider/Slider.tsx +++ b/src/slider/Slider.tsx @@ -91,8 +91,6 @@ const Slider = forwardRef( return result; }, [max, min, step]); - if (min === -10) console.log(allDots, dots); - const startDirection = isVertical ? 'bottom' : 'left'; const stepDirection = isVertical ? 'top' : 'left'; const sizeKey = isVertical ? 'height' : 'width'; From cb95390b1caa617b0a1b8f46dd71a9a48433b28c Mon Sep 17 00:00:00 2001 From: andyjxli Date: Wed, 23 Feb 2022 17:38:41 +0800 Subject: [PATCH 3/3] fix: unit test --- test/ssr/__snapshots__/ssr.test.js.snap | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/ssr/__snapshots__/ssr.test.js.snap b/test/ssr/__snapshots__/ssr.test.js.snap index e294262dc..c6ea03713 100644 --- a/test/ssr/__snapshots__/ssr.test.js.snap +++ b/test/ssr/__snapshots__/ssr.test.js.snap @@ -554,23 +554,23 @@ exports[`ssr snapshot test renders ./src/skeleton/_example/base.jsx correctly 1` exports[`ssr snapshot test renders ./src/skeleton/_example/theme.jsx correctly 1`] = `"
文本
头像
段落
头像描述
选项卡
文章
"`; -exports[`ssr snapshot test renders ./src/slider/_example/base.jsx correctly 1`] = `"
"`; +exports[`ssr snapshot test renders ./src/slider/_example/base.jsx correctly 1`] = `"
"`; -exports[`ssr snapshot test renders ./src/slider/_example/disabled.jsx correctly 1`] = `"
"`; +exports[`ssr snapshot test renders ./src/slider/_example/disabled.jsx correctly 1`] = `"
"`; -exports[`ssr snapshot test renders ./src/slider/_example/input-number.jsx correctly 1`] = `"
"`; +exports[`ssr snapshot test renders ./src/slider/_example/input-number.jsx correctly 1`] = `"
"`; -exports[`ssr snapshot test renders ./src/slider/_example/input-number-vertical.jsx correctly 1`] = `"
"`; +exports[`ssr snapshot test renders ./src/slider/_example/input-number-vertical.jsx correctly 1`] = `"
"`; -exports[`ssr snapshot test renders ./src/slider/_example/marks.jsx correctly 1`] = `"
0°C
12°C
37°C
0°C
8°C
37°C
50°C
70°C
"`; +exports[`ssr snapshot test renders ./src/slider/_example/marks.jsx correctly 1`] = `"
0°C
12°C
37°C
0°C
8°C
37°C
50°C
70°C
"`; -exports[`ssr snapshot test renders ./src/slider/_example/min-and-max.jsx correctly 1`] = `"
"`; +exports[`ssr snapshot test renders ./src/slider/_example/min-and-max.jsx correctly 1`] = `"
"`; -exports[`ssr snapshot test renders ./src/slider/_example/step.jsx correctly 1`] = `"
"`; +exports[`ssr snapshot test renders ./src/slider/_example/step.jsx correctly 1`] = `"
"`; -exports[`ssr snapshot test renders ./src/slider/_example/vertical.jsx correctly 1`] = `"
"`; +exports[`ssr snapshot test renders ./src/slider/_example/vertical.jsx correctly 1`] = `"
"`; -exports[`ssr snapshot test renders ./src/slider/_example/vertical-marks.jsx correctly 1`] = `"
0°C
12°C
37°C
0°C
8°C
37°C
50°C
70°C
"`; +exports[`ssr snapshot test renders ./src/slider/_example/vertical-marks.jsx correctly 1`] = `"
0°C
12°C
37°C
0°C
8°C
37°C
50°C
70°C
"`; exports[`ssr snapshot test renders ./src/steps/_example/OperateSteps.jsx correctly 1`] = `"

步骤1
这里是提示文字
2
步骤2
这里是提示文字
3
步骤3
这里是提示文字
4
步骤4
这里是提示文字
步骤1
这里是提示文字
2
步骤3
这里是提示文字
3
步骤4
这里是提示文字
4
步骤5
这里是提示文字
"`;