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

feat(sort): add props for custom sorting #329

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

jxn-30
Copy link
Contributor

@jxn-30 jxn-30 commented Sep 8, 2023

This is a feature proposal that adresses #177

The following new props have been added:

  • sort-function
  • multi-sort-function

sort-function

takes the following arguments:

  • a: Item
  • b: Item
  • sortBy: string
  • sortDesc: boolean
  • getItemValue: typeof getItemValueFn
  • defaultSortFunction: (a: Item, b: Item) => number

it should return a number, if a nullish (undefined and null) is returned, the default sort function will automatically be applied.

multi-sort-function

takes the following arguments:

  • sortByArr: string[]
  • sortDescArr: boolean[]
  • itemsToSort: Item[]
  • index: number

it should return an Item[] (Array of Item-Objects). There is no "fallback to default if undefined returned" as for sort-function to allow more controll over the sorting.

Copy link
Contributor

@mrhammadasif mrhammadasif left a comment

Choose a reason for hiding this comment

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

Change of Coding Style is not recommended. Also, why do we have change in package-lock.json file?

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

Successfully merging this pull request may close these issues.

None yet

2 participants