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

Allow multiple: true for expandable sections #22965

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

karwosts
Copy link
Contributor

@karwosts karwosts commented Nov 23, 2024

Proposed change

Allow setting multiple: true for an expandable section, which would mean that that section now behaves like a group of selectors, with user allowed to submit multiple copies of the data requested by the section.

Backend PR: home-assistant/core#131393

Based on a concept idea by Frenck: home-assistant/core#121857 (comment)

Example: entering datapoint pairs, where the user can submit a list, and each list item is two numbers:

mutli-section

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue or discussion:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

@karwosts karwosts marked this pull request as ready for review November 24, 2024 22:23
@karwosts karwosts changed the title WIP: Arrays of sections for config flows Allow multiple: true for expandable sections Nov 24, 2024
@piitaya
Copy link
Member

piitaya commented Nov 25, 2024

Should we create dedicated selector for that instead of reusing the expandable one? I already attempted something like that but without success.
I would propose a UX like we have for badges in heading card.

CleanShot 2024-11-25 at 14 31 47

So we can add/edit/delete/reorder. Also, we should be able to define the title of each group (by using one of the nested field value?) because for now, we have the same title (data point) for each section.

@karwosts
Copy link
Contributor Author

Should we create dedicated selector for that instead of reusing the expandable one?

Is the issue here that you specifically want this to be a Selector instead of a form element, or is the issue just that I've overloaded this form element with too much optional code (and to call it a different form element name/.ts file)? I'm a little puzzled how to make this into a Selector, given that it's really just an empty container for other Selectors. I'm not quite sure what change that would look like on both the backend and frontend side, but this current implementation felt kind of natural to me since it felt very similar to the concept we already invented for sections.

I would propose a UX like...

What is the intention of the pencil button, we are already in a options dialog here, does that open a new popup dialog over the existing popup dialog? I kind of liked having everything viewable at once, but that's just my personal opinion.

So we can ...reorder

I guess reorder handles could be added to any UI, not sure if that is needed in this iteration though?

Also, we should be able to define the title of each group (by using one of the nested field value?)

I guess if we had a child selector with the magic name title we could inherit that is the section title. I'm not sure if there are use cases yet for this though. If we just have arrays of data I'm not sure why each array element would need a different name. The current concept use case for this was for entering pairs of unnamed decimal pairs for compensation. I would be curious about what other use cases could come up in the future.

@bramkragten bramkragten added the Needs UX Pull requests requiring a review from the Home Assistant design team label Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed Needs UX Pull requests requiring a review from the Home Assistant design team wait for backend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants