Class

SortMenu

SortMenu(props) → {React.ReactElement}

Constructor

# new SortMenu(props) → {React.ReactElement}

Overview

Displays categories and orders to sort by. Categories are stored inside a virtualized list.
Parameters:
Name Type Attributes Description
props Object

Any other props will be forwarded to the Menu component.

ContentProps Object <optional>

Props applied to content elements.

ContentProps.categories Array.<Object> <optional>

The array of categories to sort by.

ContentProps.categories[].label string <optional>

The label of a category.

ContentProps.categories[].value string <optional>

The value of a category.

ContentProps.chooseOrder boolean <optional>

If true choosing order will be enabled.

ContentProps.onCategoryChange function <optional>

The callback fired when category was changed.

ContentProps.onOrderChange function <optional>

The callback fired when order was changed.

ContentProps.order "asc" | "desc" <optional>

The currently selected order.

ContentProps.RadioComponent React.ReactNode <optional>

The component used to render radio button elements.

ContentProps.rowHeight number | string <optional>

The height of a row in the virtualized radio button group.

ContentProps.value string <optional>

The currently selected category.

View Source Utils/Menus/SortMenu/SortMenu.js, line 71

React.ReactElement

Methods

# static compareValues(key, orderopt) → {function}

Overview

Compares property values from sorted objects.
Parameters:
Name Type Attributes Default Description
key string

The value of a property from sorted objects.

order "asc" | "desc" <optional>
"asc"

The order of sorting.

View Source Utils/Menus/SortMenu/sortFunctions/compareValues.js, line 10

  • The function that compares objects.
function

# static createCategories(categories, noneLabelopt, noneValueopt) → {Array.<Object>}

Overview

Creates categories where labels and values are the same.
Parameters:
Name Type Attributes Default Description
categories Array.<string>

The array of strings that will be used as labels and values.

noneLabel string <optional>
"none"

The label used to reset filtration.

noneValue string <optional>
""

The value associated with noneLabel.

View Source Utils/Menus/SortMenu/utilFunctions/createCategories.js, line 13

  • The array of categories.
Array.<Object>

# static createFullCategories(labels, values, noneLabelopt, noneValueopt) → {Array.<Object>}

Overview

Creates an array of "label-value" pairs that represent categories used to sort given data set. Values should be unique. Labels don't have this restriction.
Parameters:
Name Type Attributes Default Description
labels Array.<string>

The array of labels used to sort a given set of data.

values Array.<string>

The array of values associated with label.

noneLabel string <optional>
"none"

The label used to reset filtration.

noneValue string <optional>
""

The value associated with noneLabel.

View Source Utils/Menus/SortMenu/utilFunctions/createFullCategories.js, line 13

  • The array of categories.
Array.<Object>

# static simpleSort(objects, category, order) → {Array.<Object>}

Overview

Sorts an array of given objects by category in given order. Uses compareValues to compare objects.
Parameters:
Name Type Description
objects Array.<Object>

The array of objects that is going to be sorted.

category string

The name of a property to sort by.

order "asc" | "desc"

The order of sorting.

View Source Utils/Menus/SortMenu/sortFunctions/simpleSort.js, line 14

  • Sorted array of objects.
Array.<Object>