1.1.0 • Published 10 months ago

pg-filters v1.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
10 months ago

pg-filters

Functions

searchData

Filters data by using a single search string and matching its value with all the filters. Only uses Textand Number filters.

ParameterTypeUsage
dataany[]List of objects that need to be filtered.
filtersFilter[]List of filters that will be used to filter data.
searchstringWhat the user entered in the search box.

filterData

Filters data by using the filters.

ParameterTypeUsage
dataany[]List of objects that need to be filtered.
filtersFilter[]List of filters that will be used to filter data.

getActiveFilters

Returns all the filters that have a value.

ParameterTypeUsage
filtersFilter[]Filters to be evaluated.

resetFilters

Resets the value of the filters to their original state.

ParameterTypeUsage
filtersFilter[]Filters to be reset.

restoreFiltersFromStorage

Restores filters from a JSON storage, converting each field to its original state.

ParameterTypeUsage
storagestringJSON storage.

Filter Object

FieldUsageRequired
fieldMust match the field name inside the filtered object.
labelUsed to show the filter's name to the user.
inputTypeSpecifies the type of input that the user will interact with. Available types are Text, Number, Dropdown, MultiSelect, Calendar, CalendarRange and Checkbox
filterTypeSpecifies the method that will be used to filter.
valueUsed to compare values with the filtered object. User input goes there.
optionsUsed to populate a filter with options. Should only be used with Dropdown and MultiSelect.
emptySets the empty value to be matched with when filtering using Dropdown and MultiSelect.
categoryUsed to group fields together in a form.

Filter Types

Input TypeAssociated Filter TypesDefault
Number, CalendarLess, LessOrEqual, Equal, GreaterOrEqual, Greater.Equal
CheckboxTrue, False.True
1.1.0

10 months ago

1.0.2

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago