-
Notifications
You must be signed in to change notification settings - Fork 373
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
modified table controls to recognize titles in table properties #1650
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution 👍
I took a first look:
- Please remove the
console.log
- You don't need to change any version numbers as we handle them with our release process
- Please don't remove tests. Here it shows that the contributed code can't handle array objects without properties, crashing JSON Forms.
- Please add tests for the new functionality
68304ea
to
a6ad666
Compare
bd49883
to
1199482
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked over the code and suggested changes to support empty titles as well as to simplify the code. It would be great if you could also add some testcases.
@@ -109,6 +114,7 @@ const generateCells = ( | |||
schema, | |||
rowPath, | |||
cellPath: rowPath, | |||
title: schema.title ? schema.title : '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
title: schema.title ? schema.title : '', | |
title |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable 'title' that was previously declared in the conditional above is out of scope here. But maybe props that aren't objects don't need titles?
85c7c0b
to
dc16e2d
Compare
@@ -73,6 +73,40 @@ const fixture = { | |||
] | |||
}; | |||
|
|||
const fixture2 = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added because editing 'fixture' caused another test to fail, I didn't want to change any other tests.
@@ -96,6 +96,7 @@ const generateCells = ( | |||
const props = { | |||
propName: prop, | |||
schema, | |||
title: schema.properties?.[prop]?.title ?? startCase(prop), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now that this conditional is just one line (thank you for teaching me new syntax!) I don't think it needs to be a variable anymore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for the contribution!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
This is intended to address this issue: #1610 (Table column should respect 'title' #1610)