Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
react-npm-table-data-set
Advanced tools
A react component to display data in a table format, using a bootstrap 3 style
A React component to display data in a table format, using a bootstrap 3 style.
A react component to display data in a table format, using a bootstrap 3 style.(Wrapper component for: https://react-bootstrap.github.io/components.html#tables)
let data = {
rows: [
['foo', 'bar', 'baz'],
['a', 'b', 'c']
]
};
<TableDataSet params={data} />;
This is a full params object in all it's glory. See details about each key below.
{
"header": "This is a table of people and their ages",
"columns": {
"titles": [
{
"name": "First Name",
"sortable": true
},
{
"name": "Last Name",
"sortable": false
},
{
"name": "Age",
"sortable": true
}
],
"components": [
{},
{},
{
"name": "NumericLabel",
"params": {
"justification": "R"
}
}
]
},
"rows": [
[
"Cam",
"Stuart",
43
],
[
"Deepak",
"Khandelwal",
28
]
],
"styling": {
"bs3": [
"responsive",
"striped",
"condensed",
"hover",
"bordered"
],
"common": {
"fontFamilyCss": "'Consolas', 'Courier', monospace;",
"fontSizeCss": "100%",
"textTransformCss": "uppercase;"
},
"header": {
"fontSizeCss": "150%",
"backgroundCss": "#0093D0"
},
"titles": {
"fontSizeCss": "120%",
"backgroundCss": "#999999"
}
},
"pagination": {}
}
An optional table caption that is a full width cell containing a heading of the table. If this key is not present, then no heading is displayed
This part of the params object defines the behavior of the columns
An optional array of column titles, displayed as <th>
elements. If this key is not present then there are no titles
An optional array of objects specifying react component names and parameters to be used when rendering the cell.
Passing null
, undefined
or {}
(empty object) means no component will be used, and the cell will display it's data as is
currently this package support following component
A required array of rows, containing an array of rows
This part of the params object defines the styling of the table
See also: https://react-bootstrap.github.io/components.html#tables
An array bootstrap 3 style and behaviour to be passed into the react-bootstrap
table. EG:
"bs3": [
"condensed",
"hover",
"bordered"
]
Would result in:
<Table condensed hover bordered>...</Table>
An optional object of common css styling to be applied across the entire table. The example above are the default values to be used
The font type / family
Any css text transformations
Font css values such as percentage, pixels, ect.
Styling for the header
Styling for the title
An optional object specifying pagination behavior.
import React,{Component} from 'react';
import ReactDOM from 'react-dom';
import TableDataSet from 'react-npm-table-data-set'
class App extends Component {
constructor(props){
super(props);
}
render() {
let data = {
"header": "This is a table of people and their ages",
"columns": {
"titles": [
{
"name": "First Name",
"sortable": true
},
{
"name": "Last Name",
"sortable": false
},
{
"name": "Age",
"sortable": true
},
{
"name": "Status",
"sortable": false
},
],
"components": [
{},
{},
{
"name": "NumericLabel",
"params": {
"justification": "R"
}
},
{
"name": "ResultStatusLabel",
"params": {
'bgColorMap' : {
'pass' : '#3cb521',
'ok' : '#3cb521',
'fail' : '#474949',
'alert' : '#d47500',
'inc' : '#3cb521',
'flag' : '#474949',
'label' : '#ffffff'
},
'textColorMap' : {
'pass' : '#ffffff',
'ok' : '#ffffff',
'fail' : '#ffffff',
'alert' : '#ffffff',
'inc' : '#cd0200',
'flag' : '#ffffff',
'label' : '#ffffff'
},
}
}
]
},
"rows": [
['Cam', 'Stuart', 43,'ok'],
['Deepak', 'Khandelwal', 25,'ok'],
['Shweta', 'Fatnani', 27,'ok'],
['Raunak', 'Singh', 20,'ok'],
['Shifali', 'Baghel', 19,'fail'],
['Santosh', 'Saini', 26,'ok'],
['Vivek', 'Kumar', 26,'ok'],
['Raunak', 'Kumar', 20,'ok'],
['Shahil', 'Jindal', 26,'ok'],
['Rajat', 'Maggo', 24,'ok'],
['Shobhana', 'Singh', 23,'ok'],
['Sunil', 'Thakur', 29,'ok'],
['Yogesh', 'Saini', 34,'fail'],
['Rajat', 'Chhug', 40,'pass'],
['Pradeep', 'Bhatia', 50,'ok']
],
"styling": {
"bs3": [
"responsive",
"striped",
"condensed",
"hover",
"bordered"
],
"common": {
"fontFamilyCss": "'Consolas', 'Courier', monospace",
"fontSizeCss": "100%",
//"textTransformCss": "uppercase"
},
"header": {
"fontSizeCss": "100%",
"backgroundCss": "#0093D0",
"heightCss": "30px",
"paddingCss": "5px",
"colorCss" : "#fff"
},
"titles": {
"fontSizeCss": "120%",
"backgroundCss": "#999999"
}
},
"pagination": {
"itemPerPage" : 10,
},
"search":true
};
return(
<div>
<TableDataSet params={data} />
</div>
);
}
}
ReactDOM.render(<App />,document.querySelector('.container'));
Clone the repo as a new project:
git clone https://github.com/lobdev/react-npm-table-data-set <table-data-set>
Start Server:
First you have to replace the lib/component/table-data-set.js to server.js in package.json
cd table-data-set
npm i
npm start
Run App:
npm start command automatically initiate browser at 3000 port
http:://localhost:3000
Run tests:
cd table-data-set
npm i
npm test
Make sure you configure your editor/IDE to use:
.editorconfig
.eslintrc
FAQs
A react component to display data in a table format, using a bootstrap 3 style
We found that react-npm-table-data-set demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.