From 387ff12d77249505019e76dec908f44625520ff4 Mon Sep 17 00:00:00 2001 From: epoll-j Date: Tue, 24 Sep 2024 19:12:05 +0800 Subject: [PATCH 1/3] refactor(steps): refactor steps re #414 --- src/steps/StepItem.tsx | 195 +++++++++++++++++++++++++------------- src/steps/Steps.tsx | 31 +++--- src/steps/StepsContext.ts | 7 ++ src/steps/defaultProps.ts | 11 ++- src/steps/index.tsx | 3 +- src/steps/steps.en-US.md | 35 +++++++ src/steps/steps.md | 24 +++-- src/steps/style/index.js | 3 +- src/steps/type.ts | 23 ++++- 9 files changed, 229 insertions(+), 103 deletions(-) create mode 100644 src/steps/steps.en-US.md diff --git a/src/steps/StepItem.tsx b/src/steps/StepItem.tsx index 2947854d..b46fda7a 100644 --- a/src/steps/StepItem.tsx +++ b/src/steps/StepItem.tsx @@ -1,11 +1,14 @@ import React, { FC, useContext, useMemo } from 'react'; import classnames from 'classnames'; -import { Icon } from 'tdesign-icons-react'; +import { CheckIcon, CloseIcon } from 'tdesign-icons-react'; +import isNumber from 'lodash/isNumber'; import withNativeProps, { NativeProps } from '../_util/withNativeProps'; import { TdStepItemProps } from './type'; -import useConfig from '../_util/useConfig'; import { stepItemDefaultProps } from './defaultProps'; import StepsContext from './StepsContext'; +import useDefaultProps from '../hooks/useDefaultProps'; +import { usePrefixClass } from '../hooks/useClass'; +import parseTNode from '../_util/parseTNode'; export enum StepItemStatusEnum { DEFAULT = 'default', @@ -29,96 +32,154 @@ export interface StepItemProps extends TdStepItemProps, NativeProps { } const StepItem: FC = (props) => { - const { title, content, icon, status, index, children } = props; + const { title, titleRight, extra, content, icon, status, index, children } = useDefaultProps( + props, + stepItemDefaultProps, + ); - const { value, readonly, theme, layout, onChange } = useContext(StepsContext); + const { + value, + readonly, + theme, + layout, + currentStatus: contextStatus, + onChange, + sequence, + itemList, + } = useContext(StepsContext); + + const stepItemClass = usePrefixClass('step-item'); + const dot = useMemo(() => theme === StepThemeEnum.DOT, [theme]); + + const isLastChild = useMemo( + () => index === (sequence === 'positive' ? itemList.length - 1 : 0), + [index, itemList.length, sequence], + ); - const { classPrefix } = useConfig(); + const currentStatus = useMemo(() => { + if (status !== StepItemStatusEnum.DEFAULT) return status; + if (index === value) return contextStatus; + if (isNumber(value) && index < value) return StepItemStatusEnum.FINISH; + return status; + }, [contextStatus, index, status, value]); + + const rootClassName = useMemo( + () => + classnames(stepItemClass, `${stepItemClass}--${layout}`, { + [`${stepItemClass}--default`]: readonly, + [`${stepItemClass}--${currentStatus}`]: currentStatus, + }), + [currentStatus, layout, readonly, stepItemClass], + ); + const iconWrapperClassName = useMemo( + () => classnames(`${stepItemClass}__anchor`, `${stepItemClass}__anchor--${layout}`), + [layout, stepItemClass], + ); + const dotClass = useMemo( + () => classnames(`${stepItemClass}__dot`, `${stepItemClass}__dot--${currentStatus}`), + [currentStatus, stepItemClass], + ); - const name = `${classPrefix}-step`; + const iconClassName = useMemo( + () => + classnames(``, { + [`${stepItemClass}__icon`]: icon, + [`${stepItemClass}__icon--${currentStatus}`]: icon, + [`${stepItemClass}__circle`]: !icon, + [`${stepItemClass}__circle--${currentStatus}`]: !icon, + }), + [currentStatus, icon, stepItemClass], + ); - const dot = useMemo(() => theme === StepThemeEnum.DOT && layout === StepLayoutEnum.VERTICAL, [theme, layout]); + const contentClass = useMemo( + () => + classnames(`${stepItemClass}__content`, `${stepItemClass}__content--${layout}`, { + [`${stepItemClass}__content--${layout}`]: isLastChild, + [`${stepItemClass}__content--last`]: isLastChild, + }), + [isLastChild, layout, stepItemClass], + ); + const tilteClass = useMemo( + () => + classnames( + `${stepItemClass}__title`, + `${stepItemClass}__title--${currentStatus}`, + `${stepItemClass}__title--${layout}`, + ), + [currentStatus, layout, stepItemClass], + ); + const descriptionClass = useMemo( + () => + classnames( + `${stepItemClass}__description`, + `${stepItemClass}__description--${currentStatus}`, + `${stepItemClass}__description--${layout}`, + ), + [currentStatus, layout, stepItemClass], + ); + const extraClass = useMemo( + () => + classnames( + `${stepItemClass}__extra`, + `${stepItemClass}__extra--${currentStatus}`, + `${stepItemClass}__extra--${layout}`, + ), + [currentStatus, layout, stepItemClass], + ); + const separatorClass = useMemo( + () => + classnames( + stepItemClass, + `${stepItemClass}__line`, + `${stepItemClass}__line--${currentStatus}`, + `${stepItemClass}__line--${layout}`, + `${stepItemClass}__line--${theme}`, + `${stepItemClass}__line--${sequence}`, + ), + [currentStatus, layout, sequence, stepItemClass, theme], + ); const onStepClick = (e) => { - if (readonly || dot) return; + if (readonly) return; const currentValue = index; onChange(currentValue, value, { e }); }; - const innerClassName = useMemo(() => { - if (typeof icon === 'boolean') { - return `${name}__inner`; + const renderIconContent = () => { + if (icon) { + return parseTNode(icon); } - return classnames(`${name}__inner`, `${name}__inner__icon`); - }, [name, icon]); - const iconContent = useMemo(() => { - if (dot) { - return ''; + if (currentStatus === StepItemStatusEnum.ERROR) { + return ; } - if (status === StepItemStatusEnum.ERROR) { - return ; + if (currentStatus === StepItemStatusEnum.FINISH) { + return ; } - if (index < value && readonly) { - return ; - } - - if (typeof icon === 'boolean') { - return index + 1; - } - - if (typeof icon === 'string') { - return ; - } - - return icon; - }, [status, index, value, readonly, icon, dot]); - - const currentStatus = useMemo(() => { - if (status !== StepItemStatusEnum.DEFAULT) { - return status; - } - if (+value === index) { - return StepItemStatusEnum.PROCESS; - } - if (+value > index) { - return StepItemStatusEnum.FINISH; - } - return ''; - }, [value, index, status]); + return index + 1; + }; return withNativeProps( props, -
-
-
-
- {iconContent} -
-
-
-
{title}
-
{content || children}
-
+
+
+ {dot ?
:
{renderIconContent()}
} +
+
+
+ {parseTNode(title)} + {parseTNode(titleRight)}
+
{parseTNode(children || content)}
+
{parseTNode(extra)}
+ {!isLastChild &&
}
, ); }; StepItem.displayName = 'StepItem'; -StepItem.defaultProps = stepItemDefaultProps; export default StepItem; diff --git a/src/steps/Steps.tsx b/src/steps/Steps.tsx index 9d38aa46..e3a86ac3 100644 --- a/src/steps/Steps.tsx +++ b/src/steps/Steps.tsx @@ -3,10 +3,11 @@ import classnames from 'classnames'; import withNativeProps, { NativeProps } from '../_util/withNativeProps'; import useDefault from '../_util/useDefault'; import { TdStepsProps } from './type'; -import useConfig from '../_util/useConfig'; import { stepsDefaultProps } from './defaultProps'; import StepsContext from './StepsContext'; import StepItem from './StepItem'; +import useDefaultProps from '../hooks/useDefaultProps'; +import { usePrefixClass } from '../hooks/useClass'; export interface StepsProps extends TdStepsProps, NativeProps {} @@ -16,17 +17,14 @@ const Steps: FC = (props) => { layout, readonly, theme, - separator, + sequence, current, defaultCurrent, + currentStatus, onChange: onCurrentChange, options, - } = props; - - const { classPrefix } = useConfig(); - - const name = `${classPrefix}-steps`; - + } = useDefaultProps(props, stepsDefaultProps); + const stepsClass = usePrefixClass('steps'); const [value, onChange] = useDefault(current, defaultCurrent, onCurrentChange); const stepItemList = useMemo(() => { @@ -42,17 +40,13 @@ const Steps: FC = (props) => { return withNativeProps( props, - +
{stepItemList}
@@ -61,6 +55,5 @@ const Steps: FC = (props) => { }; Steps.displayName = 'Steps'; -Steps.defaultProps = stepsDefaultProps; export default Steps; diff --git a/src/steps/StepsContext.ts b/src/steps/StepsContext.ts index d1f13485..5644fcd9 100644 --- a/src/steps/StepsContext.ts +++ b/src/steps/StepsContext.ts @@ -1,10 +1,14 @@ import React, { MouseEvent } from 'react'; +import { TNode } from '../common'; interface StepsContextProps { value: string | number; readonly: boolean; theme: 'default' | 'dot'; layout: 'horizontal' | 'vertical'; + currentStatus?: 'default' | 'process' | 'finish' | 'error'; + sequence?: 'positive' | 'reverse'; + itemList: TNode[]; onChange: (current: string | number, previous: string | number, context?: { e?: MouseEvent }) => void; } @@ -14,6 +18,9 @@ const StepsContext = React.createContext({ onChange: null, theme: 'default', layout: 'horizontal', + sequence: 'positive', + itemList: [], + currentStatus: 'default', }); export default StepsContext; diff --git a/src/steps/defaultProps.ts b/src/steps/defaultProps.ts index 05ab6502..aa88112c 100644 --- a/src/steps/defaultProps.ts +++ b/src/steps/defaultProps.ts @@ -5,10 +5,17 @@ import { TdStepsProps, TdStepItemProps } from './type'; export const stepsDefaultProps: TdStepsProps = { + currentStatus: 'process', layout: 'horizontal', readonly: false, - separator: 'line', + sequence: 'positive', theme: 'default', }; -export const stepItemDefaultProps: TdStepItemProps = { icon: true, status: 'default' }; +export const stepItemDefaultProps: TdStepItemProps = { + content: '', + extra: '', + status: 'default', + title: '', + titleRight: '', +}; diff --git a/src/steps/index.tsx b/src/steps/index.tsx index 797cd5dd..cca63e0d 100644 --- a/src/steps/index.tsx +++ b/src/steps/index.tsx @@ -8,6 +8,7 @@ export type { StepItemProps } from './StepItem'; export * from './type'; export const Steps = _Steps; -(Steps as any).StepItem = _StepItem; +export const StepItem = _StepItem; +// (Steps as any).StepItem = _StepItem; export default Steps; diff --git a/src/steps/steps.en-US.md b/src/steps/steps.en-US.md new file mode 100644 index 00000000..7e8bae8f --- /dev/null +++ b/src/steps/steps.en-US.md @@ -0,0 +1,35 @@ +:: BASE_DOC :: + +## API + +### Steps Props + +name | type | default | description | required +-- | -- | -- | -- | -- +className | String | - | className of component | N +style | Object | - | CSS(Cascading Style Sheets),Typescript:`React.CSSProperties` | N +current | String / Number | - | \- | N +defaultCurrent | String / Number | - | uncontrolled property | N +currentStatus | String | process | options: default/process/finish/error | N +layout | String | horizontal | options: horizontal/vertical | N +options | Array | - | Typescript:`Array` | N +readonly | Boolean | false | \- | N +sequence | String | positive | options: positive/reverse | N +theme | String | default | options: default/dot | N +onChange | Function | | Typescript:`(current: string \| number, previous: string \| number, context?: { e?: MouseEvent }) => void`
| N + + +### StepItem Props + +name | type | default | description | required +-- | -- | -- | -- | -- +className | String | - | className of component | N +style | Object | - | CSS(Cascading Style Sheets),Typescript:`React.CSSProperties` | N +children | TNode | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N +content | TNode | '' | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N +extra | TNode | '' | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N +icon | TNode | true | Typescript:`boolean \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N +status | String | default | options: default/process/finish/error。Typescript:`StepStatus` `type StepStatus = 'default' \| 'process' \| 'finish' \| 'error'`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/steps/type.ts) | N +subStepItems | Array | [] | `deprecated`。Typescript:`SubStepItem[]` `interface SubStepItem { status: StepStatus, title: string }`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/steps/type.ts) | N +title | TNode | '' | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N +titleRight | TNode | '' | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N diff --git a/src/steps/steps.md b/src/steps/steps.md index 6775b070..0a354897 100644 --- a/src/steps/steps.md +++ b/src/steps/steps.md @@ -1,29 +1,35 @@ :: BASE_DOC :: ## API + ### Steps Props -名称 | 类型 | 默认值 | 说明 | 必传 +名称 | 类型 | 默认值 | 描述 | 必传 -- | -- | -- | -- | -- className | String | - | 类名 | N style | Object | - | 样式,TS 类型:`React.CSSProperties` | N current | String / Number | - | 当前步骤,即整个步骤条进度。默认根据步骤下标判断步骤的完成状态,当前步骤为进行中,当前步骤之前的步骤为已完成,当前步骤之后的步骤为未开始。如果每个步骤没有设置 value,current 值为步骤长度则表示所有步骤已完成。如果每个步骤设置了自定义 value,则 current = 'FINISH' 表示所有状态完成 | N defaultCurrent | String / Number | - | 当前步骤,即整个步骤条进度。默认根据步骤下标判断步骤的完成状态,当前步骤为进行中,当前步骤之前的步骤为已完成,当前步骤之后的步骤为未开始。如果每个步骤没有设置 value,current 值为步骤长度则表示所有步骤已完成。如果每个步骤设置了自定义 value,则 current = 'FINISH' 表示所有状态完成。非受控属性 | N +currentStatus | String | process | 用于控制 current 指向的步骤条的状态。可选项:default/process/finish/error | N layout | String | horizontal | 步骤条方向,有两种:横向和纵向。可选项:horizontal/vertical | N options | Array | - | 步骤条数据列表(作用和 StepItem 效果一样)。TS 类型:`Array` | N readonly | Boolean | false | 只读状态 | N -separator | String | line | 步骤条分割符。可选项:line/dashed/arrow | N +sequence | String | positive | 步骤条顺序。可选项:positive/reverse | N theme | String | default | 步骤条风格。可选项:default/dot | N -onChange | Function | | TS 类型:`(current: string | number, previous: string | number, context?: { e?: MouseEvent }) => void`
当前步骤发生变化时触发 | N +onChange | Function | | TS 类型:`(current: string \| number, previous: string \| number, context?: { e?: MouseEvent }) => void`
当前步骤发生变化时触发 | N + ### StepItem Props -名称 | 类型 | 默认值 | 说明 | 必传 +名称 | 类型 | 默认值 | 描述 | 必传 -- | -- | -- | -- | -- className | String | - | 类名 | N style | Object | - | 样式,TS 类型:`React.CSSProperties` | N -children | TNode | - | 步骤描述,同 content。TS 类型:`string | TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N -content | TNode | '' | 步骤描述。TS 类型:`string | TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N -icon | TNode | true | 图标,默认显示内置图标,也可以自定义图标,值为 false 则不显示图标。优先级大于 `status` 定义的图标。TS 类型:`boolean | TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N -status | String | default | 当前步骤的状态。可选项:default/process/finish/error。TS 类型:`StepStatus` `type StepStatus = 'default' | 'process' | 'finish' | 'error'`。[详细类型定义](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/steps/type.ts) | N -title | TNode | '' | 标题。TS 类型:`string | TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N +children | TNode | - | 步骤描述,同 content。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N +content | TNode | '' | 步骤描述。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N +extra | TNode | '' | 步骤条自定义内容 仅支持 layout = 'vertical' 时。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N +icon | TNode | true | 图标,默认显示内置图标,也可以自定义图标,值为 false 则不显示图标。优先级大于 `status` 定义的图标。TS 类型:`boolean \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N +status | String | default | 当前步骤的状态:默认状态(未开始)、进行中状态、完成状态、错误状态。可选项:default/process/finish/error。TS 类型:`StepStatus` `type StepStatus = 'default' \| 'process' \| 'finish' \| 'error'`。[详细类型定义](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/steps/type.ts) | N +subStepItems | Array | [] | 已废弃。子步骤条,仅支持 layout = 'vertical' 时。TS 类型:`SubStepItem[]` `interface SubStepItem { status: StepStatus, title: string }`。[详细类型定义](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/steps/type.ts) | N +title | TNode | '' | 标题。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N +titleRight | TNode | '' | 标题右侧数据 仅支持 layout = 'vertical' 时。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N diff --git a/src/steps/style/index.js b/src/steps/style/index.js index 6156d9cf..5ce6b9cd 100644 --- a/src/steps/style/index.js +++ b/src/steps/style/index.js @@ -1 +1,2 @@ -import '../../_common/style/mobile/components/steps/_index.less'; +import '../../_common/style/mobile/components/steps/v2/_index.less'; +import '../../_common/style/mobile/components/step-item/v2/_index.less'; diff --git a/src/steps/type.ts b/src/steps/type.ts index e2641c22..b447f542 100644 --- a/src/steps/type.ts +++ b/src/steps/type.ts @@ -16,6 +16,11 @@ export interface TdStepsProps { * 当前步骤,即整个步骤条进度。默认根据步骤下标判断步骤的完成状态,当前步骤为进行中,当前步骤之前的步骤为已完成,当前步骤之后的步骤为未开始。如果每个步骤没有设置 value,current 值为步骤长度则表示所有步骤已完成。如果每个步骤设置了自定义 value,则 current = 'FINISH' 表示所有状态完成,非受控属性 */ defaultCurrent?: string | number; + /** + * 用于控制 current 指向的步骤条的状态 + * @default process + */ + currentStatus?: 'default' | 'process' | 'finish' | 'error'; /** * 步骤条方向,有两种:横向和纵向 * @default horizontal @@ -31,10 +36,10 @@ export interface TdStepsProps { */ readonly?: boolean; /** - * 步骤条分割符 - * @default line + * 步骤条顺序 + * @default positive */ - separator?: 'line' | 'dashed' | 'arrow'; + sequence?: 'positive' | 'reverse'; /** * 步骤条风格 * @default default @@ -60,13 +65,18 @@ export interface TdStepItemProps { * @default '' */ content?: TNode; + /** + * 步骤条自定义内容 仅支持 layout = 'vertical' 时 + * @default '' + */ + extra?: TNode; /** * 图标,默认显示内置图标,也可以自定义图标,值为 false 则不显示图标。优先级大于 `status` 定义的图标 * @default true */ icon?: TNode; /** - * 当前步骤的状态 + * 当前步骤的状态:默认状态(未开始)、进行中状态、完成状态、错误状态 * @default default */ status?: StepStatus; @@ -75,6 +85,11 @@ export interface TdStepItemProps { * @default '' */ title?: TNode; + /** + * 标题右侧数据 仅支持 layout = 'vertical' 时 + * @default '' + */ + titleRight?: TNode; } export type StepStatus = 'default' | 'process' | 'finish' | 'error'; From 62927fbeaa12be750a0c9f21c50d69114d6bc347 Mon Sep 17 00:00:00 2001 From: epoll-j Date: Wed, 25 Sep 2024 10:37:58 +0800 Subject: [PATCH 2/3] refactor(steps): add example --- site/mobile/mobile.config.js | 2 +- src/steps/_example/click.jsx | 54 ----------- src/steps/_example/content.jsx | 29 ------ src/steps/_example/horizontal.jsx | 60 ------------ src/steps/_example/horizontal.tsx | 84 +++++++++++++++++ src/steps/_example/icon.jsx | 76 --------------- src/steps/_example/index.jsx | 47 --------- src/steps/_example/index.tsx | 27 ++++++ src/steps/_example/special.tsx | 86 +++++++++++++++++ src/steps/_example/status.tsx | 84 +++++++++++++++++ src/steps/_example/style/index.less | 2 +- src/steps/_example/vertical-readonly.jsx | 20 ---- src/steps/_example/vertical.jsx | 14 --- src/steps/_example/vertical.tsx | 115 +++++++++++++++++++++++ 14 files changed, 398 insertions(+), 302 deletions(-) delete mode 100644 src/steps/_example/click.jsx delete mode 100644 src/steps/_example/content.jsx delete mode 100644 src/steps/_example/horizontal.jsx create mode 100644 src/steps/_example/horizontal.tsx delete mode 100644 src/steps/_example/icon.jsx delete mode 100644 src/steps/_example/index.jsx create mode 100644 src/steps/_example/index.tsx create mode 100644 src/steps/_example/special.tsx create mode 100644 src/steps/_example/status.tsx delete mode 100644 src/steps/_example/vertical-readonly.jsx delete mode 100644 src/steps/_example/vertical.jsx create mode 100644 src/steps/_example/vertical.tsx diff --git a/site/mobile/mobile.config.js b/site/mobile/mobile.config.js index d8fcfdec..c6050819 100644 --- a/site/mobile/mobile.config.js +++ b/site/mobile/mobile.config.js @@ -235,7 +235,7 @@ export default { { title: 'Steps 步骤条', name: 'steps', - component: () => import('tdesign-mobile-react/steps/_example/index.jsx'), + component: () => import('tdesign-mobile-react/steps/_example/index.tsx'), }, { title: 'TabBar 标签栏', diff --git a/src/steps/_example/click.jsx b/src/steps/_example/click.jsx deleted file mode 100644 index 403b33ac..00000000 --- a/src/steps/_example/click.jsx +++ /dev/null @@ -1,54 +0,0 @@ -import React, { useState } from 'react'; -import { Steps } from 'tdesign-mobile-react'; - -export default function Click() { - const [current1, setCurrent1] = useState(1); - const [current2] = useState(1); - const [current3] = useState(1); - const stepItemList = [ - { - title: '步骤描述', - content: '辅助信息文字最多两行', - }, - { - title: '步骤描述', - content: '辅助信息文字最多两行', - }, - ]; - return ( - <> - { - setCurrent1(value); - }} - > - - - - - - - - - - - - - - - - - - - - - - - - - - - - ); -} diff --git a/src/steps/_example/content.jsx b/src/steps/_example/content.jsx deleted file mode 100644 index ea1733ae..00000000 --- a/src/steps/_example/content.jsx +++ /dev/null @@ -1,29 +0,0 @@ -import React, { useState } from 'react'; -import { Steps } from 'tdesign-mobile-react'; - -export default function Content() { - const [current] = useState(1); - return ( - <> - - - 可自定义此处内容,可自定义此处内容,可自定义此处内容可自定义此处内容可自定义此处内容。 - -
- } - /> - - - - - ); -} diff --git a/src/steps/_example/horizontal.jsx b/src/steps/_example/horizontal.jsx deleted file mode 100644 index 1760f7c2..00000000 --- a/src/steps/_example/horizontal.jsx +++ /dev/null @@ -1,60 +0,0 @@ -import React from 'react'; -import { Steps } from 'tdesign-mobile-react'; - -export default function Horizontal() { - return ( - <> -
- - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - -
- - ); -} diff --git a/src/steps/_example/horizontal.tsx b/src/steps/_example/horizontal.tsx new file mode 100644 index 00000000..a3e917f6 --- /dev/null +++ b/src/steps/_example/horizontal.tsx @@ -0,0 +1,84 @@ +import React, { useState } from 'react'; +import { Steps, StepItem } from 'tdesign-mobile-react'; +import { CartIcon } from 'tdesign-icons-react'; +import TDemoBlock from '../../../site/mobile/components/DemoBlock'; + +export default function Horizontal() { + const [options, setOptions] = useState({ + first: 1, + second: 1, + third: 1, + }); + + const onFirstChange = (current: number) => { + console.log('first change', current); + setOptions({ + ...options, + first: current, + }); + }; + const onSecondChange = (current: number) => { + console.log('second change', current); + setOptions({ + ...options, + second: current, + }); + }; + const onThirdChange = (current: number) => { + console.log('third change', current); + setOptions({ + ...options, + third: current, + }); + }; + + const getTitle = (type: 'first' | 'second' | 'third', index: number) => { + if (index === options[type]) { + return '当前步骤'; + } + if (index < options[type]) { + return '已完成'; + } + if (index > options[type]) { + return '未完成'; + } + }; + + return ( + <> + +
+ + {Array.from({ length: 4 }).map((_, index) => ( + + ))} + +
+
+ +
+ + {Array.from({ length: 4 }).map((_, index) => ( + } + /> + ))} + +
+
+ +
+ + {Array.from({ length: 4 }).map((_, index) => ( + + ))} + +
+
+ + ); +} diff --git a/src/steps/_example/icon.jsx b/src/steps/_example/icon.jsx deleted file mode 100644 index b1361754..00000000 --- a/src/steps/_example/icon.jsx +++ /dev/null @@ -1,76 +0,0 @@ -import React, { useState } from 'react'; -import { Steps } from 'tdesign-mobile-react'; -import { UserIcon, LocationIcon, TimeIcon } from 'tdesign-icons-react' - -export default function Icon() { - const [current, setCurrent] = useState(1); - return ( - <> - { - setCurrent(value); - }} - > - - - - } - /> - - - - } - /> - - - - } - /> - - { - setCurrent(value); - }} - > - - - - } - /> - - - - } - /> - - - - } - /> - - - ); -} diff --git a/src/steps/_example/index.jsx b/src/steps/_example/index.jsx deleted file mode 100644 index 8cff8ef1..00000000 --- a/src/steps/_example/index.jsx +++ /dev/null @@ -1,47 +0,0 @@ -import React from 'react'; -import TDemoBlock from '../../../site/mobile/components/DemoBlock'; -import TDemoHeader from '../../../site/mobile/components/DemoHeader'; -import Click from './click'; -import Icon from './icon'; -import Horizontal from './horizontal'; -import Content from './content'; - -import './style/index.less'; -import Vertical from './vertical'; -import VerticalReadonly from './vertical-readonly'; - -export default function StepsDemo() { - return ( -
- - -
- -
-
- -
- -
-
- - - - -
- -
-
- -
- -
-
- -
- -
-
-
- ); -} diff --git a/src/steps/_example/index.tsx b/src/steps/_example/index.tsx new file mode 100644 index 00000000..26e8a929 --- /dev/null +++ b/src/steps/_example/index.tsx @@ -0,0 +1,27 @@ +import React from 'react'; +import TDemoBlock from '../../../site/mobile/components/DemoBlock'; +import TDemoHeader from '../../../site/mobile/components/DemoHeader'; +import Horizontal from './horizontal'; +import Vertical from './vertical'; +import Status from './status'; +import Special from './special'; + +import './style/index.less'; + +export default function StepsDemo() { + return ( +
+ + + + + + + + + + + +
+ ); +} diff --git a/src/steps/_example/special.tsx b/src/steps/_example/special.tsx new file mode 100644 index 00000000..07d61ed8 --- /dev/null +++ b/src/steps/_example/special.tsx @@ -0,0 +1,86 @@ +import React, { useState } from 'react'; +import { Steps, StepItem, Button } from 'tdesign-mobile-react'; +import { CartIcon, ChevronRightIcon } from 'tdesign-icons-react'; +import TDemoBlock from '../../../site/mobile/components/DemoBlock'; + +export default function Special() { + const [options, setOptions] = useState({ + first: 3, + second: 4, + }); + + const [count, setCount] = useState(4); + + const onFirstChange = (current: number) => { + console.log('first change', current); + setOptions({ + ...options, + first: current, + }); + }; + const onSecondChange = (current: number) => { + console.log('second change', current); + setOptions({ + ...options, + second: current, + }); + }; + + const getTitle = (type: 'first' | 'second' | 'third', index: number) => { + if (index === options[type]) { + return '当前步骤'; + } + if (index < options[type]) { + return '已完成步骤'; + } + if (index > options[type]) { + return '未完成'; + } + }; + + return ( + <> + +
+ + {Array.from({ length: count }).map((_, index) => ( + } + /> + ))} + + +
+
+ +
+ + {Array.from({ length: 4 }).map((_, index) => ( + } + /> + ))} + +
+
+ + ); +} diff --git a/src/steps/_example/status.tsx b/src/steps/_example/status.tsx new file mode 100644 index 00000000..8136ab85 --- /dev/null +++ b/src/steps/_example/status.tsx @@ -0,0 +1,84 @@ +import React, { useState } from 'react'; +import { Steps, StepItem } from 'tdesign-mobile-react'; +import { CartIcon } from 'tdesign-icons-react'; +import TDemoBlock from '../../../site/mobile/components/DemoBlock'; + +export default function Status() { + const [options, setOptions] = useState({ + first: 1, + second: 1, + third: 1, + }); + + const onFirstChange = (current: number) => { + console.log('first change', current); + setOptions({ + ...options, + first: current, + }); + }; + const onSecondChange = (current: number) => { + console.log('second change', current); + setOptions({ + ...options, + second: current, + }); + }; + const onThirdChange = (current: number) => { + console.log('third change', current); + setOptions({ + ...options, + third: current, + }); + }; + + const getTitle = (type: 'first' | 'second' | 'third', index: number) => { + if (index === options[type]) { + return '当前步骤'; + } + if (index < options[type]) { + return '已完成'; + } + if (index > options[type]) { + return '未完成'; + } + }; + + return ( + <> + +
+ + {Array.from({ length: 4 }).map((_, index) => ( + + ))} + +
+
+ +
+ + {Array.from({ length: 4 }).map((_, index) => ( + } + /> + ))} + +
+
+ +
+ + {Array.from({ length: 4 }).map((_, index) => ( + + ))} + +
+
+ + ); +} diff --git a/src/steps/_example/style/index.less b/src/steps/_example/style/index.less index d9b5deba..a3bf6a57 100644 --- a/src/steps/_example/style/index.less +++ b/src/steps/_example/style/index.less @@ -1,6 +1,6 @@ .tdesign-mobile-block { background-color: #ffffff; - padding: 40px 12px; + padding: 16px 12px; & + & { margin-top: 12px; diff --git a/src/steps/_example/vertical-readonly.jsx b/src/steps/_example/vertical-readonly.jsx deleted file mode 100644 index 988236e9..00000000 --- a/src/steps/_example/vertical-readonly.jsx +++ /dev/null @@ -1,20 +0,0 @@ -import React, { useState } from 'react'; -import { Steps } from 'tdesign-mobile-react'; - -export default function Vertical() { - const [current] = useState(1); - return ( - <> - - - - - - - - - - - - ); -} diff --git a/src/steps/_example/vertical.jsx b/src/steps/_example/vertical.jsx deleted file mode 100644 index 2c343cbd..00000000 --- a/src/steps/_example/vertical.jsx +++ /dev/null @@ -1,14 +0,0 @@ -import React, { useState } from 'react'; -import { Steps } from 'tdesign-mobile-react'; - -export default function Vertical() { - const [current] = useState(1); - // 竖向简化只读步骤条 - return ( - - - - - - ); -} diff --git a/src/steps/_example/vertical.tsx b/src/steps/_example/vertical.tsx new file mode 100644 index 00000000..a50118ac --- /dev/null +++ b/src/steps/_example/vertical.tsx @@ -0,0 +1,115 @@ +import React, { useState } from 'react'; +import { Steps, StepItem, Image } from 'tdesign-mobile-react'; +import { CartIcon } from 'tdesign-icons-react'; +import TDemoBlock from '../../../site/mobile/components/DemoBlock'; + +export default function Vertical() { + const [options, setOptions] = useState({ + first: 1, + second: 1, + third: 1, + four: 1, + }); + + const onFirstChange = (current: number) => { + console.log('first change', current); + setOptions({ + ...options, + first: current, + }); + }; + const onSecondChange = (current: number) => { + console.log('second change', current); + setOptions({ + ...options, + second: current, + }); + }; + const onThirdChange = (current: number) => { + console.log('third change', current); + setOptions({ + ...options, + third: current, + }); + }; + const onFourChange = (current: number) => { + console.log('four change', current); + setOptions({ + ...options, + four: current, + }); + }; + + const getTitle = (type: 'first' | 'second' | 'third' | 'four', index: number) => { + if (index === options[type]) { + return '当前步骤'; + } + if (index < options[type]) { + return '已完成'; + } + if (index > options[type]) { + return '未完成'; + } + }; + + return ( + <> + +
+ + {Array.from({ length: 4 }).map((_, index) => ( + + ))} + +
+
+ +
+ + {Array.from({ length: 4 }).map((_, index) => ( + } + /> + ))} + +
+
+ +
+ + {Array.from({ length: 4 }).map((_, index) => ( + + ))} + +
+
+ +
+ + {Array.from({ length: 4 }).map((_, index) => ( + + ) + } + /> + ))} + +
+
+ + ); +} From df11247086e7ea0446540bcc8c85982223ef5acb Mon Sep 17 00:00:00 2001 From: epoll-j Date: Wed, 25 Sep 2024 10:42:36 +0800 Subject: [PATCH 3/3] test(steps): update snap --- test/snap/__snapshots__/csr.test.jsx.snap | 4342 +++++++++++++++++++++ test/snap/__snapshots__/ssr.test.jsx.snap | 10 + 2 files changed, 4352 insertions(+) diff --git a/test/snap/__snapshots__/csr.test.jsx.snap b/test/snap/__snapshots__/csr.test.jsx.snap index 400d9c55..1de5b1bf 100644 --- a/test/snap/__snapshots__/csr.test.jsx.snap +++ b/test/snap/__snapshots__/csr.test.jsx.snap @@ -41408,6 +41408,4338 @@ exports[`csr snapshot test > csr test src/stepper/_example/theme.tsx 1`] = `
`; +exports[`csr snapshot test > csr test src/steps/_example/horizontal.tsx 1`] = ` +
+
+
+

+ 水平带序号步骤条 +

+
+
+
+
+
+
+
+ + + +
+
+
+
+ 已完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+ 2 +
+
+
+
+ 当前步骤 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+ 3 +
+
+
+
+ 未完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+ 4 +
+
+
+
+ 未完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+
+
+

+ 水平带图标步骤条 +

+
+
+
+
+
+
+
+ + + +
+
+
+
+ 已完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+ + + +
+
+
+
+ 当前步骤 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+ + + +
+
+
+
+ 未完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+ + + +
+
+
+
+ 未完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+
+
+

+ 水平简略步骤条 +

+
+
+
+
+
+
+
+
+
+
+ 已完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+
+
+
+ 当前步骤 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+
+
+
+ 未完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+
+
+
+ 未完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+
+`; + +exports[`csr snapshot test > csr test src/steps/_example/index.tsx 1`] = ` +
+
+
+

+ Steps 步骤条 +

+

+ 用于任务步骤展示或任务进度展示 +

+
+
+
+

+ 01 组件类型 +

+
+
+
+
+

+ 水平带序号步骤条 +

+
+
+
+
+
+
+
+ + + +
+
+
+
+ 已完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+ 2 +
+
+
+
+ 当前步骤 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+ 3 +
+
+
+
+ 未完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+ 4 +
+
+
+
+ 未完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+
+
+

+ 水平带图标步骤条 +

+
+
+
+
+
+
+
+ + + +
+
+
+
+ 已完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+ + + +
+
+
+
+ 当前步骤 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+ + + +
+
+
+
+ 未完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+ + + +
+
+
+
+ 未完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+
+
+

+ 水平简略步骤条 +

+
+
+
+
+
+
+
+
+
+
+ 已完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+
+
+
+ 当前步骤 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+
+
+
+ 未完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+
+
+
+ 未完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+
+
+

+ 垂直带序号步骤条 +

+
+
+
+
+
+
+
+ + + +
+
+
+
+ 已完成 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+ 2 +
+
+
+
+ 当前步骤 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+ 3 +
+
+
+
+ 未完成 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+ 4 +
+
+
+
+ 未完成 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+
+
+

+ 垂直带图标步骤条 +

+
+
+
+
+
+
+
+ + + +
+
+
+
+ 已完成 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+ + + +
+
+
+
+ 当前步骤 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+ + + +
+
+
+
+ 未完成 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+ + + +
+
+
+
+ 未完成 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+
+
+

+ 垂直简略步骤条 +

+
+
+
+
+
+
+
+
+
+
+ 已完成 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+
+
+
+ 当前步骤 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+
+
+
+ 未完成 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+
+
+
+ 未完成 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+
+
+

+ 垂直带可自定义此处内容步骤条 +

+
+
+
+
+
+
+
+
+
+
+ 已完成 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+
+
+
+ 当前步骤 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+
+
+
+
+ 图标 +
+
+
+
+
+
+
+
+
+
+
+ 未完成 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+
+
+
+ 未完成 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+
+
+
+
+

+ 02 组件状态 +

+
+
+
+
+

+ 选项卡状态 +

+
+
+
+
+
+
+
+ + + +
+
+
+
+ 已完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+ + + +
+
+
+
+ 当前步骤 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+ 3 +
+
+
+
+ 未完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+ 4 +
+
+
+
+ 未完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + +
+
+
+
+ 已完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+ + + +
+
+
+
+ 当前步骤 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+ + + +
+
+
+
+ 未完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+ + + +
+
+
+
+ 未完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 已完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+
+
+
+ 当前步骤 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+
+
+
+ 未完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+
+
+
+ 未完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+
+
+
+
+

+ 03 特殊类型 +

+
+
+
+
+

+ 垂直自定义步骤条 +

+
+
+
+
+
+
+
+
+
+
+ 已完成步骤 + + + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+
+
+
+ 已完成步骤 + + + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+
+
+
+ 已完成步骤 + + + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+
+
+
+ 当前步骤 + + + +
+
+ 辅助信息 +
+
+
+
+
+ +
+
+
+
+
+

+ 纯展示步骤条 +

+
+
+
+
+
+
+
+
+
+
+ 步骤展示 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+
+
+
+ 步骤展示 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+
+
+
+ 步骤展示 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+
+
+
+ 步骤展示 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+
+
+
+
+`; + +exports[`csr snapshot test > csr test src/steps/_example/special.tsx 1`] = ` +
+
+
+

+ 垂直自定义步骤条 +

+
+
+
+
+
+
+
+
+
+
+ 已完成步骤 + + + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+
+
+
+ 已完成步骤 + + + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+
+
+
+ 已完成步骤 + + + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+
+
+
+ 当前步骤 + + + +
+
+ 辅助信息 +
+
+
+
+
+ +
+
+
+
+
+

+ 纯展示步骤条 +

+
+
+
+
+
+
+
+
+
+
+ 步骤展示 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+
+
+
+ 步骤展示 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+
+
+
+ 步骤展示 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+
+
+
+ 步骤展示 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+
+`; + +exports[`csr snapshot test > csr test src/steps/_example/status.tsx 1`] = ` +
+
+
+

+ 选项卡状态 +

+
+
+
+
+
+
+
+ + + +
+
+
+
+ 已完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+ + + +
+
+
+
+ 当前步骤 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+ 3 +
+
+
+
+ 未完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+ 4 +
+
+
+
+ 未完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + +
+
+
+
+ 已完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+ + + +
+
+
+
+ 当前步骤 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+ + + +
+
+
+
+ 未完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+ + + +
+
+
+
+ 未完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 已完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+
+
+
+ 当前步骤 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+
+
+
+ 未完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+
+
+
+ 未完成 + +
+
+ 辅助信息 +
+
+
+
+
+
+
+
+
+`; + +exports[`csr snapshot test > csr test src/steps/_example/vertical.tsx 1`] = ` +
+
+
+

+ 垂直带序号步骤条 +

+
+
+
+
+
+
+
+ + + +
+
+
+
+ 已完成 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+ 2 +
+
+
+
+ 当前步骤 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+ 3 +
+
+
+
+ 未完成 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+ 4 +
+
+
+
+ 未完成 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+
+
+

+ 垂直带图标步骤条 +

+
+
+
+
+
+
+
+ + + +
+
+
+
+ 已完成 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+ + + +
+
+
+
+ 当前步骤 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+ + + +
+
+
+
+ 未完成 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+ + + +
+
+
+
+ 未完成 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+
+
+

+ 垂直简略步骤条 +

+
+
+
+
+
+
+
+
+
+
+ 已完成 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+
+
+
+ 当前步骤 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+
+
+
+ 未完成 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+
+
+
+ 未完成 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+
+
+

+ 垂直带可自定义此处内容步骤条 +

+
+
+
+
+
+
+
+
+
+
+ 已完成 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+
+
+
+ 当前步骤 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+
+
+
+
+ 图标 +
+
+
+
+
+
+
+
+
+
+
+ 未完成 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+
+
+
+ 未完成 + +
+
+ 可自定义此处内容 +
+
+
+
+
+
+
+
+
+`; + exports[`csr snapshot test > csr test src/sticky/_example/base.tsx 1`] = `
ssr test src/stepper/_example/status.tsx 1`] = `" ssr test src/stepper/_example/theme.tsx 1`] = `"
"`; +exports[`ssr snapshot test > ssr test src/steps/_example/horizontal.tsx 1`] = `"

水平带序号步骤条

已完成
辅助信息
2
当前步骤
辅助信息
3
未完成
辅助信息
4
未完成
辅助信息

水平带图标步骤条

已完成
辅助信息
当前步骤
辅助信息
未完成
辅助信息
未完成
辅助信息

水平简略步骤条

已完成
辅助信息
当前步骤
辅助信息
未完成
辅助信息
未完成
辅助信息
"`; + +exports[`ssr snapshot test > ssr test src/steps/_example/index.tsx 1`] = `"

Steps 步骤条

用于任务步骤展示或任务进度展示

01 组件类型

水平带序号步骤条

已完成
辅助信息
2
当前步骤
辅助信息
3
未完成
辅助信息
4
未完成
辅助信息

水平带图标步骤条

已完成
辅助信息
当前步骤
辅助信息
未完成
辅助信息
未完成
辅助信息

水平简略步骤条

已完成
辅助信息
当前步骤
辅助信息
未完成
辅助信息
未完成
辅助信息

垂直带序号步骤条

已完成
可自定义此处内容
2
当前步骤
可自定义此处内容
3
未完成
可自定义此处内容
4
未完成
可自定义此处内容

垂直带图标步骤条

已完成
可自定义此处内容
当前步骤
可自定义此处内容
未完成
可自定义此处内容
未完成
可自定义此处内容

垂直简略步骤条

已完成
可自定义此处内容
当前步骤
可自定义此处内容
未完成
可自定义此处内容
未完成
可自定义此处内容

垂直带可自定义此处内容步骤条

已完成
可自定义此处内容
当前步骤
可自定义此处内容
图标
未完成
可自定义此处内容
未完成
可自定义此处内容

02 组件状态

选项卡状态

已完成
辅助信息
当前步骤
辅助信息
3
未完成
辅助信息
4
未完成
辅助信息
已完成
辅助信息
当前步骤
辅助信息
未完成
辅助信息
未完成
辅助信息
已完成
辅助信息
当前步骤
辅助信息
未完成
辅助信息
未完成
辅助信息

03 特殊类型

垂直自定义步骤条

已完成步骤
辅助信息
已完成步骤
辅助信息
已完成步骤
辅助信息
当前步骤
辅助信息

纯展示步骤条

步骤展示
可自定义此处内容
步骤展示
可自定义此处内容
步骤展示
可自定义此处内容
步骤展示
可自定义此处内容
"`; + +exports[`ssr snapshot test > ssr test src/steps/_example/special.tsx 1`] = `"

垂直自定义步骤条

已完成步骤
辅助信息
已完成步骤
辅助信息
已完成步骤
辅助信息
当前步骤
辅助信息

纯展示步骤条

步骤展示
可自定义此处内容
步骤展示
可自定义此处内容
步骤展示
可自定义此处内容
步骤展示
可自定义此处内容
"`; + +exports[`ssr snapshot test > ssr test src/steps/_example/status.tsx 1`] = `"

选项卡状态

已完成
辅助信息
当前步骤
辅助信息
3
未完成
辅助信息
4
未完成
辅助信息
已完成
辅助信息
当前步骤
辅助信息
未完成
辅助信息
未完成
辅助信息
已完成
辅助信息
当前步骤
辅助信息
未完成
辅助信息
未完成
辅助信息
"`; + +exports[`ssr snapshot test > ssr test src/steps/_example/vertical.tsx 1`] = `"

垂直带序号步骤条

已完成
可自定义此处内容
2
当前步骤
可自定义此处内容
3
未完成
可自定义此处内容
4
未完成
可自定义此处内容

垂直带图标步骤条

已完成
可自定义此处内容
当前步骤
可自定义此处内容
未完成
可自定义此处内容
未完成
可自定义此处内容

垂直简略步骤条

已完成
可自定义此处内容
当前步骤
可自定义此处内容
未完成
可自定义此处内容
未完成
可自定义此处内容

垂直带可自定义此处内容步骤条

已完成
可自定义此处内容
当前步骤
可自定义此处内容
图标
未完成
可自定义此处内容
未完成
可自定义此处内容
"`; + exports[`ssr snapshot test > ssr test src/sticky/_example/base.tsx 1`] = `"
"`; exports[`ssr snapshot test > ssr test src/sticky/_example/container.tsx 1`] = `"
"`; diff --git a/test/snap/__snapshots__/ssr.test.jsx.snap b/test/snap/__snapshots__/ssr.test.jsx.snap index b3964200..ae45c65b 100644 --- a/test/snap/__snapshots__/ssr.test.jsx.snap +++ b/test/snap/__snapshots__/ssr.test.jsx.snap @@ -344,6 +344,16 @@ exports[`ssr snapshot test > ssr test src/stepper/_example/status.tsx 1`] = `" ssr test src/stepper/_example/theme.tsx 1`] = `"
"`; +exports[`ssr snapshot test > ssr test src/steps/_example/horizontal.tsx 1`] = `"

水平带序号步骤条

已完成
辅助信息
2
当前步骤
辅助信息
3
未完成
辅助信息
4
未完成
辅助信息

水平带图标步骤条

已完成
辅助信息
当前步骤
辅助信息
未完成
辅助信息
未完成
辅助信息

水平简略步骤条

已完成
辅助信息
当前步骤
辅助信息
未完成
辅助信息
未完成
辅助信息
"`; + +exports[`ssr snapshot test > ssr test src/steps/_example/index.tsx 1`] = `"

Steps 步骤条

用于任务步骤展示或任务进度展示

01 组件类型

水平带序号步骤条

已完成
辅助信息
2
当前步骤
辅助信息
3
未完成
辅助信息
4
未完成
辅助信息

水平带图标步骤条

已完成
辅助信息
当前步骤
辅助信息
未完成
辅助信息
未完成
辅助信息

水平简略步骤条

已完成
辅助信息
当前步骤
辅助信息
未完成
辅助信息
未完成
辅助信息

垂直带序号步骤条

已完成
可自定义此处内容
2
当前步骤
可自定义此处内容
3
未完成
可自定义此处内容
4
未完成
可自定义此处内容

垂直带图标步骤条

已完成
可自定义此处内容
当前步骤
可自定义此处内容
未完成
可自定义此处内容
未完成
可自定义此处内容

垂直简略步骤条

已完成
可自定义此处内容
当前步骤
可自定义此处内容
未完成
可自定义此处内容
未完成
可自定义此处内容

垂直带可自定义此处内容步骤条

已完成
可自定义此处内容
当前步骤
可自定义此处内容
图标
未完成
可自定义此处内容
未完成
可自定义此处内容

02 组件状态

选项卡状态

已完成
辅助信息
当前步骤
辅助信息
3
未完成
辅助信息
4
未完成
辅助信息
已完成
辅助信息
当前步骤
辅助信息
未完成
辅助信息
未完成
辅助信息
已完成
辅助信息
当前步骤
辅助信息
未完成
辅助信息
未完成
辅助信息

03 特殊类型

垂直自定义步骤条

已完成步骤
辅助信息
已完成步骤
辅助信息
已完成步骤
辅助信息
当前步骤
辅助信息

纯展示步骤条

步骤展示
可自定义此处内容
步骤展示
可自定义此处内容
步骤展示
可自定义此处内容
步骤展示
可自定义此处内容
"`; + +exports[`ssr snapshot test > ssr test src/steps/_example/special.tsx 1`] = `"

垂直自定义步骤条

已完成步骤
辅助信息
已完成步骤
辅助信息
已完成步骤
辅助信息
当前步骤
辅助信息

纯展示步骤条

步骤展示
可自定义此处内容
步骤展示
可自定义此处内容
步骤展示
可自定义此处内容
步骤展示
可自定义此处内容
"`; + +exports[`ssr snapshot test > ssr test src/steps/_example/status.tsx 1`] = `"

选项卡状态

已完成
辅助信息
当前步骤
辅助信息
3
未完成
辅助信息
4
未完成
辅助信息
已完成
辅助信息
当前步骤
辅助信息
未完成
辅助信息
未完成
辅助信息
已完成
辅助信息
当前步骤
辅助信息
未完成
辅助信息
未完成
辅助信息
"`; + +exports[`ssr snapshot test > ssr test src/steps/_example/vertical.tsx 1`] = `"

垂直带序号步骤条

已完成
可自定义此处内容
2
当前步骤
可自定义此处内容
3
未完成
可自定义此处内容
4
未完成
可自定义此处内容

垂直带图标步骤条

已完成
可自定义此处内容
当前步骤
可自定义此处内容
未完成
可自定义此处内容
未完成
可自定义此处内容

垂直简略步骤条

已完成
可自定义此处内容
当前步骤
可自定义此处内容
未完成
可自定义此处内容
未完成
可自定义此处内容

垂直带可自定义此处内容步骤条

已完成
可自定义此处内容
当前步骤
可自定义此处内容
图标
未完成
可自定义此处内容
未完成
可自定义此处内容
"`; + exports[`ssr snapshot test > ssr test src/sticky/_example/base.tsx 1`] = `"
"`; exports[`ssr snapshot test > ssr test src/sticky/_example/container.tsx 1`] = `"
"`;