Separation of values and display text of multiple choice input components
@petyabegovska is already working on this.
Since Mar 31, 2023.
- Dominant language
- TypeScript
- Stars
- 1.8k
- Forks
- 285
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 59
Description
Feature Request Description
In the inputs of this type: <ui5-cb-item text="Item 1"></ui5-cb-item> where the text attribute is used for both visualisation and as an object passed to the change event. It would be nice to have a separate value attribute where we can pass a value to be passed to the change event when an item visualised using the text attribute is selected. This also applies to other similar components like multi combo box and checkbox.
The feature is related to whitespace visualisation in the mentioned components. We faced an issue with displaying multiple spaces in them and worked around that by implementing similar behaviour to the described one outside the component. If that feature is present we will be able to do something of the sort: <ui5-cb-item text="space-escaped-value" value="actual-value"></ui5-cb-item> and not handle this outside the component.
While that problem is a pretty minor use of the requested feature some pretty neat possibilities open up with such a separation.
Proposed Solution
a separate value attribute where we can pass a value to be passed to the change event when an item visualised using the text attribute is selected. This also applies to other similar components like multi combo box
Proposed Alternatives
Accept a transform function which can be applied to the given object in the text attribute before visualisation.
Additional Context
A similar feature can be seen implemented in https://primefaces.org/primeng/showcase/#/dropdown and more precisely the options, optionLabel, optionValue attributes, which provide the same feature that is being requested. While the example is currently advanced, when the framework was greener it was pretty close to the current request.
Priority
- Low
- Medium
- High
- Very High
A workaround is currently implemented so the feature isn't urgent.
Stakeholder Info (if applicable)
- Organization: SAP
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.