All Projects → TarikHuber → material-ui-filter

TarikHuber / material-ui-filter

Licence: other
Material UI Drawer for filtering local arrays

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to material-ui-filter

logi-filter-builder
advanced SQL filter builder. Demo:
Stars: ✭ 23 (-46.51%)
Mutual labels:  material-ui, filter
arcade-manager
Arcade management tool to handle your MAME/FBA romsets
Stars: ✭ 104 (+141.86%)
Mutual labels:  filter
Smartlist
Smartlist's a free home inventory and finance tracker to help you overcome financial struggle.
Stars: ✭ 1 (-97.67%)
Mutual labels:  material-ui
java-web-servlet-filter
OpenTracing Java Web Servlet Filter Instrumentation
Stars: ✭ 20 (-53.49%)
Mutual labels:  filter
unbound-dns-firewall
DNS-Firewall Python script for UNBOUND
Stars: ✭ 23 (-46.51%)
Mutual labels:  filter
reagent-material-ui
Reagent wrapper for MUI (formerly Material UI) v5
Stars: ✭ 149 (+246.51%)
Mutual labels:  material-ui
nested-task-list-mobx-react
A nested task list prototype built with React + MobX and Material-ui
Stars: ✭ 25 (-41.86%)
Mutual labels:  material-ui
jellex
TUI to filter JSON and JSON Lines data with Python syntax
Stars: ✭ 41 (-4.65%)
Mutual labels:  filter
mui-kotlin
Kotlin/JS support for Material-UI
Stars: ✭ 25 (-41.86%)
Mutual labels:  material-ui
spark-ar-creators
List of 9500 (and counting) Spark AR Creators. Open an issue or contact me if you want to be added.❤️
Stars: ✭ 122 (+183.72%)
Mutual labels:  filter
gatsby-wiki
Creating a Knowledgbase using Gatsby.js and React.js (see final product ->
Stars: ✭ 32 (-25.58%)
Mutual labels:  material-ui
dynamic-table
Dynamic Table jQuery Plug-in - A table that can be sorted, filtered and edited, similar to common spreadsheet application.
Stars: ✭ 26 (-39.53%)
Mutual labels:  filter
react-textinput-chip
React library to generate textinput chip.
Stars: ✭ 14 (-67.44%)
Mutual labels:  material-ui
SOUL-VA
The SOUL Virtual Analog Library
Stars: ✭ 45 (+4.65%)
Mutual labels:  filter
filter
Go语言的数据过滤包,由 数据输入、格式化、校验、输出 几个部份组成。
Stars: ✭ 22 (-48.84%)
Mutual labels:  filter
dl-model
Dragalia Lost Model Viewer
Stars: ✭ 30 (-30.23%)
Mutual labels:  material-ui
uv-index
This is a work-in-progress (🔧️) ultraviolet index viewer app for demonstrating Instant Apps + Kotlin + Dagger + MVP
Stars: ✭ 64 (+48.84%)
Mutual labels:  material-ui
hojetem.live
🎶Curated live concerts from famous Brazilian artists.
Stars: ✭ 44 (+2.33%)
Mutual labels:  material-ui
iirj
An efficient IIR filter library written in JAVA
Stars: ✭ 95 (+120.93%)
Mutual labels:  filter
praxis
Social networking platform built with Next.js, Apollo GraphQL, and Prisma
Stars: ✭ 37 (-13.95%)
Mutual labels:  material-ui

material-ui-filter

Build Status Dependency Status License Code Coverage Code Style

This project was bootstrapped with nwb

Material UI filter is a filter drawer that lets you filter any Array. You can sort the array and add as many filters as you please.

Just try out the DEMO. You can find the full code of the demo in the 'demo' folder above.

(Demo data generated with: http://www.json-generator.com/).

Table of Contents

Features

Material UI filter allows you to filter and sort arrays. The filter currently supports

  • strings
  • dates
  • booleans

Implementation

We will use code snippets from the demo project to explain how to implement the filter:

The first step is to install the filter:

npm install material-ui-filter

Then you have to import the filter:

import { FilterDrawer, filterSelectors, filterActions } from 'material-ui-filter'

After that you have to add the filter component to the rest of your components in the render function.

The filter takes a few props:

  • name: Name of the filter
  • fields: An array of the properties you want to filter/ sort by. The array should consist of objects with at least a name property. Additionally you can add a label and a datatype for each property. The standard datatype is string. Other possible datatypes are bool and date.
  • locale, DateTimeFormat, okLabel, cancelLabel: Will be forwarded to the DatePicker.
const filterFields = [
  { name: 'name', label: 'Name' },
  { name: 'email', label: 'Email' },
  { name: 'registered', label: 'Registered', type: 'date' },
  { name: 'isActive', label: 'Is Active', type: 'bool' },
];
<FilterDrawer
  name={'demo'}
  fields={filterFields}

  //localising the DatePicker
  locale={'de-DE'}
  DateTimeFormat={global.Intl.DateTimeFormat}
  okLabel="OK"
  cancelLabel="Abbrechen"
/>

In your mapStateToProps function you have to set the filter props and filter the array.

The getFilteredList function takes the following parameters:

  • filter name
  • filters
  • array
  • A function to get the array values (eg. If your array value is in an Object.)
const { hasFilters } = filterSelectors.selectFilterProps('demo', filters);
const list = filterSelectors.getFilteredList('demo', filters, source /*, fieldValue => fieldValue.val*/);

And last but not least you have to add the reducer to your combineReducers function to make it work with your store.

import { filterReducer } from '../../src'

const reducers = combineReducers({
  //your other reducers
  filters: filterReducer
})

export default reducers

For more information feel free to play around with the DEMO.

Contributors

Tarik Huber (https://github.com/TarikHuber)

Maximilian Pichler (https://github.com/MaximilianPichler)

License

MIT @TarikHuber & @MaximilianPichler

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].