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

[List / List items] Support custom filtering supporting a filter function with a prop #6544

Open
nwhittaker opened this issue Feb 28, 2023 · 20 comments
Assignees
Labels
2 - in development Issues that are actively being worked on. ArcGIS Field Apps Issues logged by ArcGIS Field Apps team members. c-list Issues that pertain to the calcite-list component enhancement Issues tied to a new feature or request. estimate - 5 A few days of work, definitely requires updates to tests. impact - p2 - want for an upcoming milestone User set priority impact status of p2 - want for an upcoming milestone p - medium Issue is non core or affecting less that 60% of people using the library

Comments

@nwhittaker
Copy link
Contributor

nwhittaker commented Feb 28, 2023

Description

A way to opt in to an stripped-down behavior when clicking a list-item that contains nested list-items.

Originally included selection and filtering asks, now placed in two separate issues:

Acceptance Criteria

Filtering a list of items with nested list-items:

  • Parent list-item is visible when it does not match but any leaf items do match.
  • Parent list-item is not visible when it does match but no descendent leaf items match.
  • Parent list-item is not visible when no descendent leaf items match.
  • Consider [calcite-filter] Add support for custom filter function #3454 as part of the upcoming effort

Relevant Info

No response

Which Component

calcite-list-item

Example Use Case

The Field Maps web app would like to use the calcite-list element to display the layers in a map. For group layers, nested layers are shown as child list-items.

Selecting a leaf layer navigates the app for further handling of the layer. However, the app does not provide further handling for group layers. They are treated more like folders that organize sets of layers -- so clicking them in the list should have no effect other than to drill down to leaf layers.

Esri team

ArcGIS Field Apps

@nwhittaker nwhittaker added enhancement Issues tied to a new feature or request. 0 - new New issues that need assignment. needs triage Planning workflow - pending design/dev review. labels Feb 28, 2023
@github-actions github-actions bot added the ArcGIS Field Apps Issues logged by ArcGIS Field Apps team members. label Feb 28, 2023
@nwhittaker nwhittaker changed the title Alternative selection behavior for list-items with children Stripped-down selection behavior for list-items with children Feb 28, 2023
@nwhittaker nwhittaker added the impact - p2 - want for an upcoming milestone User set priority impact status of p2 - want for an upcoming milestone label Mar 8, 2023
@brittneytewks brittneytewks added the need more info Issues that are missing information and/or a clear, actionable description. label Mar 22, 2023
@brittneytewks
Copy link

brittneytewks commented Mar 22, 2023

Scheduling time with FieldApps to understand use case in more depth, will add priority and estimate after discussion

@nwhittaker nwhittaker changed the title Stripped-down selection behavior for list-items with children Stripped-down selection/filtering behavior for list-items with children Mar 22, 2023
@nwhittaker
Copy link
Contributor Author

Added some stripped-down filtering behavior to the issue description that should also be part of any discussion.

@geospatialem geospatialem added 1 - assigned Issues that are assigned to a sprint and a team member. and removed 0 - new New issues that need assignment. labels Mar 29, 2023
@geospatialem geospatialem added design Issues that need design consultation prior to development. and removed needs triage Planning workflow - pending design/dev review. need more info Issues that are missing information and/or a clear, actionable description. labels Apr 24, 2023
@geospatialem
Copy link
Member

Reallocating to the May release for design considerations.

@geospatialem geospatialem added the p - medium Issue is non core or affecting less that 60% of people using the library label May 2, 2023
@ashetland
Copy link

Propose we model the changes to List selection behaviors after what is outlined in issue #6912 for Tree. This likely means adding a children selection mode and modifying the behaviors of single. I've started mocking this up today.

@ashetland
Copy link

ashetland commented May 9, 2023

Selection modes

Final proposal for revising the existing single and multiple selection-modes and adding children and multichildren can be found in this Figma file. See also the image below. This would be consistent with changes to Tree in issue #6912 and pr #6926.

Filtering

Since the parent would still be selectable in children and multichildren, I propose the current filtering behavior be retained for these modes.

For the revised single and multiple, however, the behaviors outlined in the original post should be adopted:

Filtering a list of items with nested list-items:

Parent list-item is visible when it does not match but any leaf items do match.
Parent list-item is not visible when it does match but no descendent leaf items match.
Parent list-item is not visible when no descendent leaf items match.

Nested indentation levels

With these new/revised selection modes, nested indentation behavior should be reconsidered as part of issue #6632.

@nwhittaker, let me know if we've missed anything here.

@ashetland ashetland added ready for dev Issues ready for development implementation. and removed design Issues that need design consultation prior to development. labels May 10, 2023
@ashetland ashetland removed their assignment May 10, 2023
@geospatialem geospatialem added 0 - new New issues that need assignment. and removed 1 - assigned Issues that are assigned to a sprint and a team member. labels May 10, 2023
@geospatialem geospatialem changed the title Stripped-down selection/filtering behavior for list-items with children Stripped-down filtering behavior for list-items with children Dec 28, 2023
@driskull
Copy link
Member

Parent list-item is not visible when it does match but no descendent leaf items match.

This one seems odd to me.

Parent list-item is not visible when no descendent leaf items match.

This should be Parent list-item is not visible when no descendent leaf items match and parent does not match correct?

I think this is how these are already working. Is there a repro where we can see the unexpected scenario?

@geospatialem geospatialem added needs triage Planning workflow - pending design/dev review. need more info Issues that are missing information and/or a clear, actionable description. labels Dec 28, 2023
@geospatialem geospatialem removed this from the 2024-01-17 - Jan Main Release milestone Dec 28, 2023
@nwhittaker
Copy link
Contributor Author

Parent list-item is not visible when it does match but no descendent leaf items match.

This one seems odd to me.

The Example Use Case section should flesh out the reasoning for this behavior. To clarify, our parent list items are group layers which have no actions or selection behaviors (other than open/close) associated with them. As a result, it doesn't make sense for Field Maps to show them in the results if they don't contain any matching leaf layers.

In other words we're interested in finding non-group layers within a nested, or non-nested, layer structure. Groups should fail the filter if it makes them appear to be empty.


Parent list-item is not visible when no descendent leaf items match.

This should be Parent list-item is not visible when no descendent leaf items match and parent does not match correct?

Your edit makes sense in the context of the previous requirement. However, as a standalone requirement, it's more complete to say if none of the descendants match, we want to hide the parent regardless if it itself matches.


It's not narrowly scoped to the requirements of this issue, but I have an old codepen prototype that tests out the list functionality in the context of how we'd be using it. It might be helpful to check out to get a feel for what we're looking to do.

Depending on how specialized our requests are getting, there's certainly flexibility on our end in terms of how declarative the API is. For example, adding support for the hidden attribute to <calcite-list-item> so we can hide it ourselves, if needed.

@driskull
Copy link
Member

driskull commented Jan 2, 2024

For example, adding support for the hidden attribute to so we can hide it ourselves, if needed.

The hidden attribute should already work on list-item's as well as any other component.

I think we could support custom filtering through a property where a user can define their own filter logic by supplying a function. That seems like it would be best to handle all these use cases.

@nwhittaker
Copy link
Contributor Author

nwhittaker commented Jan 2, 2024

The hidden attribute should already work on list-item's as well as any other component.

I did not find that to be the case: https://codepen.io/nwhittaker-esri/pen/MWxaLRp. I'd expect all the list items to be hidden there.

I think we could support custom filtering through a property where a user can define their own filter logic by supplying a function. That seems like it would be best to handle all these use cases.

Yes, I think this approach would work well for us.

@driskull
Copy link
Member

driskull commented Jan 2, 2024

Ah, yeah the filter is removing it. Can you open a separate issue for this? We can fix it by hiding filtered items differently so we are not using the hidden attribute.

@driskull
Copy link
Member

driskull commented Jan 2, 2024

@geospatialem can we repurpose this issue to instead "support custom filtering logic"? Allowing a user to provide a filter function via a property.

@geospatialem geospatialem changed the title Stripped-down filtering behavior for list-items with children [List / List items] Support custom filtering supporting a filter function with a prop Jan 3, 2024
@geospatialem geospatialem added c-list Issues that pertain to the calcite-list component and removed need more info Issues that are missing information and/or a clear, actionable description. labels Jan 3, 2024
@geospatialem geospatialem removed the design Issues that need design consultation prior to development. label May 9, 2024
@geospatialem geospatialem added this to the 2024-12-17 - Dec Release milestone May 28, 2024
@geospatialem geospatialem added estimate - 5 A few days of work, definitely requires updates to tests. and removed needs triage Planning workflow - pending design/dev review. labels May 28, 2024
@driskull driskull self-assigned this Dec 10, 2024
@driskull driskull added 2 - in development Issues that are actively being worked on. and removed 0 - new New issues that need assignment. labels Dec 10, 2024
@driskull
Copy link
Member

@geospatialem @DitwanP what would you expect this custom filter prop on the list to be named?

@geospatialem
Copy link
Member

@geospatialem @DitwanP what would you expect this custom filter prop on the list to be named?

Naming is hard 😅 - was trying to think of a way we could add filter... to the beginning part of the prop name for consistency with other filter props, but came up empty. @driskull Dig the direction you headed with customFilter. 🥇

@nwhittaker
Copy link
Contributor Author

@geospatialem @DitwanP what would you expect this custom filter prop on the list to be named?

Naming is hard 😅 - was trying to think of a way we could add filter... to the beginning part of the prop name for consistency with other filter props, but came up empty. @driskull Dig the direction you headed with customFilter. 🥇

A predicate function is one that always returns true or false. How about filterPredicate?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 - in development Issues that are actively being worked on. ArcGIS Field Apps Issues logged by ArcGIS Field Apps team members. c-list Issues that pertain to the calcite-list component enhancement Issues tied to a new feature or request. estimate - 5 A few days of work, definitely requires updates to tests. impact - p2 - want for an upcoming milestone User set priority impact status of p2 - want for an upcoming milestone p - medium Issue is non core or affecting less that 60% of people using the library
Projects
None yet
Development

No branches or pull requests

7 participants