
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
@netdata/react-filter-box
Advanced tools
Conditional filter supports OR/AND, bracket, Highlighting, Autocomplete, and high extensibility
React Filter Box
A Simple filter box mainly used to filter data in Grid or Table, which supports Condition AND/OR, and struture Category-operator-Value. This library is inspired by React Structured Filter library, but built completely different based on PEGjs and CodeMirror
For example: Column1 contains value1 AND (Column2 == Ok)
Demo: https://nhabuiduc.github.io
Install react-filter-box using npm.
npm install react-filter-box
Import library, and default stylesheet.
import ReactFilterBox, {AutoCompleteOption,SimpleResultProcessing} from "react-filter-box";
import "react-filter-box/lib/react-filter-box.css"
Demo: https://nhabuiduc.github.io , which includes source code.
Simple case:
import ReactFilterBox, {SimpleResultProcessing} from "react-filter-box";
import "react-filter-box/lib/react-filter-box.css"
export default class App extends React.Component {
constructor(props){
super(props);
this.options = [
{
columnField: "Name",
type:"text"
},
{
columnField: "Description",
type:"text"
},
{
columnField: "Status",
type:"selection" // when using type selection, it will automatically sugest all posible values
},
{
columnText: "Email @",
columnField: "Email",
type:"text"
}
];
}
onParseOk(expressions){
var data = [];
var newData = new SimpleResultProcessing(this.options).process(data,expressions);
//your new data here, which is filtered out of the box by SimpleResultProcessing
}
render(){
return <div className="main-container">
<h2>React Filter Box</h2>
<ReactFilterBox
data={data}
options={this.options}
onParseOk={this.onParseOk.bind(this)}
/>
</div>
}
}
query:string: binding your text to query of Component
options:Option[]: array of option which helps to construct AutoComplete information.
export interface Option {
columnField:string; // required
columnText?:string; // optional
type: string; // require "text" or "selection"
}
data: any[]: (optional) data is used to construct AutoComplete only if you specify in options with type = "selection", which it will show all posibles values get from data
editorConfig: CodeMirror configuration options that will be passed through
to the CodeMirror editor.
See https://codemirror.net/doc/manual.html#config
strictMode: boolean defaults to false. Set to true to enforce that all categories and operators in the filter query are valid based on the options config. This validation is applied after the query is successfully parsed. When the onChange or onParseError events are raised the last argument will indicate if the filter is valid based and also indicate the first invalid item when the validation fails.
onChange(query: String, expressions: Expression[]|Error, validationResult: { isValid: boolean, message?: string }): event raised every change of query, together with expressions if parse is ok, otherwise is error. When strictMode is true, the validiationResult argument will indicate if the filter matches the options config,
interface Expression {
conditionType?: "OR" | "AND";
category?: string;
operator?: string;
value?: string;
expressions?:Expression[];
}
to see more about the structure of Expression which parsed from query, please take a look at: unit test
onParseOk(expressions:Expression[]): event raised when parsing is ok. When strictMode is true, this also indicates that all categories and operators are valid based on the options config.
onParseError(error:Error, validationResult: { isValid: boolean, message?: string }): event raised when parsing error. When strictMode is true, the validiationResult argument will indicate if the filter matches the options config,
customRenderCompletionItem(self:HintResult,data:Completion, registerAndGetPickFunc:Function): ReactComponent: provide your custom AutoComplete Rendering for each Item.
export interface Completion{
value:string | Object; // Your value as text, Object if your custom AutoCompleteHandler return Object
type?:string; // "catetory" or "value" or "operator" or "literal"
}
In default behavior, user will press enter to select an item. But if for example, your component is DatePicker, and you want user to select any date, by clicking on your component, in order to achive that, you must call this method to register with system you want to handle this by yourself.
This method will return another function ** (value:string):void **, which you can call it and provide the value will be inserted into query.
You can look into file demo3.js for detail
autoCompleteHandler: BaseAutoCompleteHandler
yarn start
yarn test
yarn component-package
##License:
MIT
FAQs
Conditional filter supports OR/AND, bracket, Highlighting, Autocomplete, and high extensibility
The npm package @netdata/react-filter-box receives a total of 0 weekly downloads. As such, @netdata/react-filter-box popularity was classified as not popular.
We found that @netdata/react-filter-box demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.