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

add DisplayItemUtility to centralize static routines #9

Closed
BryanWilhite opened this issue Apr 11, 2019 · 3 comments
Closed

add DisplayItemUtility to centralize static routines #9

BryanWilhite opened this issue Apr 11, 2019 · 3 comments
Assignees

Comments

@BryanWilhite
Copy link
Owner

the first purpose for a DisplayItemUtility is to centralize how grouping (and sorting of groups) happens for MenuDisplayItemModel

@BryanWilhite BryanWilhite self-assigned this Apr 11, 2019
@BryanWilhite
Copy link
Owner Author

one purpose for Selectable.map is to select grouping data that will set the groupId and groupDisplayText properties of Groupable

after a grouping is selected then it is always sorted, ascending or descending

@BryanWilhite
Copy link
Owner Author

BTW: added Groupable.isCollapsed, learning from IndexGroup

BryanWilhite added a commit that referenced this issue Apr 11, 2019
@BryanWilhite
Copy link
Owner Author

BryanWilhite commented Apr 11, 2019

i am pretty sure that this is as close to e=mc**2 as i am going to get:

/**
 * return the data to display a flat list of items
 * as nested groups
 */
public static displayInGroups(items: MenuDisplayItemModel[], groupId?: string | number): MenuDisplayItemModel[] {
    DisplayItemUtility.setGrouping(items, groupId);
    const groups = DisplayItemUtility.group(items, groupId);
    return DisplayItemUtility.nestIntoGroups(groups);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant