Gathering detailed insights and metrics for react-jspanel4
Gathering detailed insights and metrics for react-jspanel4
Gathering detailed insights and metrics for react-jspanel4
Gathering detailed insights and metrics for react-jspanel4
npm install react-jspanel4
Typescript
Module System
Node Version
NPM Version
JavaScript (94.37%)
HTML (4.66%)
CSS (0.98%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
35 Commits
1 Watchers
5 Branches
1 Contributors
Updated on Feb 06, 2020
Latest Version
1.0.0
Package Id
react-jspanel4@1.0.0
Unpacked Size
515.40 kB
Size
186.76 kB
File Count
35
NPM Version
6.2.0
Node Version
10.9.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
This project is just a playground to test how jsPanel4 can be integrated with React JS without altering the jsPanel4 library.
jsPanel4 is an amazing JS library written in vanilla javascript by Stefan Sträßer. It has no dependency.
Click here to see the live running application.
1import React, { Component, lazy, Suspense } from 'react'; 2import 'bootstrap/dist/css/bootstrap.min.css'; 3import './App.css'; 4import { jsPanel } from 'jspanel4/es6module/jspanel'; 5import 'jspanel4/es6module/extensions/modal/jspanel.modal'; 6import 'jspanel4/dist/jspanel.min.css'; 7 8// Normal components 9import Clock from './components/clock'; 10import ActionButton from './components/ActionButton'; 11import CreatePortal from './components/createPortal'; 12 13// jsPanel default options 14import jsPanelOptions from './jsPanelOptions'; 15 16// lazy loaded components 17const DisplayName = lazy(() => import('./components/DisplayName')); 18const Countries = lazy(() => import('./components/Countries')); 19const TodoApp = lazy(() => import('./components/Todo/TodoApp')); 20const SampleUsers = lazy(() => import('./components/SampleUsers')); 21const RandomImage = lazy(() => import('./components/RandomImage')); 22 23// Top level React component 24class App extends Component { 25 constructor() { 26 super(); 27 this.state = { 28 panels: {} 29 }; 30 } 31 32 createJsPanel = (action, comp, modal = false) => { 33 // keep Main component refrence 34 const app = this; 35 // check if its already mounted, bring it to front 36 if (app.state.panels[action]) { 37 return app.state.panels[action]['panel'].front(() => { 38 app.state.panels[action]['panel'].resize({ 39 height: 'auto' 40 }); 41 app.state.panels[action]['panel'].reposition('center-top 0 20%'); 42 }); 43 } 44 45 const options = { 46 ...jsPanelOptions, 47 headerTitle: action, 48 onclosed: () => { 49 // remove closed jsPanel and its mounted component from state 50 const appPanels = app.state.panels; 51 if (appPanels[action]) { 52 delete appPanels[action]; 53 app.setState({ panels: { ...appPanels } }); 54 } 55 } 56 }; 57 // create jsPanel 58 const panel = modal ? jsPanel.modal.create(options) : jsPanel.create(options); 59 // save panel and compponent (this will be mounted later inside panel body) reference inside state 60 app.setState({ panels: { ...app.state.panels, [action]: { panel, comp } } }); 61 }; 62 63 renderJsPanlesInsidePortal() { 64 const panels = this.state.panels; 65 return Object.keys(panels).map(action => { 66 const jsPanel = panels[action].panel; 67 const Comp = panels[action].comp; 68 const node = document.getElementById(`${jsPanel.id}-node`); 69 let counter = 0; 70 if (!Comp) return null; 71 return ( 72 <CreatePortal rootNode={node} key={jsPanel.id}> 73 {Array.isArray(Comp) ? ( 74 Comp.map(C => ( 75 <Suspense key={`${jsPanel.id}-${counter++}`} fallback={<div className="alert alert-info">Loading...</div>}> 76 <C jsPanel={jsPanel} /> 77 </Suspense> 78 )) 79 ) : ( 80 <Suspense fallback={<div className="alert alert-info">Loading...</div>}> 81 <Comp jsPanel={jsPanel} /> 82 </Suspense> 83 )} 84 </CreatePortal> 85 ); 86 }); 87 } 88 89 render() { 90 const jsPanels = Object.keys(this.state.panels); 91 const actionButtonProps = { 92 className: 'btn btn-outline-primary ml-2 mb-2', 93 handleClick: this.createJsPanel 94 }; 95 return ( 96 <div className="container-fluid"> 97 <div className="row bg-dark text-white shadow p-2"> 98 <div className="col-md-12"> 99 <h4 className="text-center">jsPanel with react</h4> 100 </div> 101 </div> 102 <div className="row justify-content-center mt-4"> 103 <div className="card"> 104 <div className="card-body"> 105 <ActionButton {...actionButtonProps} title="Simple Example" comp={DisplayName} /> 106 <ActionButton {...actionButtonProps} title=" Countries List" comp={Countries} /> 107 <ActionButton {...actionButtonProps} title="Todo App" comp={TodoApp} /> 108 <ActionButton {...actionButtonProps} title="Sample Users" comp={SampleUsers} /> 109 <ActionButton {...actionButtonProps} title="Random Image" comp={RandomImage} /> 110 <ActionButton {...actionButtonProps} title="Modal Example" comp={Clock} modal={true} /> 111 <ActionButton {...actionButtonProps} title="Multiple Components" comp={[Clock, DisplayName, RandomImage, Countries]} /> 112 </div> 113 </div> 114 </div> 115 {jsPanels.length > 0 && this.renderJsPanlesInsidePortal()} 116 </div> 117 ); 118 } 119} 120 121export default App;
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no SAST tool detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
137 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More