From 3155ab33cb500249832e8077a8b0e70388245609 Mon Sep 17 00:00:00 2001 From: KMS-Bismarck <50952954+KMS-Bismarck@users.noreply.github.com> Date: Fri, 6 Dec 2024 15:44:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20`Step`=20=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=AE=BE=E7=BD=AE=20`disabled`=20=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E5=90=8E=E5=8A=9F=E8=83=BD=E5=A4=B1=E6=95=88=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20(#854)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 修复 `Step` 组件设置 `disabled` 属性后功能失效的问题 --------- Co-authored-by: 颜宇浩 --- package.json | 2 +- packages/base/src/steps/step.tsx | 8 +++++++- packages/shineout-style/src/steps/steps.ts | 17 ++++++++++++----- .../shineout/src/steps/__doc__/changelog.cn.md | 6 ++++++ 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 3c3f5bb78..8459520d9 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "sheinx", "private": true, - "version": "3.5.4-beta.6", + "version": "3.5.4-beta.7", "description": "A react library developed with sheinx", "module": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/base/src/steps/step.tsx b/packages/base/src/steps/step.tsx index 2021c29a5..157085453 100644 --- a/packages/base/src/steps/step.tsx +++ b/packages/base/src/steps/step.tsx @@ -29,6 +29,7 @@ const Step = (props: StepProps) => { onClick, onChange, } = props; + const config = useConfig(); const styles = jssStyle?.steps?.() || ({} as StepsClasses); const getLabelPlacement = () => { @@ -63,6 +64,7 @@ const Step = (props: StepProps) => { }); const handleChange = (e: React.MouseEvent) => { + if (disabled) return; onClick?.(e, index, id); onChange?.(index); }; @@ -101,7 +103,11 @@ const Step = (props: StepProps) => { ); }; - return
{renderStep()}
; + return ( +
+ {renderStep()} +
+ ); }; const StepWidthContext = (props: BaseStepProps) => { diff --git a/packages/shineout-style/src/steps/steps.ts b/packages/shineout-style/src/steps/steps.ts index 1734bcbe9..e9b9c8c77 100644 --- a/packages/shineout-style/src/steps/steps.ts +++ b/packages/shineout-style/src/steps/steps.ts @@ -22,20 +22,20 @@ const stepsStyle: JsStyles = { transition: 'color ease 0.3s', }, '&$arrow': { - '& $step': { + '& $step:not($disabled)': { cursor: 'pointer', }, }, '&$default': { - '& $step:not($process)': { + '& $step:not($process):not($disabled)': { cursor: 'pointer', }, - '& $step$wait:hover': { + '& $step$wait:not($disabled):hover': { '& $title,$description': { color: Token.stepsWaitHoverFontColor, }, }, - '& $step$finish:hover': { + '& $step$finish:not($disabled):hover': { '& $title,$description': { color: Token.stepsFinishHoverFontColor, }, @@ -257,7 +257,14 @@ const stepsStyle: JsStyles = { marginRight: 0, }, }, - disabled: {}, + disabled: { + '&$step': { + cursor: 'not-allowed', + }, + '& $icon:not($process)': { + cursor: 'not-allowed', + }, + }, horizontalLabel: { '&$step': { overflow: 'hidden', diff --git a/packages/shineout/src/steps/__doc__/changelog.cn.md b/packages/shineout/src/steps/__doc__/changelog.cn.md index 999643baf..76077c439 100644 --- a/packages/shineout/src/steps/__doc__/changelog.cn.md +++ b/packages/shineout/src/steps/__doc__/changelog.cn.md @@ -1,3 +1,9 @@ +## 3.5.4-beta.7 +2024-12-06 +### 🐞 BugFix + +- 修复 `Step` 组件设置 `disabled` 属性后功能失效的问题 ([#854](https://github.com/sheinsight/shineout-next/pull/854)) + ## 3.3.0 2024-07-23 ### 🐞 BugFix