Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(steps): update for mobile react #435

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
Binary file modified db/TDesign.db
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TdStepsProps, TdStepItemProps } from './type';

export const stepsDefaultProps: TdStepsProps = {
currentStatus: 'process',
layout: 'horizontal',
readonly: false,
sequence: 'positive',
theme: 'default',
};

export const stepItemDefaultProps: TdStepItemProps = { content: '', status: 'default', title: '', titleRight: '' };
33 changes: 33 additions & 0 deletions packages/products/tdesign-mobile-react/src/steps/steps.en-US.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
:: 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
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`<br/> | 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 | - | 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
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
33 changes: 33 additions & 0 deletions packages/products/tdesign-mobile-react/src/steps/steps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
:: 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
readonly | Boolean | false | 只读状态 | 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`<br/>当前步骤发生变化时触发 | 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
extra | TNode | - | 显示在步骤描述下方的额外内容,比如:操作项。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
icon | TNode | - | 图标,默认显示内置图标,也可以自定义图标,值为 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
titleRight | TNode | '' | 标题右侧数据 仅支持 layout = 'vertical' 时。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
89 changes: 89 additions & 0 deletions packages/products/tdesign-mobile-react/src/steps/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/* eslint-disable */

/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TNode } from '../common';
import { MouseEvent } from 'react';

export interface TdStepsProps {
/**
* 当前步骤,即整个步骤条进度。默认根据步骤下标判断步骤的完成状态,当前步骤为进行中,当前步骤之前的步骤为已完成,当前步骤之后的步骤为未开始。如果每个步骤没有设置 value,current 值为步骤长度则表示所有步骤已完成。如果每个步骤设置了自定义 value,则 current = 'FINISH' 表示所有状态完成
*/
current?: string | number;
/**
* 当前步骤,即整个步骤条进度。默认根据步骤下标判断步骤的完成状态,当前步骤为进行中,当前步骤之前的步骤为已完成,当前步骤之后的步骤为未开始。如果每个步骤没有设置 value,current 值为步骤长度则表示所有步骤已完成。如果每个步骤设置了自定义 value,则 current = 'FINISH' 表示所有状态完成,非受控属性
*/
defaultCurrent?: string | number;
/**
* 用于控制 current 指向的步骤条的状态
* @default process
*/
currentStatus?: 'default' | 'process' | 'finish' | 'error';
/**
* 步骤条方向,有两种:横向和纵向
* @default horizontal
*/
layout?: 'horizontal' | 'vertical';
/**
* 只读状态
* @default false
*/
readonly?: boolean;
/**
* 步骤条顺序
* @default positive
*/
sequence?: 'positive' | 'reverse';
/**
* 步骤条风格
* @default default
*/
theme?: 'default' | 'dot';
/**
* 当前步骤发生变化时触发
*/
onChange?: (
current: string | number,
previous: string | number,
context?: { e?: MouseEvent<HTMLDivElement> },
) => void;
}

export interface TdStepItemProps {
/**
* 步骤描述,同 content
*/
children?: TNode;
/**
* 步骤描述
* @default ''
*/
content?: TNode;
/**
* 显示在步骤描述下方的额外内容,比如:操作项
*/
extra?: TNode;
/**
* 图标,默认显示内置图标,也可以自定义图标,值为 false 则不显示图标。优先级大于 `status` 定义的图标
*/
icon?: TNode;
/**
* 当前步骤的状态:默认状态(未开始)、进行中状态、完成状态、错误状态
* @default default
*/
status?: StepStatus;
/**
* 标题
* @default ''
*/
title?: TNode;
/**
* 标题右侧数据 仅支持 layout = 'vertical' 时
* @default ''
*/
titleRight?: TNode;
}

export type StepStatus = 'default' | 'process' | 'finish' | 'error';
69 changes: 55 additions & 14 deletions packages/scripts/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -103513,7 +103513,9 @@
"platform_framework": [
"1",
"2",
"4"
"4",
"8",
"16"
],
"component": "StepItem",
"field_category": 1,
Expand Down Expand Up @@ -103544,7 +103546,9 @@
"platform_framework_text": [
"Vue(PC)",
"React(PC)",
"Angular(PC)"
"Angular(PC)",
"Vue(Mobile)",
"React(Mobile)"
],
"field_type_text": [
"String",
Expand All @@ -103556,10 +103560,7 @@
"platform_framework": [
"1",
"2",
"4",
"8",
"16",
"32"
"4"
],
"component": "StepItem",
"field_category": 1,
Expand Down Expand Up @@ -103590,10 +103591,7 @@
"platform_framework_text": [
"Vue(PC)",
"React(PC)",
"Angular(PC)",
"Vue(Mobile)",
"React(Mobile)",
"Angular(Mobile)"
"Angular(PC)"
],
"field_type_text": [
"Boolean",
Expand Down Expand Up @@ -103639,6 +103637,49 @@
"TNode"
]
},
{
"id": 1727232179,
"platform_framework": [
"8",
"16",
"32"
],
"component": "StepItem",
"field_category": 1,
"field_name": "icon",
"field_type": [
"4",
"64"
],
"field_default_value": "",
"field_enum": "",
"field_desc_zh": "图标,默认显示内置图标,也可以自定义图标,值为 false 则不显示图标。优先级大于 `status` 定义的图标",
"field_desc_en": null,
"field_required": 0,
"event_input": "",
"create_time": "2024-09-25 02:42:59",
"update_time": "2024-09-25 02:42:59",
"event_output": null,
"custom_field_type": null,
"syntactic_sugar": null,
"readonly": 1,
"html_attribute": 0,
"trigger_elements": "",
"deprecated": 0,
"version": "",
"test_description": null,
"support_default_value": 0,
"field_category_text": "Props",
"platform_framework_text": [
"Vue(Mobile)",
"React(Mobile)",
"Angular(Mobile)"
],
"field_type_text": [
"Boolean",
"TNode"
]
},
{
"id": 614,
"platform_framework": [
Expand Down Expand Up @@ -103783,7 +103824,8 @@
{
"id": 1712570381,
"platform_framework": [
"8"
"8",
"16"
],
"component": "StepItem",
"field_category": 1,
Expand Down Expand Up @@ -103812,7 +103854,8 @@
"support_default_value": 0,
"field_category_text": "Props",
"platform_framework_text": [
"Vue(Mobile)"
"Vue(Mobile)",
"React(Mobile)"
],
"field_type_text": [
"String",
Expand Down Expand Up @@ -105132,7 +105175,6 @@
"1",
"2",
"4",
"16",
"32"
],
"component": "Steps",
Expand Down Expand Up @@ -105164,7 +105206,6 @@
"Vue(PC)",
"React(PC)",
"Angular(PC)",
"React(Mobile)",
"Angular(Mobile)"
],
"field_type_text": [
Expand Down
Loading