Add `prop` `pickedOrder` for new selected initial order
When selecting a new item for the list, the only option was to have the item pushed to the top. This adds support for two other sorts:
endpushes the item to end of thecontentarrayfunctionif the user defines a function they may control where to push the new itemstartbecomes the default value, keeping the current behavior
Description of the Change
When selecting a new item for the list, depending on the value of pickedOrder new item is pushed on the array of content according to its value.
startbecomes the default value, keeping the current behaviorendpushes the item to end of thecontentarrayfunctionif user defined a function they may control where to push the new item
As mentioned, keeping the default value at start avoids breaking the current behavior.
Closes #125
Alternate Designs
I considered only using a boolean value alone with a prop like pickedOrderEnd, only to negate the current behavior when needed, but the current approach seems more versatile. Also, adding the option for a function allows the user reach for control of how this is done in some specific cases (e.g. always pushing in alphabetical order).
Possible Drawbacks
Given the default behavior is kept, I don't see any at the moment.
Verification Process
I've only done manual testing, but am hoping to open this for feedback, especially for the prop name (propInitialOrder, maybe?).
Will do some unit testing/e2e depending on how #124 is reviewed (they change the same components and it would be nice to reduce conflicts).
Checklist:
- [x] I have read the CONTRIBUTING document.
- [x] My code follows the code style of this project.
- [x] My change requires a change to the documentation.
- [x] I have updated the documentation accordingly.
- [ ] I have added tests to cover my change.
- [ ] All new and existing tests passed.
Changelog Entry
Credits
Props @xipasduarte