-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: Add more overloads for SelectField options. #999
Conversation
`getOptionValue` is not necessary for options with ids or codes. `getOptionLabel` is not necessary for options with name, displayName, or labels.
2b9d512
to
d8c118c
Compare
{ code: AuthorHeight.SHORT, name: "Shortish" }, | ||
{ code: AuthorHeight.TALL, name: "Tallish" }, |
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.
lol
} | ||
|
||
export function defaultOptionLabel<O>(opt: O): any { | ||
if (typeof opt !== "object" || !opt) fail(`Option ${opt} has no id or code`); |
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.
hmm... how destructive would it be to allow strings. Like, I'd like to be able to do
options={["One", "Two", "Three"]}
// or
options={Object.values(SomeEnum)}
where ID/Val would be the same. Seems unnecessary to map an Enum over to an Object just for the sake of this. But, I'm sure a lot of infra expects an Object so makes sense it would be rough to support.
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.
Yeah, that's a fair ask. Will think about it...
## [2.335.0](v2.334.3...v2.335.0) (2024-02-05) ### Features * Add more overloads for SelectField options. ([#999](#999)) ([0663afe](0663afe))
🎉 This PR is included in version 2.335.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
getOptionValue
is now optional foroptions
with ids or codes.getOptionLabel
is now optional foroptions
with name, displayName, or labels.