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

component values primitive or anything #3752

Open
cherepanov opened this issue Apr 21, 2024 · 2 comments
Open

component values primitive or anything #3752

cherepanov opened this issue Apr 21, 2024 · 2 comments

Comments

@cherepanov
Copy link

cherepanov commented Apr 21, 2024

In rsuite where are three ways to pass values

  • primite
  • generic ItemDataType
  • eventKey/activeKey

Let's consider the Dropdown/Select components family.

Currently, ItemDataType and eventKey/activeKey can be anything, either primitive or object.

The documentation states that the value can only be a string, which is not accurate according to the implementation.

Comparison is made via shallowEqual, checking values only at the first level.

Is this the intended behavior in RSuite? If so, which components should also adhere to this?

Use case here to avoid data-mapping with complex shaped-objects and pass them as is.

Passing objects as values is common thing, most ui-kits handle this. Demo

Eventually i'd like to see it in RSuire as documented feature. If this is not intended implementation should be fixed.

SelectPicker
ItemDataType[]
value - indicated as string only

InputPicker
ItemDataType[]
value - indicated as string only

DropDown
activeKey/eventKey - indicated as sting only

@simonguo
Copy link
Member

Hi @cherepanov, we recommend using the string type for value and eventKey. For the sake of accessibility, the value of ItemDataType.value is set to the input element and ARIA attributes in some components. I will fix the definition of ItemDataType later.

@cherepanov
Copy link
Author

Are there any plans to alter this behavior? I initially found that some code using this feature does not work with RSuite versions below 5.50, even though it was supposed to be a documented feature.

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

No branches or pull requests

2 participants