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 and List Item] Provide list item sorting #6554

Closed
3 tasks done
geospatialem opened this issue Mar 2, 2023 · 11 comments
Closed
3 tasks done

[List and List Item] Provide list item sorting #6554

geospatialem opened this issue Mar 2, 2023 · 11 comments
Assignees
Labels
4 - verified Issues that have been released and confirmed resolved. Calcite (dev) Issues logged by Calcite developers. docs Issues relating to documentation updates only. enhancement Issues tied to a new feature or request. estimate - 8 Requires input from team, consider smaller steps. p - high Issue should be addressed in the current milestone, impacts component or core functionality

Comments

@geospatialem
Copy link
Member

geospatialem commented Mar 2, 2023

Description

Add full parity to the list component, which is provided in the value-list and pick-list components.

May also include a refactor of the sortable utility, which some teams use for their own use and should be consulted if a breaking change is necessary.

Acceptance Criteria

Relevant Info

Part of the #6430 epic

Which Component

  • List
  • List item

Example Use Case

Depicted with value-list and value-list-item:
https://codepen.io/geospatialem/pen/abjxWwL

Esri team

Calcite (dev)

@geospatialem geospatialem 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 Mar 2, 2023
@github-actions github-actions bot added the Calcite (dev) Issues logged by Calcite developers. label Mar 2, 2023
@geospatialem geospatialem added the estimate - 8 Requires input from team, consider smaller steps. label Mar 2, 2023
@geospatialem geospatialem added this to the 2023 June Priorities milestone Mar 2, 2023
@geospatialem geospatialem added 1 - assigned Issues that are assigned to a sprint and a team member. and removed needs triage Planning workflow - pending design/dev review. 0 - new New issues that need assignment. labels Mar 2, 2023
@driskull
Copy link
Member

Before we can tackle this, we should discuss whether we should be using the SortableList component internally here or getting rid of that component.

@geospatialem
Copy link
Member Author

Before we can tackle this, we should discuss whether we should be using the SortableList component internally here or getting rid of that component.

Good idea - added to the upcoming engineering discussion to discuss options.

@driskull
Copy link
Member

We need a whole sorting strategy before we can tackle this. The strategy should cover...

  • Sorting between two separate lists or instances of components
  • Fixing sorting when a child has sorting of its own (currently these are conflicting with list/block/etc)

@geospatialem
Copy link
Member Author

Adding a tag to this issue to Hub components and cc @vivzhang in regards to the issue description above:

May also include a refactor of the sortable utility, which some teams use for their own use and should be consulted if a breaking change is necessary.

@macandcheese
Copy link
Contributor

Adding two pieces of feedback we got about Value List for consideration here w/r/t keyboard usage from this closed issue: #4231

Following up from Teams chat - some improvements to the value list while in drag-enabled mode to make using with a keyboard a bit easier:

Add support for esc to exit that mode (currently only hitting spacebar again exits the mode)
Add support for home / end to quickly move an item to either extent (and preventDefault so the page doesn't scroll up / down)

@Anastasiia-Boleiko
Copy link

Currently, in ArcGIS Urban, we have several use cases of custom lists/accordions that seem to match the List/Block/Accordion component functionality. In several cases, it's a bit difficult to choose a proper Calcite component. I would appreciate your suggestions or perhaps, our cases can turn out into future List component enhancements.

Case 1:

  • List items are not expandable
  • Enhanced content (content-start, content-end slots, actions-end etc)
  • Searchable
  • Actions in the list header (1. Add might be moved into the line with a search; 2. Button to filter the list that expands a popover)

Component:

  • List (seems to fit the needs) + filter and other actions are configured manually using Search, Action, Popover etc.
    image

Case 2:

  • List items are not expandable
  • Enhanced content (content-start, content-end slots, actions-end etc)
  • Reorderable

Component:

  • List (seems to fit the needs, but is a bit hacky)
  • Table ?

Screenshot 2023-04-05 at 18 16 31

Case 3

  • List items are expandable
  • Enhanced content (content-start, content-end slots etc)

Component:

  • List (seems to fit the needs + filter and other actions are configured manually using Search, Action, Popover etc)
  • Block? (no enhanced content)
  • Accordion? (no enhanced content)

image

Case 4

  • Enhanced content (content-start, actions-end slots etc)
  • Draggable (from one list to another)
  • Keyboard support darg&drop

Component:

  • List?
Screen.Recording.2023-04-05.at.19.12.01.mov

driskull added a commit that referenced this issue Jun 3, 2023

Unverified

This user has not yet uploaded their public signing key.
@driskull driskull added the breaking change Issues and pull requests with code changes that are not backwards compatible. label Jun 7, 2023
@driskull
Copy link
Member

driskull commented Jun 7, 2023

@geospatialem @jcfranco we may need to make this one a breaking change.

I'm running into trouble with sorting of children because we slot a <calcite-list-item> inside of another <calcite-list-item> like so:

<calcite-list>
  <calcite-list-item>
    <calcite-list-item></ calcite-list-item>
  </calcite-list-item>
</calcite-list>

In order to fix this, we may need to require the following:

<calcite-list>
  <calcite-list-item>
    <calcite-list>
      <calcite-list-item></ calcite-list-item>
    </calcite-list>
  </calcite-list-item>
</calcite-list>

Let me know if you'd like to meet to discuss this. If we do this breaking change, this milestone may need to change.

@geospatialem
Copy link
Member Author

@driskull Thanks for the heads up on a potential breaking change, lets connect sometime next week. I'll set a reminder for us to chat on next steps.

@geospatialem geospatialem added docs Issues relating to documentation updates only. and removed breaking change Issues and pull requests with code changes that are not backwards compatible. labels Jun 28, 2023
@geospatialem
Copy link
Member Author

Documentation update to follow the change is needed to showcase what devs will need to achieve sorting, which differs from the current workflow.

See Matt's note above, the second example.

@geospatialem geospatialem added the p - high Issue should be addressed in the current milestone, impacts component or core functionality label Jul 3, 2023
driskull added a commit that referenced this issue Aug 2, 2023
**Related Issue:** #6554

## Summary

- SortableComponent
- Moves all configuration options into the interface so a component can
consistently setup SortableJS.
- Changes usage of `onUpdate` to `onSort` for moving between lists and
getting `calciteListOrderChange` event.
- Adds support for `canPut`/`canPull` so users can configure whether an
item can be dragged to another list and vice versa.
- List
  - Sets up sorting
- keyboard sorting only works within a list. Cannot keyboard sort across
lists at this time (including nested lists).
  - Adds dragHandle rendering to `list-item`
- ListItemGroup and List emit an internal event when its default slot
changes in order to update whether an expand caret shows or not.
- Handle
- Updates handle to support displaying ariaLabel (logic taken from
value-list)
- Handle will emit an internal event for parent components to update an
aria-live region.
- No breaking changes necessary. We can advise users to nest another
`calcite-list` to work with sorting on children.
- `calcite-list-item-group` will not be draggable/sortable at this time.
@driskull driskull added 3 - installed Issues that have been merged to master branch and are ready for final confirmation. and removed 1 - assigned Issues that are assigned to a sprint and a team member. labels Aug 2, 2023
@github-actions github-actions bot assigned geospatialem and unassigned driskull Aug 2, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Aug 2, 2023

Installed and assigned for verification.

@geospatialem geospatialem added 4 - verified Issues that have been released and confirmed resolved. and removed 3 - installed Issues that have been merged to master branch and are ready for final confirmation. labels Aug 2, 2023
@geospatialem
Copy link
Member Author

Verified with https://codepen.io/geospatialem/pen/bGQzavG in 1.5.0-next.33. Opened #7426 for finalizing AT support.

benelan pushed a commit that referenced this issue Aug 3, 2023
**Related Issue:** #6554

## Summary

- SortableComponent
- Moves all configuration options into the interface so a component can
consistently setup SortableJS.
- Changes usage of `onUpdate` to `onSort` for moving between lists and
getting `calciteListOrderChange` event.
- Adds support for `canPut`/`canPull` so users can configure whether an
item can be dragged to another list and vice versa.
- List
  - Sets up sorting
- keyboard sorting only works within a list. Cannot keyboard sort across
lists at this time (including nested lists).
  - Adds dragHandle rendering to `list-item`
- ListItemGroup and List emit an internal event when its default slot
changes in order to update whether an expand caret shows or not.
- Handle
- Updates handle to support displaying ariaLabel (logic taken from
value-list)
- Handle will emit an internal event for parent components to update an
aria-live region.
- No breaking changes necessary. We can advise users to nest another
`calcite-list` to work with sorting on children.
- `calcite-list-item-group` will not be draggable/sortable at this time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 - verified Issues that have been released and confirmed resolved. Calcite (dev) Issues logged by Calcite developers. docs Issues relating to documentation updates only. enhancement Issues tied to a new feature or request. estimate - 8 Requires input from team, consider smaller steps. p - high Issue should be addressed in the current milestone, impacts component or core functionality
Projects
None yet
Development

No branches or pull requests

5 participants