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

fix: Collapse Panel key type definition #17557

Merged
merged 1 commit into from Jul 13, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/collapse/Collapse.tsx
Expand Up @@ -9,8 +9,8 @@ import animation from '../_util/openAnimation';
export type ExpandIconPosition = 'left' | 'right';

export interface CollapseProps {
activeKey?: Array<string> | string;
defaultActiveKey?: Array<string>;
activeKey?: Array<string | number> | string | number;
defaultActiveKey?: Array<string | number> | string | number;
/** 手风琴效果 */
accordion?: boolean;
destroyInactivePanel?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion components/collapse/CollapsePanel.tsx
Expand Up @@ -4,7 +4,7 @@ import classNames from 'classnames';
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';

export interface CollapsePanelProps {
key: string;
key: string | number;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

activeKey and defaultActiveKey also.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's necessary to add the activeKey and the defaultActiveKey here. It should be defined in the Collapse parent component.

header: React.ReactNode;
disabled?: boolean;
className?: string;
Expand Down
6 changes: 3 additions & 3 deletions components/collapse/index.en-US.md
Expand Up @@ -18,8 +18,8 @@ A content area which can be collapsed and expanded.

| Property | Description | Type | Default | Version |
| --- | --- | --- | --- | --- |
| activeKey | Key of the active panel | string\[]\|string | No default value. In `accordion` mode, it's the key of the first panel. | |
| defaultActiveKey | Key of the initial active panel | string | - | |
| activeKey | Key of the active panel | string\[]\|string\| number\[]\|number | No default value. In `accordion` mode, it's the key of the first panel. | |
| defaultActiveKey | Key of the initial active panel | string\[]\|string\| number\[]\|number | - | |
| bordered | Toggles rendering of the border around the collapse block | boolean | `true` | 3.6.5 |
| accordion | If `true`, `Collapse` renders as `Accordion` | boolean | `false` | 3.6.5 |
| onChange | Callback function executed when active panel is changed | Function | - | |
Expand All @@ -34,6 +34,6 @@ A content area which can be collapsed and expanded.
| disabled | If `true`, panel cannot be opened or closed | boolean | `false` | |
| forceRender | Forced render of content on panel, instead of lazy rending after clicking on header | boolean | `false` | 3.2.0 |
| header | Title of the panel | string\|ReactNode | - | |
| key | Unique key identifying the panel from among its siblings | string | - | |
| key | Unique key identifying the panel from among its siblings | string\|number | - | |
| showArrow | If `false`, panel will not show arrow icon | boolean | `true` | 3.1.0 |
| extra | extra element in the corner | ReactNode | - | 3.14.0 |
6 changes: 3 additions & 3 deletions components/collapse/index.zh-CN.md
Expand Up @@ -19,8 +19,8 @@ cols: 1

| 参数 | 说明 | 类型 | 默认值 | 版本 |
| --- | --- | --- | --- | --- |
| activeKey | 当前激活 tab 面板的 key | string\[]\|string | 默认无,accordion 模式下默认第一个元素 | |
| defaultActiveKey | 初始化选中面板的 key | string | 无 | |
| activeKey | 当前激活 tab 面板的 key | string\[]\|string\| number\[]\|number | 默认无,accordion 模式下默认第一个元素 | |
| defaultActiveKey | 初始化选中面板的 key | string\[]\|string\| number\[]\|number | 无 | |
| bordered | 带边框风格的折叠面板 | boolean | `true` | 3.13.0 |
| accordion | 手风琴模式 | boolean | `false` | 3.13.0 |
| onChange | 切换面板的回调 | Function | 无 | |
Expand All @@ -35,6 +35,6 @@ cols: 1
| disabled | 禁用后的面板展开与否将无法通过用户交互改变 | boolean | false | |
| forceRender | 被隐藏时是否渲染 DOM 结构 | boolean | false | 3.2.0 |
| header | 面板头内容 | string\|ReactNode | 无 | |
| key | 对应 activeKey | string | 无 | |
| key | 对应 activeKey | string\|number | 无 | |
| showArrow | 是否展示当前面板上的箭头 | boolean | `true` | 3.13.0 |
| extra | 自定义渲染每个面板右上角的内容 | ReactNode | - | 3.14.0 |