|
1 |
| -# React-Filter-Editor 🔎 |
2 |
| -### Documentation |
3 |
| -[React Filter Editor Docs ](https://storybook--hilarious-dieffenbachia-334eae.netlify.app/?path=/story/installation--page) |
4 | 1 |
|
5 |
| -## Getting Started 🚀 |
| 2 | + |
| 3 | + |
| 4 | +# React-Filter-Editor 🔎 |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | +### Documentation |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | +[React Filter Editor Docs V1.3.3 ](https://storybook--hilarious-dieffenbachia-334eae.netlify.app/?path=/story/installation--page) |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | +## Getting Started 🚀 |
| 19 | + |
| 20 | + |
| 21 | + |
6 | 22 | ```
|
7 | 23 | $ npm install react-filter-editor
|
8 |
| -$ yarn add react-filter-editor |
9 | 24 | ```
|
10 |
| -## Integration |
11 |
| -``` |
12 |
| - import React, { useState } from 'react'; |
13 |
| - import FilterEditor from 'react-filter-editor'; |
| 25 | + |
14 | 26 |
|
15 |
| - const options = [{ name:"name", label:"Name", fieldType: "text" }]; |
| 27 | + |
| 28 | +## Integration |
| 29 | + |
16 | 30 |
|
17 |
| - const App = () => { |
| 31 | + |
| 32 | +``` |
| 33 | +import React, { useState } from 'react'; |
| 34 | +import FilterEditor from 'react-filter-editor'; |
| 35 | +
|
| 36 | + |
| 37 | +const options = [{ name:"name", label:"Name", fieldType: "text" }]; |
| 38 | +
|
| 39 | +const App = () => { |
18 | 40 | const [values, setValues] = useState({name: ""});
|
19 |
| - return ( |
20 |
| - <FilterEditor options={options} values={values} onChangeValues={setValues}/> |
21 |
| - ); |
22 |
| - } |
| 41 | +
|
| 42 | + return ( |
| 43 | + <FilterEditor options={options} values={values} onChangeValues={setValues}/> |
| 44 | + ); |
| 45 | +} |
23 | 46 | ```
|
24 |
| -## Import component for Bootstrap v5 |
| 47 | + |
| 48 | +## Import component for Bootstrap v5 |
| 49 | + |
| 50 | + |
| 51 | + |
25 | 52 | ```
|
26 |
| - import FilterEditor from 'react-filter-editor/lib/bootstrap'; |
| 53 | +import FilterEditor from 'react-filter-editor/lib/bootstrap'; |
27 | 54 | ```
|
28 |
| -## Contributors 👽 |
29 |
| -### Code Contributors |
| 55 | + |
| 56 | +## Documentation V2.0 |
| 57 | + |
| 58 | +| attributes | type | description | |
| 59 | +|--|--|--| |
| 60 | +| values | object | |
| 61 | +| options | Array object | |
| 62 | +| onChangeValues | Function | function to return select value (data) => void; | |
| 63 | +| getData | Function | function to query all data | |
| 64 | +| setVisibleValue | Function Callback | function options to return tag value | |
| 65 | +| configButtons | Object | |
| 66 | +| className | String | parent ClassName | |
| 67 | +| optionsComponent | JSX Element | render options in dropdown | |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | +### values |
| 72 | + |
| 73 | + {name: "", age: 30, pets: ["Firulais", "Toby", "Martita"]} |
| 74 | + |
| 75 | +### options |
| 76 | + |
| 77 | + [ |
| 78 | + { |
| 79 | + label:"Person Name", |
| 80 | + styles: {color: "red"}, |
| 81 | + value:"name", |
| 82 | + icon: "fas fa-user", |
| 83 | + fieldType?: select || text || number || date, |
| 84 | + fieldComponent?:({onChange, data, onEditField, onDisabledEditMode}) => JSX.Element |
| 85 | + } |
| 86 | + ] |
| 87 | + |
| 88 | +### setVisibleValue |
| 89 | +function callback |
| 90 | + |
| 91 | + ({label, name, value, fieldType}) => return string; |
| 92 | + |
| 93 | +### configButtons |
| 94 | + |
| 95 | +icons work with [fontAwesome](https://fontawesome.com/icons) |
| 96 | + |
| 97 | + |
| 98 | + { |
| 99 | + add: { |
| 100 | + icon: string |
| 101 | + text: string |
| 102 | + }, |
| 103 | + remove: { |
| 104 | + icon?: string, |
| 105 | + text?: string, |
| 106 | + removeComponent?: ({onAction}) => return JXS.Element |
| 107 | + }, |
| 108 | + filterActive: { |
| 109 | + icon?: string |
| 110 | + filterActiveComponent?: ({onAction}) => return JXS.Element |
| 111 | + }, |
| 112 | + filterDisabled: { |
| 113 | + icon?: string |
| 114 | + filterDisabledComponent?: ({onAction}) => return JXS.Element |
| 115 | + } |
| 116 | + } |
| 117 | + |
| 118 | +### optionsComponent |
| 119 | +render options in dropdown |
| 120 | +the component brings the following properties: onAddFilter and options, |
| 121 | +to the **onAddFilter** function you have to pass the name as an attribute |
| 122 | + |
| 123 | + |
| 124 | + const OptionsRender = ({onAddFilter, options}) => { |
| 125 | + return (....) |
| 126 | + } |
| 127 | + |
| 128 | + |
| 129 | + |
| 130 | +## Contributors 👽 |
| 131 | + |
| 132 | + |
| 133 | + |
| 134 | +### Code Contributors |
| 135 | + |
| 136 | + |
| 137 | + |
30 | 138 | 
|
| 139 | + |
| 140 | + |
| 141 | + |
31 | 142 | 
|
32 |
| -### Financial Contributors |
33 |
| -<img src="https://app.sitrack.io/static/media/sitrack_color.22c61360.svg" alt="drawing" style="width:200px;"/> |
34 | 143 |
|
35 |
| -## License |
| 144 | + |
| 145 | + |
| 146 | +### Financial Contributors |
| 147 | + |
| 148 | + |
| 149 | + |
| 150 | +<img src="https://app.sitrack.io/static/media/sitrack_color.22c61360.svg" alt="drawing" style="width:200px;"/> |
| 151 | + |
| 152 | + |
| 153 | + |
| 154 | + |
| 155 | + |
| 156 | +## License |
| 157 | + |
| 158 | + |
| 159 | + |
| 160 | + |
36 | 161 |
|
37 | 162 | Licensed under MIT
|
0 commit comments