2.0.2 • Published 2 years ago

react-filter-editor v2.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

React-Filter-Editor 🔎

Documentation

React Filter Editor Docs V1.3.3

Getting Started 🚀

$ npm install react-filter-editor

Integration

import React, { useState } from 'react';
import FilterEditor from 'react-filter-editor';

 
const options = [{ name:"name", label:"Name", fieldType: "text" }];

const App = () => {
	const [values, setValues] = useState({name: ""});

	return (
		<FilterEditor options={options} values={values} onChangeValues={setValues}/>
	);
}

Import component for Bootstrap v5

import FilterEditor from 'react-filter-editor/lib/bootstrap';

Documentation V2.0

attributestypedescription
valuesobject
optionsArray object
onChangeValuesFunctionfunction to return select value (data) => void;
getDataFunctionfunction to query all data
setVisibleValueFunction Callbackfunction options to return tag value
configButtonsObject
classNameStringparent ClassName
optionsComponentJSX Elementrender options in dropdown

values

{name: "", age: 30, pets: ["Firulais", "Toby", "Martita"]}

options

   [
     {
          label:"Person Name", 
          styles: {color: "red"},
          value:"name", 
          icon: "fas fa-user", 
          fieldType?: select || text || number || date, 
          fieldComponent?:({onChange, data, onEditField, onDisableEditMode}) => JSX.Element
      }
   ]

setVisibleValue

function callback

({label, name, value, fieldType}) => return string;

configButtons

icons work with fontAwesome

{
    add: {
	    icon: string
	    text: string
    }, 
    remove: {
	    icon?: string, 
	    text?: string,
	    removeComponent?: ({onAction}) => return JXS.Element
    }, 
    filterActive: {
	    icon?: string
	    filterActiveComponent?: ({onAction}) => return JXS.Element
    }, 
    filterDisabled: {
	    icon?: string
	    filterDisabledComponent?: ({onAction}) => return JXS.Element
	}
}

optionsComponent

render options in dropdown the component brings the following properties: onAddFilter and options, to the onAddFilter function you have to pass the name as an attribute

const OptionsRender = ({onAddFilter, options}) => {
 return (....)
}

Contributors 👽

Code Contributors

jpprogrammer

andresceccoli

Financial Contributors

License

Licensed under MIT

1.3.3

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago