Skip to content

refactor(sort): state should be determined and provided by container #15171

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

Closed
wants to merge 1 commit into from

Conversation

andrewseguin
Copy link
Contributor

@andrewseguin andrewseguin commented Feb 12, 2019

Refactors MatSort and MatSortHeader so that they are not tightly coupled.

Currently, the sort header determines its state by accessing properties from the MatSort such as active and direction to determine if it is sorted. This means that MatSort cannot be replaced by something like a multi-sort container.

This change changes the interaction so that the MatSortHeader requests its state from the container and there is a simple contract that the container needs to follow to be replaced.

Note that this is the first of three phases needed to get us towards having a MatMultiSort. The conversation can be found here #13538. Thanks to @relair for making the foundation for this feature

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Feb 12, 2019
@andrewseguin andrewseguin added the target: patch This PR is targeted for the next patch release label Feb 12, 2019
/** Whether to disable clearing the sorting state. */
disableClear: boolean;
/** State provided to a `MatSortable`, includes the current `MatSort` active sortable. */
export interface MatSortSortableState extends SortableState {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This name is a bit...repetitive.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but it may be more valuable to keep it description. In the future there will be things like MatMultiSortSortableState.

Options:
MatSortableState/MatMultiSortableState
MatSortState/MatMultiSortState

_stateChanges: Observable<void>;

/** Registers the sortable so that it can be sorted. */
register(sortable: MatSortable): void;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking over the code, I'm starting to now think we should move some of this to the cdk.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 Let's chat

@andrewseguin andrewseguin added target: major This PR is targeted for the next major release and removed target: patch This PR is targeted for the next patch release labels Feb 13, 2019
@mmalerba mmalerba added aaa and removed aaa labels Apr 25, 2019
@andrewseguin andrewseguin force-pushed the sort-refactor branch 5 times, most recently from 2687434 to 898cc55 Compare May 13, 2019 22:47
@FirstVertex

This comment has been minimized.

@jheut
Copy link

jheut commented Sep 23, 2019

@andrewseguin Will @crisbeto be able to review this PR soon, or should the review be passed to someone who does have time?

@andrewseguin
Copy link
Contributor Author

This was de-prioritized behind our work on test harnesses and MDC integration. To move forward, we're still pending a final design discussion to make sure this is the right route for us to go. I'd love to get it in but unfortunately we're limited on resources

@wagnermaciel
Copy link
Contributor

@andrewseguin I ran into this while triaging PRs and found this old PR. Was this ever discussed / any updates?

@andrewseguin
Copy link
Contributor Author

@wagnermaciel We wanted to figure out a solid design plan for this but unfortunately it just never got prioritized. We could discuss it as a team to decide if we want to move forward on it or just let it close

@andrewseguin andrewseguin removed the cla: yes PR author has agreed to Google's Contributor License Agreement label Dec 29, 2021
@andrewseguin
Copy link
Contributor Author

Adding this PR as a reference in our backlog item for CDK Sort; closing until we have the effort prioritized

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Apr 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants