Skip to content

Commit

Permalink
fix(Switch): remove icon props for mobile react
Browse files Browse the repository at this point in the history
  • Loading branch information
anlyyao committed Sep 20, 2024
1 parent e6376c3 commit aca8726
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 25 deletions.
Binary file modified db/TDesign.db
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,4 @@

import { TdSwitchProps } from './type';

export const switchDefaultProps: TdSwitchProps = {
disabled: undefined,
icon: [],
label: [],
loading: false,
size: 'medium',
};
export const switchDefaultProps: TdSwitchProps = { disabled: undefined, label: [], loading: false, size: 'medium' };
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ style | Object | - | CSS(Cascading Style Sheets),Typescript:`React.CSSProper
colors | Array | - | `deprecated`。Typescript:`string[]` | N
customValue | Array | - | Typescript:`Array<SwitchValue>` | N
disabled | Boolean | undefined | \- | N
icon | Array | [] | Typescript:`TNode[]`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
label | TNode | [] | Typescript:`Array<string \| TNode> \| TNode<{ value: SwitchValue }>`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
loading | Boolean | false | \- | N
size | String | medium | options: small/medium/large | N
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
colors | Array | - | 已废弃。自定义颜色,[打开时的颜色,关闭时的颜色]。组件默认颜色为 ['#0052d9', 'rgba(0, 0, 0, .26']。示例:[blue, gray]。TS 类型:`string[]` | N
customValue | Array | - | 用于自定义开关的值,[打开时的值,关闭时的值]。默认为 [true, false]。示例:[1, 0]['open', 'close']。TS 类型:`Array<SwitchValue>` | N
disabled | Boolean | undefined | 是否禁用组件。优先级:Switch.disabled > Form.disabled | N
icon | Array | [] | 开关的图标;[打开时的图标,关闭时的图标]。TS 类型:`TNode[]`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
label | TNode | [] | 开关内容,[开启时内容,关闭时内容]。示例:['开', '关'] 或 (value) => value ? '开' : '关'。TS 类型:`Array<string \| TNode> \| TNode<{ value: SwitchValue }>`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
loading | Boolean | false | 是否处于加载中状态 | N
size | String | medium | 开关尺寸。可选项:small/medium/large | N
Expand Down
7 changes: 1 addition & 6 deletions packages/products/tdesign-mobile-react/src/switch/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ export interface TdSwitchProps<T = SwitchValue> {
* 是否禁用组件。优先级:Switch.disabled > Form.disabled
*/
disabled?: boolean;
/**
* 开关的图标;[打开时的图标,关闭时的图标]
* @default []
*/
icon?: TNode[];
/**
* 开关内容,[开启时内容,关闭时内容]。示例:['开', '关'] 或 (value) => value ? '开' : '关'
* @default []
Expand All @@ -47,7 +42,7 @@ export interface TdSwitchProps<T = SwitchValue> {
/**
* 数据发生变化时触发
*/
onChange?: (value: T, context: { e: MouseEvent<HTMLButtonElement> }) => void;
onChange?: (value: T, context: { e: MouseEvent<HTMLDivElement> }) => void;
}

export type SwitchValue = string | number | boolean;
51 changes: 41 additions & 10 deletions packages/scripts/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -109951,7 +109951,6 @@
"id": 3424,
"platform_framework": [
"8",
"16",
"32"
],
"component": "Switch",
Expand Down Expand Up @@ -109981,7 +109980,6 @@
"field_category_text": "Props",
"platform_framework_text": [
"Vue(Mobile)",
"React(Mobile)",
"Angular(Mobile)"
],
"field_type_text": [
Expand Down Expand Up @@ -110271,10 +110269,7 @@
"platform_framework": [
"1",
"2",
"4",
"8",
"16",
"32"
"4"
],
"component": "Switch",
"field_category": 2,
Expand Down Expand Up @@ -110304,10 +110299,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 @@ -110350,6 +110342,45 @@
"Boolean"
]
},
{
"id": 1726808201,
"platform_framework": [
"8",
"16"
],
"component": "Switch",
"field_category": 2,
"field_name": "change",
"field_type": [
"4"
],
"field_default_value": "false",
"field_enum": "",
"field_desc_zh": "数据发生变化时触发",
"field_desc_en": null,
"field_required": 0,
"event_input": "(value: T, context: { e: MouseEvent })",
"create_time": "2024-09-20 04:56:41",
"update_time": "2024-09-20 04:56:41",
"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": "Events",
"platform_framework_text": [
"Vue(Mobile)",
"React(Mobile)"
],
"field_type_text": [
"Boolean"
]
},
{
"id": 3341,
"platform_framework": [
Expand Down

0 comments on commit aca8726

Please sign in to comment.