
Security News
libxml2 Maintainer Ends Embargoed Vulnerability Reports, Citing Unsustainable Burden
Libxml2’s solo maintainer drops embargoed security fixes, highlighting the burden on unpaid volunteers who keep critical open source software secure.
reactstrap-react-lib
Advanced tools
This is build with typescript for using with react and reactstrap
npm install reactstrap-react-lib
npx reactstrap-react-lib-cli
This contains following lib modules
1. Header
2. accessor
3. Cell
4. dataType
Filter : "Global" | "Column" | "Both" | "None"
Prop | Possible Values | Description |
---|---|---|
columns | { Header accessor Cell dataType} | see code below |
filter | "Global" or "Column" or "Both"or "None" | These are filter for table |
sort | boolean | true means allows false no |
pagination | object containing functiona |
import React,{useState, useEffect} from 'react'
import {Row, Col, Container} from "reactstrap"
import {LinkP, Table} from "reactstrap-react-lib"
import data from "../MOCK_DATA .json"
// {"id":1,"first_name":"Aubine","last_name":"McClenaghan","email":"amcclenaghan0@prnewswire.com","gender":"Polygender","ip_address":"11.4.220.200","date":"2020-08-17"}
export default function table() {
const [pageData, setpageData] = useState([])
const [pagesize, setPagesize] = useState(100)
useEffect(() => {
pageDataHandle(0)
return () => {}
}, [data])
const pageDataHandle = (pageNo)=>{
let pageStart = pageNo * pagesize
let curPageData = data.slice ( pageStart , pageStart + pagesize)
setpageData(curPageData)
}
const columns = [
{
Header : "Id",
accessor : "id",
Cell : ({value})=> <LinkP link = {`/edit/${value}`} value = {value} />,
dataType : "number"
},
{
Header : "first_name",
accessor : "first_name",
dataType : "string"
},{
Header : "last_name",
accessor : "last_name",
dataType : "string"
},{
Header : "email",
accessor : "email",
dataType : "string"
},{
Header : "gender",
accessor : "gender",
dataType : "string"
},
{
Header : "ip_address",
accessor : "ip_address",
dataType : "string"
}
,{
Header : "Date",
accessor : "date",
Cell : ({value})=> new Date(value).toDateString(),
dataType : "Date"
}
]
return (
<>
<Container>
<Row>
<Col>
<Table
columns={columns}
data={pageData}
filter= "Both"
// sort = {false}
pagination = {{
"nextPage" : (pageNo)=>{
pageDataHandle(pageNo)
return true;
},
"previousPage" : (pageNo) =>{
pageDataHandle(pageNo)
return true
}
}}
/>
</Col>
</Row>
</Container>
</>
)
}
This is for submiting data to server. it has inbuilt submit button and also reset button.
={["POST", curObj]}
import{FormSubmit} from "reactstrap-react-lib"
import React,{useState} from 'react'
import {Container, Row, Col, FormGroup, Input, Label} from "reactstrap"
function submitForm(props) {
const initObj = {firstName:"", lastName : "", email : ""}//intial value sof inputs
const [obj, setObj] = useState(initObj)
return (
<Container>
{/* FormSubmit */}
<Row>
<Col>
<FormSubmit
Inputs={
<>
<FormGroup>
<Label className="required">Firtname</Label>
<Input type="text" value={obj.firstName} onChange={(e)=>setObj({...obj, firstName : e.target.value})} required={true}/>
</FormGroup>
<FormGroup>
<Label>lastName</Label>
<Input type="text" value={obj.lastName} onChange={(e)=>setObj({...obj, lastName : e.target.value})} required={true}/>
</FormGroup>
<FormGroup>
<Label>email</Label>
<Input type="email" value={obj.email} onChange={(e)=>setObj({...obj, email : e.target.value})} required={true}/>
</FormGroup>
</>
}
curObj = {["POST", obj]} //"POST , "GET", "PUT", "DELETE", "ACTON"
curUri = "/api/auth/login" //login
onSuccess = {(res)=>{
return res.data.mes // mes is key of json sent from api
}}
onError={(err)=>{
return err.response.data
}
}
validation ={()=>{
// return "validation error"
// if no error return ""
return ""
}}
reset={()=>setObj(initObj)}// this resets the inputs to intialstate
AxiosRequestConfig={{//axios config setting}}
/>
</Col>
</Row>
</Container>
}
import{SectioPanel,Sidebar} from "reactstrap-react-lib"
import React,{useState} from 'react'
function AdminPanel(props) {
const Employee =[
{name : "create", link : "/employee/create"},
{name : "edit", link : "/employee/edit"},
{name : "delete", link : "/employee/delete"},
]
const Shifts = [
{name : "create", link : "/shifts/create"},
{name : "edit", link : "/shifts/edit"},
{name : "delete", link : "/shifts/delete"},
]
const Roster = [
{name : "create", link : "/shifts/create"},
{name : "edit", link : "/shifts/edit"},
{name : "delete", link : "/shifts/delete"},
]
const Onboarding = [
{name : "create", link : "/shifts/create"},
{name : "edit", link : "/shifts/edit"},
{name : "delete", link : "/shifts/delete"},
]
const section = [
{title : "Employee",sectionElements : Employee},
{title : "Shifts", sectionElements : Shifts},
{title : "Roster", sectionElements : Roster},
{title : "Onboarding", sectionElements : Onboarding}
]
return(
<Sidebar
Main ={<h3>Component to rendered here </h3>}
orgName = "JJH Hubli"
userName = "umesh"
siderBarLinks ={[
{name : "Zoho", link : "/admin/Zoho"},
{name : "Employee", panel: {"panelTitle": "Employee" , "section" : section }}
]}
/>
</Col>
</Row>
)
}
import{FormDelete} from "reactstrap-react-lib"
import React,{useState} from 'react'
import {Container, Row, Col, FormGroup, Input, Label} from "reactstrap"
function deleteForm(props) {
return(
{/* Form Delete */}
<Row>
<Col>
<FormDelete
curUri="api/form-delete"
curObj = {["POST", {id : 1}]}
onSuccess={(res)=>{
return res.data.mes
}}
onError={(err)=>{
console.log(err.response)
return err.response.data
}}
/>
</Col>
</Row>
)
FAQs
This is a lib for react and next
The npm package reactstrap-react-lib receives a total of 96 weekly downloads. As such, reactstrap-react-lib popularity was classified as not popular.
We found that reactstrap-react-lib demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Security News
Libxml2’s solo maintainer drops embargoed security fixes, highlighting the burden on unpaid volunteers who keep critical open source software secure.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.