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(action-sheet) 属性新增 #221

Closed
wants to merge 4 commits into from
Closed
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
@@ -1,23 +1,27 @@
:: BASE_DOC ::

## API

### ActionSheet Props

name | type | default | description | required
-- | -- | -- | -- | --
cancel-text | String | - | \- | N
count | Number | 8 | \- | N
items | Array | - | required。Typescript:`Array<string \| ActionSheetItem>` `interface ActionSheetItem {label: string; color?: string; disabled?: boolean }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/action-sheet/type.ts) | Y
show-cancel | Boolean | true | \- | N
style | String | - | \- | N
theme | String | list | options:list/grid | N
visible | Boolean | false | required | Y
default-visible | Boolean | undefined | required。uncontrolled property | Y
| name | type | default | description | required |
| --------------- | ------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| align | String | center | `0.29.0`。options: center/left | N |
| cancel-text | String | - | \- | N |
| count | Number | 8 | \- | N |
| description | String | - | `0.29.0` | N |
| items | Array | - | required。Typescript:`Array<string \| ActionSheetItem>` `interface ActionSheetItem {label: string; color?: string; disabled?: boolean;icon?: string;suffixIcon?: string; }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/action-sheet/type.ts) | Y |
| popup-props | Object | {} | \- | N |
| show-cancel | Boolean | true | \- | N |
| show-overlay | Boolean | true | \- | N |
| theme | String | list | options: list/grid | N |
| visible | Boolean | false | required | Y |
| default-visible | Boolean | undefined | required。uncontrolled property | Y |

### ActionSheet Events

name | params | description
-- | -- | --
cancel | \- | \-
close | \- | \-
selected | `(selected: ActionSheetItem \| string, index: number)` | \-
| name | params | description |
| -------- | ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| cancel | \- | \- |
| close | `(trigger: TriggerSource)` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/action-sheet/type.ts)。<br/>`type TriggerSource = 'overlay' \| 'command' \| 'select' `<br/> |
| selected | `(selected: ActionSheetItem \| string, index: number)` | \- |
34 changes: 19 additions & 15 deletions packages/products/tdesign-miniprogram/src/action-sheet/README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
:: BASE_DOC ::

## API

### ActionSheet Props

名称 | 类型 | 默认值 | 说明 | 必传
-- | -- | -- | -- | --
cancel-text | String | - | 设置取消按钮的文本 | N
count | Number | 8 | 设置每页展示菜单的数量,仅当 type=grid 时有效 | N
items | Array | - | 必需。菜单项。TS 类型:`Array<string \| ActionSheetItem>` `interface ActionSheetItem {label: string; color?: string; disabled?: boolean }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/action-sheet/type.ts) | Y
show-cancel | Boolean | true | 是否显示取消按钮 | N
style | String | - | 自定义组件样式 | N
theme | String | list | 展示类型,列表和表格形式展示。可选项:list/grid | N
visible | Boolean | false | 必需。显示与隐藏 | Y
default-visible | Boolean | undefined | 必需。显示与隐藏。非受控属性 | Y
| 名称 | 类型 | 默认值 | 说明 | 必传 |
| --------------- | ------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---- |
| align | String | center | `0.29.0`。水平对齐方式。可选项:center/left | N |
| cancel-text | String | - | 设置取消按钮的文本 | N |
| count | Number | 8 | 设置每页展示菜单的数量,仅当 type=grid 时有效 | N |
| description | String | - | `0.29.0`。动作面板描述文字 | N |
| items | Array | - | 必需。菜单项。TS 类型:`Array<string \| ActionSheetItem>` `interface ActionSheetItem {label: string; color?: string; disabled?: boolean;icon?: string;suffixIcon?: string; }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/action-sheet/type.ts) | Y |
| popup-props | Object | {} | popupProps 透传 | N |
| show-cancel | Boolean | true | 是否显示取消按钮 | N |
| show-overlay | Boolean | true | 是否显示遮罩层 | N |
| theme | String | list | 展示类型,列表和表格形式展示。可选项:list/grid | N |
| visible | Boolean | false | 必需。显示与隐藏 | Y |
| default-visible | Boolean | undefined | 必需。显示与隐藏。非受控属性 | Y |

### ActionSheet Events

名称 | 参数 | 描述
-- | -- | --
cancel | \- | 点击取消按钮时触发
close | \- | 关闭时触发
selected | `(selected: ActionSheetItem \| string, index: number)` | 选择菜单项时触发
| 名称 | 参数 | 描述 |
| -------- | ------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| cancel | \- | 点击取消按钮时触发 |
| close | `(trigger: TriggerSource)` | 关闭时触发。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/action-sheet/type.ts)。<br/>`type TriggerSource = 'overlay' \| 'command' \| 'select' `<br/> |
| selected | `(selected: ActionSheetItem \| string, index: number)` | 选择菜单项时触发 |
23 changes: 19 additions & 4 deletions packages/products/tdesign-miniprogram/src/action-sheet/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@

import { TdActionSheetProps } from './type';
const props: TdActionSheetProps = {
/** 水平对齐方式 */
align: {
type: String,
value: 'center',
},
/** 设置取消按钮的文本 */
cancelText: {
type: String,
Expand All @@ -16,20 +21,30 @@ const props: TdActionSheetProps = {
type: Number,
value: 8,
},
/** 动作面板描述文字 */
description: {
type: String,
value: '',
},
/** 菜单项 */
items: {
type: Array,
required: true,
},
/** popupProps透传 */
popupProps: {
type: Object,
value: {},
},
/** 是否显示取消按钮 */
showCancel: {
type: Boolean,
value: true,
},
/** 自定义组件样式 */
style: {
type: String,
value: '',
/** 是否显示遮罩层 */
showOverlay: {
type: Boolean,
value: true,
},
/** 展示类型,列表和表格形式展示 */
theme: {
Expand Down
36 changes: 31 additions & 5 deletions packages/products/tdesign-miniprogram/src/action-sheet/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
* */

export interface TdActionSheetProps {
/**
* 水平对齐方式
* @default center
*/
align?: {
type: StringConstructor;
value?: 'center' | 'left';
};
/**
* 设置取消按钮的文本
* @default ''
Expand All @@ -21,13 +29,29 @@ export interface TdActionSheetProps {
type: NumberConstructor;
value?: number;
};
/**
* 动作面板描述文字
* @default ''
*/
description?: {
type: StringConstructor;
value?: string;
};
/**
* 菜单项
*/
items: {
type: ArrayConstructor;
value?: Array<string | ActionSheetItem>;
};
/**
* popupProps透传
* @default {}
*/
popupProps?: {
type: ObjectConstructor;
value?: object;
};
/**
* 是否显示取消按钮
* @default true
Expand All @@ -37,12 +61,12 @@ export interface TdActionSheetProps {
value?: boolean;
};
/**
* 自定义组件样式
* @default ''
* 是否显示遮罩层
* @default true
*/
style?: {
type: StringConstructor;
value?: string;
showOverlay?: {
type: BooleanConstructor;
value?: boolean;
};
/**
* 展示类型,列表和表格形式展示
Expand Down Expand Up @@ -74,4 +98,6 @@ export interface ActionSheetItem {
label: string;
color?: string;
disabled?: boolean;
icon?: string;
suffixIcon?: string;
}
9 changes: 7 additions & 2 deletions packages/products/tdesign-miniprogram/src/common/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ export type HorizontalAlignEnum = 'left' | 'center' | 'right';

export type VerticalAlignEnum = 'top' | 'middle' | 'bottom';

export enum LayoutEnum {
VERTICAL = 'vertical',
HORIZONTAL = 'horizontal',
}

export type ClassName = { [className: string]: any } | ClassName[] | string;

export type CSSSelector = string;
Expand Down Expand Up @@ -85,7 +90,7 @@ export type InfinityScroll = TScroll;

export interface ScrollToElementParams {
/** 跳转元素下标 */
index: number;
index?: number;
/** 跳转元素距离顶部的距离 */
top?: number;
/** 单个元素高度非固定场景下,即 isFixedRowHeight = false。延迟设置元素位置,一般用于依赖不同高度异步渲染等场景,单位:毫秒 */
Expand All @@ -94,5 +99,5 @@ export interface ScrollToElementParams {
}

export interface ComponentScrollToElementParams extends ScrollToElementParams {
key: string | number;
key?: string | number;
}
88 changes: 87 additions & 1 deletion packages/scripts/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -2178,7 +2178,7 @@
"create_time": "2021-09-02 12:06:15",
"update_time": "2022-04-08 09:06:29",
"event_output": null,
"custom_field_type": "Array<string | ActionSheetItem>【interface ActionSheetItem {label: string; color?: string; disabled?: boolean }】",
"custom_field_type": "Array<string | ActionSheetItem>【interface ActionSheetItem {label: string; color?: string; disabled?: boolean;icon?: string;suffixIcon?: string; }】",
"syntactic_sugar": null,
"readonly": 1,
"html_attribute": 0,
Expand All @@ -2198,6 +2198,49 @@
"Array"
]
},
{
"id": 1704784516,
"platform_framework": [
"8",
"16",
"32",
"64"
],
"component": "ActionSheet",
"field_category": 1,
"field_name": "popupProps",
"field_type": [
"8"
],
"field_default_value": "{}",
"field_enum": "",
"field_desc_zh": "popupProps透传",
"field_desc_en": null,
"field_required": 0,
"event_input": "",
"create_time": "2024-01-09 07:15:16",
"update_time": "2024-01-09 07:15:16",
"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)",
"Miniprogram"
],
"field_type_text": [
"Object"
]
},
{
"id": 1611,
"platform_framework": [
Expand Down Expand Up @@ -2241,6 +2284,49 @@
"Boolean"
]
},
{
"id": 1704784443,
"platform_framework": [
"8",
"16",
"32",
"64"
],
"component": "ActionSheet",
"field_category": 1,
"field_name": "showOverlay",
"field_type": [
"4"
],
"field_default_value": "true",
"field_enum": "",
"field_desc_zh": "是否显示遮罩层",
"field_desc_en": null,
"field_required": 0,
"event_input": "",
"create_time": "2024-01-09 07:14:03",
"update_time": "2024-01-09 07:14:03",
"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)",
"Miniprogram"
],
"field_type_text": [
"Boolean"
]
},
{
"id": 1609,
"platform_framework": [
Expand Down