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鈥檒l 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

fix: Collapse Panel key type definition #17557

merged 1 commit into from Jul 13, 2019

Conversation

thylsky
Copy link
Contributor

@thylsky thylsky commented Jul 9, 2019

馃 This is a ...

  • New feature
  • Bug fix
  • Site / document update
  • Component style update
  • TypeScript definition update
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

馃懟 What's the background?

  1. Describe the source of requirement, like related issue link.
    Currently the allowed key for the Collapse.Panel is just string.

  2. Describe the problem and the scenario.
    When you are rendering Collapse.Panel with map function, you can't simply provide just index of the map function. Also React's definition for Key type is number | string.

馃挕 Solution

  1. How to fix the problem, and list final API implementation and usage sample if that is an new feature.
    Fix is prepared in this PR: Changing type definition of the key props.

馃摑 Changelog

Language Changelog
馃嚭馃嚫 English
馃嚚馃嚦 Chinese

鈽戯笍 Self Check before Merge

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

View rendered components/collapse/index.en-US.md
View rendered components/collapse/index.zh-CN.md

@netlify
Copy link

netlify bot commented Jul 9, 2019

Deploy preview for ant-design ready!

Built with commit 3ba28db

https://deploy-preview-17557--ant-design.netlify.com

@thylsky thylsky changed the title Patch 1 Collapse Panel key type definition Jul 9, 2019
@thylsky thylsky changed the title Collapse Panel key type definition feat: Collapse Panel key type definition Jul 10, 2019
@thylsky thylsky changed the title feat: Collapse Panel key type definition fix: Collapse Panel key type definition Jul 10, 2019
@dengfuping
Copy link
Contributor

@thylsky Remember to rebase it.

@thylsky
Copy link
Contributor Author

thylsky commented Jul 11, 2019

@thylsky Remember to rebase it.

Fixed. 馃憤

@codecov
Copy link

codecov bot commented Jul 11, 2019

Codecov Report

Merging #17557 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #17557   +/-   ##
=======================================
  Coverage   96.04%   96.04%           
=======================================
  Files         267      267           
  Lines        7430     7430           
  Branches     2061     2034   -27     
=======================================
  Hits         7136     7136           
  Misses        292      292           
  Partials        2        2
Impacted Files Coverage 螖
components/collapse/CollapsePanel.tsx 100% <酶> (酶) 猬嗭笍

Continue to review full report at Codecov.

Legend - Click here to learn more
螖 = absolute <relative> (impact), 酶 = not affected, ? = missing data
Powered by Codecov. Last update 756ded9...9372d26. Read the comment docs.

@codecov
Copy link

codecov bot commented Jul 11, 2019

Codecov Report

Merging #17557 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #17557   +/-   ##
=======================================
  Coverage   96.04%   96.04%           
=======================================
  Files         267      267           
  Lines        7430     7430           
  Branches     2061     2034   -27     
=======================================
  Hits         7136     7136           
  Misses        292      292           
  Partials        2        2
Impacted Files Coverage 螖
components/collapse/CollapsePanel.tsx 100% <酶> (酶) 猬嗭笍

Continue to review full report at Codecov.

Legend - Click here to learn more
螖 = absolute <relative> (impact), 酶 = not affected, ? = missing data
Powered by Codecov. Last update e49707c...3ba28db. Read the comment docs.

@dengfuping
Copy link
Contributor

@thylsky activeKey and defaultActiveKey should be same with key.
image

@thylsky
Copy link
Contributor Author

thylsky commented Jul 12, 2019

@thylsky activeKey and defaultActiveKey should be same with key.
image

@dengfuping Good catch, thanks! Resolved.

@@ -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.

components/collapse/Collapse.tsx Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants