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

Dataviews: "elements" property of field items should be a subproperty of "filterBy" #64635

Closed
juanmaguitar opened this issue Aug 20, 2024 · 3 comments
Labels
[Feature] Data Views Work surrounding upgrading and evolving views in the site editor and beyond [Package] DataViews /packages/dataviews [Type] Enhancement A suggestion for improvement.

Comments

@juanmaguitar
Copy link
Contributor

juanmaguitar commented Aug 20, 2024

What problem does this address?

The elements property and the filterBy property of Dataviews are tightly coupled. In fact, filters are enabled by a field just by passing a proper array of objects to the elements property even when filterBy is empty. From a Developer Experience point of view, I think this is a bit confusing.

What is your proposed solution?

I think it makes more sense for the elements property to be a sub-property of filterBy so it's more naturally understandable that:

  • Filters by a field are "enabled" when the property elements property of filterBy, receives an array of value-label objects
  • Optionally, we can also define operators and isPrimary values

In the meantime, I opened #64633 to clarify this from the docs

cc: @oandregal

@juanmaguitar juanmaguitar added [Type] Enhancement A suggestion for improvement. [Feature] Data Views Work surrounding upgrading and evolving views in the site editor and beyond [Package] DataViews /packages/dataviews labels Aug 20, 2024
@oandregal
Copy link
Member

That's something we considered at the beginning but decided against. The reason for being a standalone property is that it's shared by some features: filtering, but also editing. In the DataForm storybook there's an example that shows how elements power a radio or select control for fields.

@juanmaguitar
Copy link
Contributor Author

I see! Thanks for the clarification @oandregal
That makes sense. I'll close this issue then.

@oandregal
Copy link
Member

Coincidentally, there's this conversation in which we're discussing adding support for having different elements in filter & edit. 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Data Views Work surrounding upgrading and evolving views in the site editor and beyond [Package] DataViews /packages/dataviews [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

2 participants