Skip to content

Commit

Permalink
feat(Portal): portal support lazy (#2826)
Browse files Browse the repository at this point in the history
* feat(Portal): portal support lazy

* test: fix typescript lint

* chore: delete onSizeDragEnd event

* chore: delete SizeDragLimit

---------

Co-authored-by: Heising <heising@travelconnect.cn>
  • Loading branch information
HaixingOoO and Heising committed Apr 10, 2024
1 parent 9a3567d commit 7e7acd4
Show file tree
Hide file tree
Showing 11 changed files with 178 additions and 1,524 deletions.
6 changes: 3 additions & 3 deletions src/dialog/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const Dialog = forwardRef<DialogInstance, DialogProps>((originalProps, ref) => {
destroyOnClose,
preventScrollThrough,
onCloseBtnClick,
forceRender = false,
...restState
} = state;

Expand Down Expand Up @@ -184,7 +185,7 @@ const Dialog = forwardRef<DialogInstance, DialogProps>((originalProps, ref) => {
in={visible}
appear
timeout={300}
mountOnEnter
mountOnEnter={!forceRender}
unmountOnExit={destroyOnClose}
nodeRef={portalRef}
onEnter={onAnimateStart}
Expand All @@ -198,7 +199,7 @@ const Dialog = forwardRef<DialogInstance, DialogProps>((originalProps, ref) => {
[`${componentCls}__ctx--fixed`]: !showInAttachedElement,
[`${componentCls}__ctx--absolute`]: showInAttachedElement,
})}
style={{ zIndex }}
style={{ zIndex, display: 'none' }}
onKeyDown={handleKeyDown}
tabIndex={0}
>
Expand All @@ -216,7 +217,6 @@ const Dialog = forwardRef<DialogInstance, DialogProps>((originalProps, ref) => {
<CSSTransition
in={visible}
appear
mountOnEnter
timeout={300}
classNames={`${componentCls}-zoom`}
nodeRef={dialogCardRef}
Expand Down
43 changes: 24 additions & 19 deletions src/dialog/dialog.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,48 @@

name | type | default | description | required
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,Typescript:`React.CSSProperties` | N
body | TNode | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
cancelBtn | TNode | - | Typescript:`string \| ButtonProps \| TNode \| null`[Button API Documents](./button?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/dialog/type.ts) | N
closeBtn | TNode | true | Typescript:`string \| boolean \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
confirmBtn | TNode | - | Typescript:`string \| ButtonProps \| TNode \| null`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
footer | TNode | true | Typescript:`boolean \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
header | TNode | true | Typescript:`string \| boolean \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
theme | String | default | options:default/info/warning/danger/success | N
onCancel | Function | | Typescript:`(context: { e: MouseEvent }) => void`<br/> | N
onCloseBtnClick | Function | | Typescript:`(context: { e: MouseEvent }) => void`<br/> | N
onConfirm | Function | | Typescript:`(context: { e: MouseEvent \| KeyboardEvent }) => void`<br/> | N
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


### Dialog Props

name | type | default | description | required
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,Typescript:`React.CSSProperties` | N
className | String | - | className of component | N
style | Object | - | CSS(Cascading Style Sheets),Typescript:`React.CSSProperties` | N
attach | String / Function | - | Typescript:`AttachNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
body | TNode | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
cancelBtn | TNode | - | Typescript:`string \| ButtonProps \| TNode \| null`[Button API Documents](./button?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts)[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/dialog/type.ts) | N
children | TNode | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
closeOnEscKeydown | Boolean | true | \- | N
closeBtn | TNode | true | Typescript:`string \| boolean \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
closeOnEscKeydown | Boolean | true | trigger dialog close event on `ESC` keydown | N
closeOnOverlayClick | Boolean | true | \- | N
confirmBtn | TNode | - | Typescript:`string \| ButtonProps \| TNode \| null`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
confirmLoading | Boolean | undefined | confirm button loading status | N
confirmOnEnter | Boolean | - | confirm on enter | N
destroyOnClose | Boolean | false | \- | N
dialogClassName | String | - | \- | N
draggable | Boolean | false | \- | N
mode | String | modal | options:modal/modeless/full-screen | N
placement | String | top | options:top/center | N
footer | TNode | true | Typescript:`boolean \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
forceRender | Boolean | false | to force render Dialog | N
header | TNode | true | Typescript:`string \| boolean \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
mode | String | modal | options: modal/modeless/full-screen | N
placement | String | top | options: top/center | N
preventScrollThrough | Boolean | true | \- | N
showInAttachedElement | Boolean | false | \- | N
showOverlay | Boolean | true | \- | N
theme | String | default | options: default/info/warning/danger/success | N
top | String / Number | - | \- | N
visible | Boolean | - | \- | N
width | String / Number | - | \- | N
zIndex | Number | - | \- | N
`DialogCardProps` | \- | - | \- | N
onCancel | Function | | Typescript:`(context: { e: MouseEvent }) => void`<br/> | N
onClose | Function | | Typescript:`(context: DialogCloseContext) => void`<br/>[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/dialog/type.ts)。<br/>`type DialogEventSource = 'esc' \| 'close-btn' \| 'cancel' \| 'overlay'`<br/><br/>`interface DialogCloseContext { trigger: DialogEventSource; e: MouseEvent \| KeyboardEvent }`<br/> | N
onCloseBtnClick | Function | | Typescript:`(context: { e: MouseEvent }) => void`<br/> | N
onClosed | Function | | Typescript:`() => void`<br/> | N
onConfirm | Function | | Typescript:`(context: { e: MouseEvent \| KeyboardEvent }) => void`<br/> | N
onEscKeydown | Function | | Typescript:`(context: { e: KeyboardEvent }) => void`<br/> | N
onOpened | Function | | Typescript:`() => void`<br/> | N
onOverlayClick | Function | | Typescript:`(context: { e: MouseEvent }) => void`<br/> | N
Expand All @@ -54,14 +58,15 @@ name | type | default | description | required
attach | String / Function | 'body' | Typescript:`AttachNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
className | String | - | \- | N
style | Object | - | Typescript:`Styles`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
`Omit<DialogProps, 'attach'>` | \- | - | \- | N
`Omit<DialogProps, 'attach'>` | \- | - | extends `Omit<DialogProps, 'attach'>` | N

### DialogInstance

name | params | return | description
-- | -- | -- | --
destroy | \- | \- | required
hide | \- | \- | required
setConfirmLoading | `(loading: boolean)` | \- | required。set confirm button loading status
show | \- | \- | required
update | `(props: DialogOptions)` | \- | required

Expand Down
Loading

0 comments on commit 7e7acd4

Please sign in to comment.