Skip to content

Commit b83d51e

Browse files
RSS1102tdesign-bot
andauthored
feat(Dialog): enhance dialogClassName prop to support multiple formats (#4096)
* feat(Dialog): enhance `dialogClassName` prop to support multiple formats * chore: stash changelog [ci skip] --------- Co-authored-by: tdesign-bot <[email protected]>
1 parent c02237c commit b83d51e

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

packages/components/dialog/Dialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ const Dialog = forwardRef<DialogInstance, DialogProps>((originalProps, ref) => {
297297
ref={dialogCardRef}
298298
{...restState}
299299
mode={mode}
300-
className={dialogClassName}
300+
className={classNames(dialogClassName)}
301301
style={{ ...style, width: pxCompat(width || style?.width) }}
302302
onConfirm={onConfirm}
303303
onCancel={handleCancel}

packages/components/dialog/dialog.en-US.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ confirmBtn | TNode | - | Typescript: `string \| ButtonProps \| TNode \| null`。
2828
confirmLoading | Boolean | undefined | confirm button loading status | N
2929
confirmOnEnter | Boolean | - | confirm on enter | N
3030
destroyOnClose | Boolean | false | \- | N
31-
dialogClassName | String | - | \- | N
31+
dialogClassName | String / Object / Array | - | The class name for the popover content section, supporting multiple formats: string (e.g., `'name1 name2 name3'`), array (e.g., `['name1', 'name2']`), or array of objects (e.g., `[{ 'name1': true }]`)。Typescript: `ClassName`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/common.ts) | N
3232
draggable | Boolean | false | not effective in `full-screen` mode | N
3333
footer | TNode | true | Typescript: `boolean \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/common.ts) | N
3434
header | TNode | true | Typescript: `string \| boolean \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/common.ts) | N

packages/components/dialog/dialog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ confirmBtn | TNode | - | 确认按钮。值为 null 则不显示确认按钮。
4949
confirmLoading | Boolean | undefined | 确认按钮加载状态 | N
5050
confirmOnEnter | Boolean | - | 是否在按下回车键时,触发确认事件 | N
5151
destroyOnClose | Boolean | false | 是否在关闭弹框的时候销毁子元素 | N
52-
dialogClassName | String | - | 弹框元素类名,示例:'t-class-dialog-first t-class-dialog-second' | N
52+
dialogClassName | String / Object / Array | - | 内容部分的类名,支持多种格式:字符串(例如 `'name1 name2 name3'`)、数组(例如 `['name1', 'name2']`)或对象数组(例如 `[{ 'name1': true }]`)。TS 类型:`ClassName`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/common.ts) | N
5353
draggable | Boolean | false | 是否可以拖拽(对全屏对话框无效) | N
5454
footer | TNode | true | 底部操作栏,默认会有“确认”和“取消”两个按钮。值为 true 显示默认操作按钮,值为 false 不显示任何内容,值类型为 Function 表示自定义底部内容。TS 类型:`boolean \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/common.ts) | N
5555
header | TNode | true | 头部内容。值为 true 显示空白头部,值为 false 不显示任何内容,值类型为 string 则直接显示值,值类型为 Function 表示自定义头部内容。TS 类型:`string \| boolean \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/common.ts) | N

packages/components/dialog/type.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import { KeyboardEvent, MouseEvent } from 'react';
88
import { ButtonProps } from '../button';
9-
import { AttachNode, Styles, TNode } from '../common';
9+
import { AttachNode, ClassName, Styles, TNode } from '../common';
1010

1111
export interface TdDialogProps {
1212
/**
@@ -56,10 +56,9 @@ export interface TdDialogProps {
5656
*/
5757
destroyOnClose?: boolean;
5858
/**
59-
* 弹框元素类名,示例:'t-class-dialog-first t-class-dialog-second'
60-
* @default ''
59+
* 内容部分的类名,支持多种格式:字符串(例如 `'name1 name2 name3'`)、数组(例如 `['name1', 'name2']`)或对象数组(例如 `[{ 'name1': true }]`)
6160
*/
62-
dialogClassName?: string;
61+
dialogClassName?: ClassName;
6362
/**
6463
* 是否可以拖拽(对全屏对话框无效)
6564
* @default false
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
pr_number: 4096
3+
contributor: RSS1102
4+
---
5+
6+
- feat(Dialog): 增强 `dialogClassName` 属性以支持多种格式 @RSS1102 ([#4096](https://github.com/Tencent/tdesign-react/pull/4096))

0 commit comments

Comments
 (0)