Skip to content

Commit

Permalink
feat: (Tabs-like) add destroyOnClose props to Tabs.Tab
Browse files Browse the repository at this point in the history
  • Loading branch information
awmleer committed Feb 28, 2022
1 parent 5a9d665 commit 1fe3d86
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 38 deletions.
2 changes: 2 additions & 0 deletions src/components/capsule-tabs/capsule-tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export type CapsuleTabProps = {
title: ReactNode
disabled?: boolean
forceRender?: boolean
destroyOnClose?: boolean
} & NativeProps

export const CapsuleTab: FC<CapsuleTabProps> = () => {
Expand Down Expand Up @@ -114,6 +115,7 @@ export const CapsuleTabs: FC<CapsuleTabsProps> = props => {
key={pane.key}
active={active}
forceRender={pane.props.forceRender}
destroyOnClose={pane.props.destroyOnClose}
>
<div
className={`${classPrefix}-content`}
Expand Down
13 changes: 7 additions & 6 deletions src/components/capsule-tabs/index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@

## CapsuleTabs.Tab

| Name | Description | Type | Default |
| ----------- | ------------------------------------------------- | ----------- | ------- |
| key | Corresponding to `activeKey` | `string` | - |
| title | The displayed text of the tab header | `ReactNode` | - |
| disabled | Whether to disable the tab | `boolean` | `false` |
| forceRender | Whether to render the `DOM` structure when hidden | `boolean` | `false` |
| Name | Description | Type | Default |
| -------------- | ------------------------------------------------- | ----------- | ------- |
| key | Corresponding to `activeKey` | `string` | - |
| title | The displayed text of the tab header | `ReactNode` | - |
| disabled | Whether to disable the tab | `boolean` | `false` |
| forceRender | Whether to render the `DOM` structure when hidden | `boolean` | `false` |
| destroyOnClose | Unmount content when not visible | `boolean` | `false` |
13 changes: 7 additions & 6 deletions src/components/capsule-tabs/index.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@

## CapsuleTabs.Tab

| 属性 | 说明 | 类型 | 默认值 |
| ----------- | --------------------------- | ----------- | ------- |
| key | 对应 `activeKey` | `string` | - |
| title | 选项卡头显示文字 | `ReactNode` | - |
| disabled | 是否禁用 | `boolean` | `false` |
| forceRender | 被隐藏时是否渲染 `DOM` 结构 | `boolean` | `false` |
| 属性 | 说明 | 类型 | 默认值 |
| -------------- | --------------------------- | ----------- | ------- |
| key | 对应 `activeKey` | `string` | - |
| title | 选项卡头显示文字 | `ReactNode` | - |
| disabled | 是否禁用 | `boolean` | `false` |
| forceRender | 被隐藏时是否渲染 `DOM` 结构 | `boolean` | `false` |
| destroyOnClose | 不可见时卸载内容 | `boolean` | `false` |
15 changes: 8 additions & 7 deletions src/components/jumbo-tabs/index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@

## JumboTabs.Tab

| Name | Description | Type | Default |
| ----------- | ------------------------------------------------- | ----------- | ------- |
| key | Corresponding to `activeKey` | `string` | - |
| title | The displayed text of the tab header | `ReactNode` | - |
| description | The description text | `ReactNode` | - |
| disabled | Whether to disable the tab | `boolean` | `false` |
| forceRender | Whether to render the `DOM` structure when hidden | `boolean` | `false` |
| Name | Description | Type | Default |
| -------------- | ------------------------------------------------- | ----------- | ------- |
| key | Corresponding to `activeKey` | `string` | - |
| title | The displayed text of the tab header | `ReactNode` | - |
| description | The description text | `ReactNode` | - |
| disabled | Whether to disable the tab | `boolean` | `false` |
| forceRender | Whether to render the `DOM` structure when hidden | `boolean` | `false` |
| destroyOnClose | Unmount content when not visible | `boolean` | `false` |
15 changes: 8 additions & 7 deletions src/components/jumbo-tabs/index.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@

## JumboTabs.Tab

| 属性 | 说明 | 类型 | 默认值 |
| ----------- | --------------------------- | ----------- | ------- |
| key | 对应 `activeKey` | `string` | - |
| title | 选项卡头显示文字 | `ReactNode` | - |
| description | 选项卡描述 | `ReactNode` | - |
| disabled | 是否禁用 | `boolean` | `false` |
| forceRender | 被隐藏时是否渲染 `DOM` 结构 | `boolean` | `false` |
| 属性 | 说明 | 类型 | 默认值 |
| -------------- | --------------------------- | ----------- | ------- |
| key | 对应 `activeKey` | `string` | - |
| title | 选项卡头显示文字 | `ReactNode` | - |
| description | 选项卡描述 | `ReactNode` | - |
| disabled | 是否禁用 | `boolean` | `false` |
| forceRender | 被隐藏时是否渲染 `DOM` 结构 | `boolean` | `false` |
| destroyOnClose | 不可见时卸载内容 | `boolean` | `false` |
2 changes: 2 additions & 0 deletions src/components/jumbo-tabs/jumbo-tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export type JumboTabProps = {
description: ReactNode
disabled?: boolean
forceRender?: boolean
destroyOnClose?: boolean
} & NativeProps

export const JumboTab: FC<JumboTabProps> = () => {
Expand Down Expand Up @@ -120,6 +121,7 @@ export const JumboTabs: FC<JumboTabsProps> = props => {
key={pane.key}
active={active}
forceRender={pane.props.forceRender}
destroyOnClose={pane.props.destroyOnClose}
>
<div
className={`${classPrefix}-content`}
Expand Down
13 changes: 7 additions & 6 deletions src/components/tabs/index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@

## Tabs.Tab

| Name | Description | Type | Default |
| ----------- | ------------------------------------------------- | ----------- | ------- |
| key | Corresponding to `activeKey` | `string` | - |
| title | The displayed text of the tab header | `ReactNode` | - |
| disabled | Whether to disable the tab | `boolean` | `false` |
| forceRender | Whether to render the `DOM` structure when hidden | `boolean` | `false` |
| Name | Description | Type | Default |
| -------------- | ------------------------------------------------- | ----------- | ------- |
| key | Corresponding to `activeKey` | `string` | - |
| title | The displayed text of the tab header | `ReactNode` | - |
| disabled | Whether to disable the tab | `boolean` | `false` |
| forceRender | Whether to render the `DOM` structure when hidden | `boolean` | `false` |
| destroyOnClose | Unmount content when not visible | `boolean` | `false` |

## FAQ

Expand Down
13 changes: 7 additions & 6 deletions src/components/tabs/index.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@

## Tabs.Tab

| 属性 | 说明 | 类型 | 默认值 |
| ----------- | --------------------------- | ----------- | ------- |
| key | 对应 `activeKey` | `string` | - |
| title | 选项卡头显示文字 | `ReactNode` | - |
| disabled | 是否禁用 | `boolean` | `false` |
| forceRender | 被隐藏时是否渲染 `DOM` 结构 | `boolean` | `false` |
| 属性 | 说明 | 类型 | 默认值 |
| -------------- | --------------------------- | ----------- | ------- |
| key | 对应 `activeKey` | `string` | - |
| title | 选项卡头显示文字 | `ReactNode` | - |
| disabled | 是否禁用 | `boolean` | `false` |
| forceRender | 被隐藏时是否渲染 `DOM` 结构 | `boolean` | `false` |
| destroyOnClose | 不可见时卸载内容 | `boolean` | `false` |

## FAQ

Expand Down
2 changes: 2 additions & 0 deletions src/components/tabs/tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export type TabProps = {
title: ReactNode
disabled?: boolean
forceRender?: boolean
destroyOnClose?: boolean
} & NativeProps

export const Tab: FC<TabProps> = () => {
Expand Down Expand Up @@ -295,6 +296,7 @@ export const Tabs: FC<TabsProps> = p => {
key={pane.key}
active={active}
forceRender={pane.props.forceRender}
destroyOnClose={pane.props.destroyOnClose}
>
<div
className={`${classPrefix}-content`}
Expand Down

0 comments on commit 1fe3d86

Please sign in to comment.