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(Dialog): add DialogCard #553

Merged
merged 5 commits into from
Feb 15, 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
Binary file modified db/TDesign.db
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name | type | default | description | required
-- | -- | -- | -- | --
className | String | - | className of component | N
style | Object | - | CSS(Cascading Style Sheets),Typescript:`React.CSSProperties` | N
`Pick<DialogProps, 'body' \| 'cancelBtn' \| 'closeBtn' \| 'confirmBtn' \| 'footer' \| 'header' \| 'theme' \| 'onCancel' \| 'onCloseBtnClick' \| 'onConfirm'>` | TNode | - | extends `Pick<DialogProps, 'body' \| 'cancelBtn' \| 'closeBtn' \| 'confirmBtn' \| 'footer' \| 'header' \| 'theme' \| 'onCancel' \| 'onCloseBtnClick' \| 'onConfirm'>`。Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
`Pick<DialogProps, 'body' \| 'cancelBtn' \| 'closeBtn' \| 'confirmBtn' \| 'footer' \| 'header' \| 'theme' \| 'onCancel' \| 'onCloseBtnClick' \| 'onConfirm' \| 'confirmLoading'>` | TNode | - | extends `Pick<DialogProps, 'body' \| 'cancelBtn' \| 'closeBtn' \| 'confirmBtn' \| 'footer' \| 'header' \| 'theme' \| 'onCancel' \| 'onCloseBtnClick' \| 'onConfirm' \| 'confirmLoading'>`。Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N


### Dialog Props
Expand Down
2 changes: 1 addition & 1 deletion packages/products/tdesign-react/src/dialog/dialog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
`Pick<DialogProps, 'body' \| 'cancelBtn' \| 'closeBtn' \| 'confirmBtn' \| 'footer' \| 'header' \| 'theme' \| 'onCancel' \| 'onCloseBtnClick' \| 'onConfirm'>` | TNode | - | 继承 `Pick<DialogProps, 'body' \| 'cancelBtn' \| 'closeBtn' \| 'confirmBtn' \| 'footer' \| 'header' \| 'theme' \| 'onCancel' \| 'onCloseBtnClick' \| 'onConfirm'>` 中的全部属性。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
`Pick<DialogProps, 'body' \| 'cancelBtn' \| 'closeBtn' \| 'confirmBtn' \| 'footer' \| 'header' \| 'theme' \| 'onCancel' \| 'onCloseBtnClick' \| 'onConfirm' \| 'confirmLoading'>` | TNode | - | 继承 `Pick<DialogProps, 'body' \| 'cancelBtn' \| 'closeBtn' \| 'confirmBtn' \| 'footer' \| 'header' \| 'theme' \| 'onCancel' \| 'onCloseBtnClick' \| 'onConfirm' \| 'confirmLoading'>` 中的全部属性。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N


### Dialog Props
Expand Down
1 change: 1 addition & 0 deletions packages/products/tdesign-react/src/dialog/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ export interface TdDialogCardProps
| 'onCancel'
| 'onCloseBtnClick'
| 'onConfirm'
| 'confirmLoading'
> {}

export interface DialogOptions extends Omit<TdDialogProps, 'attach'> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,53 @@
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TdDialogCardProps } from '../dialog/type';
import { PropType } from 'vue';

export default {
/** 对话框内容 */
body: {
type: [String, Function] as PropType<TdDialogCardProps['body']>,
},
/** 取消按钮,可自定义。值为 null 则不显示取消按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性。使用 TNode 自定义按钮时,需自行控制取消事件 */
cancelBtn: {
type: [String, Object, Function] as PropType<TdDialogCardProps['cancelBtn']>,
},
/** 关闭按钮,可以自定义。值为 true 显示默认关闭按钮,值为 false 不显示关闭按钮。值类型为 string 则直接显示值,如:“关闭”。值类型为 TNode,则表示呈现自定义按钮示例 */
closeBtn: {
type: [String, Boolean, Function] as PropType<TdDialogCardProps['closeBtn']>,
default: true as TdDialogCardProps['closeBtn'],
},
/** 确认按钮。值为 null 则不显示确认按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性。使用 TNode 自定义按钮时,需自行控制确认事件 */
confirmBtn: {
type: [String, Object, Function] as PropType<TdDialogCardProps['confirmBtn']>,
default: true as TdDialogCardProps['confirmBtn'],
},
/** 确认按钮加载状态 */
confirmLoading: Boolean,
/** 底部操作栏,默认会有“确认”和“取消”两个按钮。值为 true 显示默认操作按钮,值为 false 不显示任何内容,值类型为 Function 表示自定义底部内容 */
footer: {
type: [Boolean, Function] as PropType<TdDialogCardProps['footer']>,
default: true as TdDialogCardProps['footer'],
},
/** 头部内容。值为 true 显示空白头部,值为 false 不显示任何内容,值类型为 string 则直接显示值,值类型为 Function 表示自定义头部内容 */
header: {
type: [String, Boolean, Function] as PropType<TdDialogCardProps['header']>,
default: true as TdDialogCardProps['header'],
},
/** 对话框风格 */
theme: {
type: String as PropType<TdDialogCardProps['theme']>,
default: 'default' as TdDialogCardProps['theme'],
validator(val: TdDialogCardProps['theme']): boolean {
if (!val) return true;
return ['default', 'info', 'warning', 'danger', 'success'].includes(val);
},
},
/** 如果“取消”按钮存在,则点击“取消”按钮时触发,同时触发关闭事件 */
onCancel: Function as PropType<TdDialogCardProps['onCancel']>,
/** 点击右上角关闭按钮时触发 */
onCloseBtnClick: Function as PropType<TdDialogCardProps['onCloseBtnClick']>,
/** 如果“确认”按钮存在,则点击“确认”按钮时触发,或者键盘按下回车键时触发 */
onConfirm: Function as PropType<TdDialogCardProps['onConfirm']>,
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

name | type | default | description | required
-- | -- | -- | -- | --
`Pick<DialogProps, 'body' \| 'cancelBtn' \| 'closeBtn' \| 'confirmBtn' \| 'footer' \| 'header' \| 'theme' \| 'onCancel' \| 'onCloseBtnClick' \| 'onConfirm'>` | String / Slot / Function | - | extends `Pick<DialogProps, 'body' \| 'cancelBtn' \| 'closeBtn' \| 'confirmBtn' \| 'footer' \| 'header' \| 'theme' \| 'onCancel' \| 'onCloseBtnClick' \| 'onConfirm'>`。Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/packages/components/common.ts) | N
`Pick<DialogProps, 'body' \| 'cancelBtn' \| 'closeBtn' \| 'confirmBtn' \| 'footer' \| 'header' \| 'theme' \| 'onCancel' \| 'onCloseBtnClick' \| 'onConfirm' \| 'confirmLoading'>` | String / Slot / Function | - | extends `Pick<DialogProps, 'body' \| 'cancelBtn' \| 'closeBtn' \| 'confirmBtn' \| 'footer' \| 'header' \| 'theme' \| 'onCancel' \| 'onCloseBtnClick' \| 'onConfirm' \| 'confirmLoading'>`。Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/packages/components/common.ts) | N


### Dialog Props
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
`Pick<DialogProps, 'body' \| 'cancelBtn' \| 'closeBtn' \| 'confirmBtn' \| 'footer' \| 'header' \| 'theme' \| 'onCancel' \| 'onCloseBtnClick' \| 'onConfirm'>` | String / Slot / Function | - | 继承 `Pick<DialogProps, 'body' \| 'cancelBtn' \| 'closeBtn' \| 'confirmBtn' \| 'footer' \| 'header' \| 'theme' \| 'onCancel' \| 'onCloseBtnClick' \| 'onConfirm'>` 中的全部属性。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/packages/components/common.ts) | N
`Pick<DialogProps, 'body' \| 'cancelBtn' \| 'closeBtn' \| 'confirmBtn' \| 'footer' \| 'header' \| 'theme' \| 'onCancel' \| 'onCloseBtnClick' \| 'onConfirm' \| 'confirmLoading'>` | String / Slot / Function | - | 继承 `Pick<DialogProps, 'body' \| 'cancelBtn' \| 'closeBtn' \| 'confirmBtn' \| 'footer' \| 'header' \| 'theme' \| 'onCancel' \| 'onCloseBtnClick' \| 'onConfirm' \| 'confirmLoading'>` 中的全部属性。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/packages/components/common.ts) | N


### Dialog Props
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ export interface TdDialogCardProps
| 'onCancel'
| 'onCloseBtnClick'
| 'onConfirm'
| 'confirmLoading'
> {}

export interface DialogOptions extends Omit<TdDialogProps, 'attach'> {
Expand Down
48 changes: 48 additions & 0 deletions packages/products/tdesign-vue/src/dialog/dialog-card-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,53 @@
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TdDialogCardProps } from '../dialog/type';
import { PropType } from 'vue';

export default {
/** 对话框内容 */
body: {
type: [String, Function] as PropType<TdDialogCardProps['body']>,
},
/** 取消按钮,可自定义。值为 null 则不显示取消按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性。使用 TNode 自定义按钮时,需自行控制取消事件 */
cancelBtn: {
type: [String, Object, Function] as PropType<TdDialogCardProps['cancelBtn']>,
},
/** 关闭按钮,可以自定义。值为 true 显示默认关闭按钮,值为 false 不显示关闭按钮。值类型为 string 则直接显示值,如:“关闭”。值类型为 TNode,则表示呈现自定义按钮示例 */
closeBtn: {
type: [String, Boolean, Function] as PropType<TdDialogCardProps['closeBtn']>,
default: true,
},
/** 确认按钮。值为 null 则不显示确认按钮。值类型为字符串,则表示自定义按钮文本,值类型为 Object 则表示透传 Button 组件属性。使用 TNode 自定义按钮时,需自行控制确认事件 */
confirmBtn: {
type: [String, Object, Function] as PropType<TdDialogCardProps['confirmBtn']>,
default: true,
},
/** 确认按钮加载状态 */
confirmLoading: Boolean,
/** 底部操作栏,默认会有“确认”和“取消”两个按钮。值为 true 显示默认操作按钮,值为 false 不显示任何内容,值类型为 Function 表示自定义底部内容 */
footer: {
type: [Boolean, Function] as PropType<TdDialogCardProps['footer']>,
default: true,
},
/** 头部内容。值为 true 显示空白头部,值为 false 不显示任何内容,值类型为 string 则直接显示值,值类型为 Function 表示自定义头部内容 */
header: {
type: [String, Boolean, Function] as PropType<TdDialogCardProps['header']>,
default: true,
},
/** 对话框风格 */
theme: {
type: String as PropType<TdDialogCardProps['theme']>,
default: 'default' as TdDialogCardProps['theme'],
validator(val: TdDialogCardProps['theme']): boolean {
if (!val) return true;
return ['default', 'info', 'warning', 'danger', 'success'].includes(val);
},
},
/** 如果“取消”按钮存在,则点击“取消”按钮时触发,同时触发关闭事件 */
onCancel: Function as PropType<TdDialogCardProps['onCancel']>,
/** 点击右上角关闭按钮时触发 */
onCloseBtnClick: Function as PropType<TdDialogCardProps['onCloseBtnClick']>,
/** 如果“确认”按钮存在,则点击“确认”按钮时触发,或者键盘按下回车键时触发 */
onConfirm: Function as PropType<TdDialogCardProps['onConfirm']>,
};
2 changes: 1 addition & 1 deletion packages/products/tdesign-vue/src/dialog/dialog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
`Pick<DialogProps, 'body' \| 'cancelBtn' \| 'closeBtn' \| 'confirmBtn' \| 'footer' \| 'header' \| 'theme' \| 'onCancel' \| 'onCloseBtnClick' \| 'onConfirm'>` | String / Slot / Function | - | 继承 `Pick<DialogProps, 'body' \| 'cancelBtn' \| 'closeBtn' \| 'confirmBtn' \| 'footer' \| 'header' \| 'theme' \| 'onCancel' \| 'onCloseBtnClick' \| 'onConfirm'>` 中的全部属性。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N
`Pick<DialogProps, 'body' \| 'cancelBtn' \| 'closeBtn' \| 'confirmBtn' \| 'footer' \| 'header' \| 'theme' \| 'onCancel' \| 'onCloseBtnClick' \| 'onConfirm' \| 'confirmLoading'>` | String / Slot / Function | - | 继承 `Pick<DialogProps, 'body' \| 'cancelBtn' \| 'closeBtn' \| 'confirmBtn' \| 'footer' \| 'header' \| 'theme' \| 'onCancel' \| 'onCloseBtnClick' \| 'onConfirm' \| 'confirmLoading'>` 中的全部属性。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N


### Dialog Props
Expand Down
3 changes: 2 additions & 1 deletion packages/products/tdesign-vue/src/dialog/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ export interface TdDialogCardProps
| 'onCancel'
| 'onCloseBtnClick'
| 'onConfirm'
| 'confirmLoading'
> {}

export interface DialogOptions extends Omit<TdDialogProps, 'attach'> {
Expand Down Expand Up @@ -232,4 +233,4 @@ export type DialogMethod = (options?: DialogOptions) => DialogInstance;

export type DialogConfirmMethod = (options?: DialogOptions) => DialogInstance;

export type DialogAlertMethod = (options?: Omit<DialogOptions, 'cancelBtn'>) => DialogInstance;
export type DialogAlertMethod = (options?: Omit<DialogOptions, 'cancelBtn'>) => DialogInstance;
Loading