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(ActionSheet): Added the popupProps and showOverlay properties #1704

Merged
merged 6 commits into from
Jan 8, 2025
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
2 changes: 2 additions & 0 deletions src/action-sheet/action-sheet.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ cancelText | String | - | \- | N
count | Number | 8 | \- | N
description | String | - | \- | N
items | Array | - | Typescript:`Array<string \| ActionSheetItem>` `interface ActionSheetItem { label: string; color?: string; disabled?: boolean; icon?: TNode; badge?: BadgeProps }`,[Badge API Documents](./badge?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts)。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/action-sheet/type.ts) | N
popupProps | Object | {} | Typescript:`PopupProps`,[Popup API Documents](./popup?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/action-sheet/type.ts) | N
showCancel | Boolean | true | \- | N
showOverlay | Boolean | true | \- | N
theme | String | list | options: list/grid | N
visible | Boolean | false | required。`v-model` and `v-model:visible` is supported | Y
defaultVisible | Boolean | false | required。uncontrolled property | Y
Expand Down
2 changes: 2 additions & 0 deletions src/action-sheet/action-sheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ cancelText | String | - | 设置取消按钮的文本 | N
count | Number | 8 | 设置每页展示菜单的数量,仅当 type=grid 时有效 | N
description | String | - | 动作面板描述文字 | N
items | Array | - | 菜单项。TS 类型:`Array<string \| ActionSheetItem>` `interface ActionSheetItem { label: string; color?: string; disabled?: boolean; icon?: TNode; badge?: BadgeProps }`,[Badge API Documents](./badge?tab=api)。[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts)。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/action-sheet/type.ts) | N
popupProps | Object | {} | 透传 Popup 组件全部属性。TS 类型:`PopupProps`,[Popup API Documents](./popup?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/action-sheet/type.ts) | N
showCancel | Boolean | true | 是否显示取消按钮 | N
showOverlay | Boolean | true | 是否显示遮罩层 | N
theme | String | list | 展示类型,列表和表格形式展示。可选项:list/grid | N
visible | Boolean | false | 必需。显示与隐藏。支持语法糖 `v-model` 或 `v-model:visible` | Y
defaultVisible | Boolean | false | 必需。显示与隐藏。非受控属性 | Y
Expand Down
14 changes: 8 additions & 6 deletions src/action-sheet/action-sheet.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { watch, defineComponent, computed } from 'vue';
import { useDefault } from '../shared';
import TActionSheetList from './action-sheet-list';
import { computed, defineComponent, watch } from 'vue';
import TActionSheetGrid from './action-sheet-grid';
import TPopup from '../popup';
import TActionSheetList from './action-sheet-list';
import TButton from '../button';
import TPopup from '../popup';
import config from '../config';
import { TdActionSheetProps, ActionSheetItem } from './type';
import { useConfig, usePrefixClass } from '../hooks/useClass';
import { useDefault } from '../shared';
import props from './props';
import { usePrefixClass, useConfig } from '../hooks/useClass';
import { ActionSheetItem, TdActionSheetProps } from './type';

const { prefix } = config;

Expand Down Expand Up @@ -114,11 +114,13 @@ export default defineComponent({
};
return (
<TPopup
{...(props.popupProps as TdActionSheetProps['popupProps'])}
visible={currentVisible.value}
placement="bottom"
destroy-on-close={true}
class={actionSheetClass.value}
onClose={handleClose}
showOverlay={props.showOverlay}
>
{root()}
</TPopup>
Expand Down
10 changes: 10 additions & 0 deletions src/action-sheet/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,21 @@ export default {
items: {
type: Array as PropType<TdActionSheetProps['items']>,
},
/** 透传 Popup 组件全部属性 */
popupProps: {
type: Object as PropType<TdActionSheetProps['popupProps']>,
default: () => ({}),
},
/** 是否显示取消按钮 */
showCancel: {
type: Boolean,
default: true,
},
/** 是否显示遮罩层 */
showOverlay: {
type: Boolean,
default: true,
},
/** 展示类型,列表和表格形式展示 */
theme: {
type: String as PropType<TdActionSheetProps['theme']>,
Expand Down
11 changes: 11 additions & 0 deletions src/action-sheet/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* */

import { BadgeProps } from '../badge';
import { PopupProps } from '../popup';
import { TNode } from '../common';

export interface TdActionSheetProps {
Expand Down Expand Up @@ -32,11 +33,21 @@ export interface TdActionSheetProps {
* 菜单项
*/
items?: Array<string | ActionSheetItem>;
/**
* 透传 Popup 组件全部属性
* @default {}
*/
popupProps?: PopupProps;
/**
* 是否显示取消按钮
* @default true
*/
showCancel?: boolean;
/**
* 是否显示遮罩层
* @default true
*/
showOverlay?: boolean;
/**
* 展示类型,列表和表格形式展示
* @default list
Expand Down
Loading