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(rate): 修改 mobile react rate 组件 api #390

Merged
merged 2 commits into from
Aug 26, 2024
Merged
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.
18 changes: 18 additions & 0 deletions packages/products/tdesign-mobile-react/src/rate/defaultProps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TdRateProps } from './type';

export const rateDefaultProps: TdRateProps = {
allowHalf: false,
color: '#ED7B2F',
count: 5,
disabled: undefined,
gap: 8,
placement: 'top',
showText: false,
size: '24px',
texts: [],
defaultValue: 0,
};
23 changes: 23 additions & 0 deletions packages/products/tdesign-mobile-react/src/rate/rate.en-US.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
:: BASE_DOC ::

## API

### Rate Props

name | type | default | description | required
-- | -- | -- | -- | --
className | String | - | className of component | N
style | Object | - | CSS(Cascading Style Sheets),Typescript:`React.CSSProperties` | N
allowHalf | Boolean | false | \- | N
color | String / Array | '#ED7B2F' | Typescript:`string \| Array<string>` | N
count | Number | 5 | \- | N
disabled | Boolean | undefined | \- | N
gap | String / Number | 8 | \- | N
icon | TNode | - | Typescript:`Array<TNode \| Function>`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
placement | String | top | options: top / bottom / '' | N
showText | Boolean | false | \- | N
size | String | 24px | \- | N
texts | Array | [] | Typescript:`Array<string>` | N
value | Number | 0 | \- | N
defaultValue | Number | 0 | uncontrolled property | N
onChange | Function | | Typescript:`(value: number) => void`<br/> | N
23 changes: 23 additions & 0 deletions packages/products/tdesign-mobile-react/src/rate/rate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
:: BASE_DOC ::

## API

### Rate Props

名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
allowHalf | Boolean | false | 是否允许半选 | N
color | String / Array | '#ED7B2F' | 评分图标的颜色,样式中默认为 #ED7B2F。一个值表示设置选中高亮的五角星颜色,示例:[选中颜色]。数组则表示分别设置 选中高亮的五角星颜色 和 未选中暗灰的五角星颜色,[选中颜色,未选中颜色]。示例:['#ED7B2F', '#E3E6EB']。TS 类型:`string \| Array<string>` | N
count | Number | 5 | 评分的数量 | N
disabled | Boolean | undefined | 是否禁用评分 | N
gap | String / Number | 8 | 评分图标的间距 | N
icon | TNode | - | 自定义评分图标,[选中图标,未选中图标]。TS 类型:`Array<TNode \| Function>`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
placement | String | top | 选择评分弹框的位置,值为空字符表示不显示评分弹框。可选项:top / bottom / '' | N
showText | Boolean | false | 是否显示对应的辅助文字 | N
size | String | 24px | 评分图标的大小 | N
texts | Array | [] | 评分等级对应的辅助文字。组件内置默认值为:['极差', '失望', '一般', '满意', '惊喜']。自定义值示例:['1分', '2分', '3分', '4分', '5分']。TS 类型:`Array<string>` | N
value | Number | 0 | 选择评分的值 | N
defaultValue | Number | 0 | 选择评分的值。非受控属性 | N
onChange | Function | | TS 类型:`(value: number) => void`<br/>评分数改变时触发 | N
72 changes: 72 additions & 0 deletions packages/products/tdesign-mobile-react/src/rate/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/* eslint-disable */

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

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

export interface TdRateProps {
/**
* 是否允许半选
* @default false
*/
allowHalf?: boolean;
/**
* 评分图标的颜色,样式中默认为 #ED7B2F。一个值表示设置选中高亮的五角星颜色,示例:[选中颜色]。数组则表示分别设置 选中高亮的五角星颜色 和 未选中暗灰的五角星颜色,[选中颜色,未选中颜色]。示例:['#ED7B2F', '#E3E6EB']
* @default '#ED7B2F'
*/
color?: string | Array<string>;
/**
* 评分的数量
* @default 5
*/
count?: number;
/**
* 是否禁用评分
*/
disabled?: boolean;
/**
* 评分图标的间距
* @default 8
*/
gap?: string | number;
/**
* 自定义评分图标,[选中图标,未选中图标]
*/
icon?: Array<TNode | Function>;
/**
* 选择评分弹框的位置,值为空字符表示不显示评分弹框
* @default top
*/
placement?: 'top' | 'bottom' | '';
/**
* 是否显示对应的辅助文字
* @default false
*/
showText?: boolean;
/**
* 评分图标的大小
* @default 24px
*/
size?: string;
/**
* 评分等级对应的辅助文字。组件内置默认值为:['极差', '失望', '一般', '满意', '惊喜']。自定义值示例:['1分', '2分', '3分', '4分', '5分']
* @default []
*/
texts?: Array<string>;
/**
* 选择评分的值
* @default 0
*/
value?: number;
/**
* 选择评分的值,非受控属性
* @default 0
*/
defaultValue?: number;
/**
* 评分数改变时触发
*/
onChange?: (value: number) => void;
}
8 changes: 4 additions & 4 deletions packages/scripts/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -92762,7 +92762,8 @@
{
"id": 3438,
"platform_framework": [
"8"
"8",
"16"
],
"component": "Rate",
"field_category": 1,
Expand Down Expand Up @@ -92791,7 +92792,8 @@
"support_default_value": 0,
"field_category_text": "Props",
"platform_framework_text": [
"Vue(Mobile)"
"Vue(Mobile)",
"React(Mobile)"
],
"field_type_text": [
"Array",
Expand Down Expand Up @@ -93077,7 +93079,6 @@
{
"id": 2428,
"platform_framework": [
"16",
"32",
"64"
],
Expand Down Expand Up @@ -93107,7 +93108,6 @@
"support_default_value": 0,
"field_category_text": "Props",
"platform_framework_text": [
"React(Mobile)",
"Angular(Mobile)",
"Miniprogram"
],
Expand Down
Loading