visualifyjs 2.5.3-2.dev → 2.5.3-9-dev
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of visualifyjs might be problematic. Click here for more details.
- package/.github/workflows/{static.yml.bak → build.yaml} +51 -51
- package/LICENSE +674 -674
- package/README.md +40 -58
- package/config-overrides.js +31 -31
- package/dist/visualify.js +3 -3
- package/docs/CLI.md +15 -0
- package/docs/{docs/README.md → README.md} +41 -65
- package/docs/{docs/Rechart → Rechart}/bar.md +190 -190
- package/docs/{docs/Rechart → Rechart}/funnel.md +193 -241
- package/docs/{docs/Rechart → Rechart}/line.md +355 -355
- package/docs/{docs/Rechart → Rechart}/pie.md +225 -225
- package/docs/{docs/Rechart → Rechart}/radar.md +253 -253
- package/docs/{docs/_404.md → _404.md} +51 -51
- package/docs/{docs/_coverpage.md → _coverpage.md} +11 -11
- package/docs/{docs/_sidebar.md → _sidebar.md} +42 -44
- package/docs/{docs/components → components}/dotBio.md +34 -34
- package/docs/{docs/components → components}/echart.md +82 -82
- package/docs/{docs/components → components}/html.md +34 -34
- package/docs/{docs/components → components}/macaron.md +145 -145
- package/docs/components/markdown.md +0 -0
- package/docs/{docs/components → components}/more.md +142 -142
- package/docs/{docs/components → components}/plotly.md +62 -62
- package/docs/{docs/components → components}/scatterL.md +70 -70
- package/docs/{docs/components → components}/visium.md +56 -56
- package/docs/{docs/configuration.md → configuration.md} +123 -121
- package/docs/{docs/deploy.md → deploy.md} +23 -31
- package/docs/index.html +70 -70
- package/docs/log.md +1 -0
- package/docs/manifest.json +23 -23
- package/docs/{docs/more-pages.md → more-pages.md} +23 -23
- package/docs/{docs/quickstart.md → quickstart.md} +115 -124
- package/docs/{docs/rechart-attributes.md → rechart-attributes.md} +74 -74
- package/docs/{docs/rechart-basic-usage.md → rechart-basic-usage.md} +162 -162
- package/docs/static/css/fluff-stuff.css +169 -169
- package/docs/static/css/font-awesome.min.css +4 -4
- package/docs/static/css/visualify.css +25 -25
- package/docs/static/js/configuration.js +448 -448
- package/docs/static/js/visualify.js +24 -23
- package/docs/theme.md +3 -0
- package/package.json +74 -83
- package/rollup.config.mjs +75 -75
- package/src/_css/404.css +115 -115
- package/src/_css/App.css +37 -37
- package/src/_css/autoSuggestion.css +26 -26
- package/src/_css/circular-progress.css +32 -32
- package/src/_css/index.css +36 -36
- package/src/_css/modern.css +24 -24
- package/src/_media/corner.svg +8 -8
- package/src/_media/download.svg +3 -3
- package/src/_media/logo.svg +14 -14
- package/src/_test/App.test.js +15 -15
- package/src/_utils/reportWebVitals.js +13 -13
- package/src/core/appContext.js +27 -27
- package/src/core/components/Scatter.js +188 -188
- package/src/core/components/ScatterBio.js +572 -572
- package/src/core/components/VisiumPlot.js +165 -165
- package/src/core/components/browser.js +42 -42
- package/src/core/components/dotplot.js +413 -413
- package/src/core/components/html.js +29 -29
- package/src/core/components/list.js +178 -178
- package/src/core/components/macaron.js +201 -201
- package/src/core/components/markdown.js +56 -56
- package/src/core/components/parser.scatterBio.js +579 -587
- package/src/core/components/ratio.js +80 -80
- package/src/core/components/scatterL.js +173 -173
- package/src/core/components/searchbar.js +131 -131
- package/src/core/components/selection.js +193 -193
- package/src/core/components/timeline.js +281 -281
- package/src/core/components/visium.js +97 -97
- package/src/core/fetch/condfetch.js +82 -82
- package/src/core/fetch/fetch.js +92 -92
- package/src/core/fetch/json.js +29 -29
- package/src/core/fetch/vfetch.js +42 -42
- package/src/core/liveEditor.js +44 -44
- package/src/core/modules/codeEditorWithPreview.js +104 -104
- package/src/core/modules/echarts/common.js +20 -20
- package/src/core/modules/echarts/presetHandler.js +41 -41
- package/src/core/modules/echarts/presets/esodev.chromium.js +172 -172
- package/src/core/modules/echarts/presets/esodev.codex.js +130 -130
- package/src/core/modules/echarts/presets/esodev.visium.js +123 -123
- package/src/core/modules/echarts/presets/mmtrbc.js +186 -186
- package/src/core/modules/echarts.js +71 -71
- package/src/core/modules/echartsUtils.js +43 -43
- package/src/core/modules/echartswitcher.js +152 -152
- package/src/core/modules/replotly/presetHandler.js +24 -24
- package/src/core/modules/replotly/presets/minimum.js +18 -18
- package/src/core/modules/replotly/presets/mmtrbc.dot.js +114 -114
- package/src/core/modules/replotly/presets/mmtrbc.violin.js +100 -100
- package/src/core/modules/replotly.js +71 -71
- package/src/core/pages/404.js +50 -50
- package/src/core/pages/error.js +27 -27
- package/src/core/pages/jsonPage.js +62 -62
- package/src/core/pages/loading.js +44 -44
- package/src/core/parser/echart.data.js +183 -183
- package/src/core/parser/echart.features.js +125 -125
- package/src/core/parser/echart.general.js +143 -147
- package/src/core/parser/echart.hilbert.js +57 -57
- package/src/core/parser/echart.parser.js +210 -210
- package/src/core/parser/echart.series.js +67 -67
- package/src/core/parser/echart.types.js +76 -76
- package/src/core/parser/plotly.config.js +10 -10
- package/src/core/parser/plotly.data.js +132 -132
- package/src/core/parser/plotly.layout.js +9 -9
- package/src/core/parser/plotly.violin.js +18 -18
- package/src/core/recharts.js +62 -62
- package/src/core/router/alias.js +49 -49
- package/src/core/router/jsonRouter.js +31 -31
- package/src/core/themes/modern.js +32 -32
- package/src/core/themes/themeSelector.js +33 -33
- package/src/core/visualify.js +47 -47
- package/src/core/widgets/circularProgress.js +23 -23
- package/src/core/widgets/controller.js +83 -83
- package/src/core/widgets/errorBoundary.js +36 -36
- package/src/core/widgets/footer.js +177 -177
- package/src/core/widgets/header.js +234 -234
- package/src/core/widgets/layout/Grid.js +31 -31
- package/src/core/widgets/layout.js +36 -36
- package/src/core/widgets/mapping.js +42 -42
- package/src/index.js +62 -62
- package/src/setupTests.js +5 -5
- package/docs/docs/CLI.md +0 -34
- package/docs/docs/Rechart/scatter.md +0 -298
- package/docs/docs/log.md +0 -9
- package/docs/docs/static/logo/favicon.ico +0 -0
- package/docs/docs/static/logo/logo_128x128.png +0 -0
- package/docs/docs/static/logo/logo_192x192.png +0 -0
- package/docs/docs/static/logo/logo_256x256.png +0 -0
- package/docs/docs/static/logo/logo_512x512.png +0 -0
- package/docs/docs/static/logo/logo_64x64.png +0 -0
- package/docs/docs/theme.md +0 -5
- /package/docs/{docs/Rechart → Rechart}/geo.md +0 -0
- /package/docs/{docs/Rechart → Rechart}/liquidfill.md +0 -0
- /package/docs/{docs/Rechart → Rechart}/polar.md +0 -0
- /package/docs/{docs/Rechart → Rechart}/sankey.md +0 -0
- /package/docs/{docs/Rechart/sunburst.md → Rechart/scatter.md} +0 -0
- /package/docs/{docs/Rechart/tree.md → Rechart/sunburst.md} +0 -0
- /package/docs/{docs/Rechart/wordcloud.md → Rechart/tree.md} +0 -0
- /package/docs/{docs/components/markdown.md → Rechart/wordcloud.md} +0 -0
- /package/docs/{docs/static → static}/_images/deploy-github-pages.png +0 -0
@@ -1,234 +1,234 @@
|
|
1
|
-
import React, { useState, useEffect, useRef } from 'react';
|
2
|
-
import { Container } from 'react-bootstrap';
|
3
|
-
import { ReactComponent as Corner } from '../../_media/corner.svg';
|
4
|
-
import { useLocation, Link } from 'react-router-dom';
|
5
|
-
import { ReactComponent as Logo } from '../../_media/logo.svg';
|
6
|
-
|
7
|
-
function Vheader({ config }) {
|
8
|
-
const location = useLocation();
|
9
|
-
const [Navgation, setNavgation] = useState(null);
|
10
|
-
const [activeNav, setActiveNav] = useState('home');
|
11
|
-
|
12
|
-
const {
|
13
|
-
logo = <Logo />,
|
14
|
-
logolink = 'https://www.lgcyaxi.net/visualify',
|
15
|
-
name = 'Visualify',
|
16
|
-
nav = false,
|
17
|
-
alias = {},
|
18
|
-
nav_alignment = 'start',
|
19
|
-
repo,
|
20
|
-
} = config;
|
21
|
-
|
22
|
-
// Function to get the current directory path
|
23
|
-
const getCurrentDirectoryPath = () => {
|
24
|
-
// Extract the path from the hash, removing the leading '#/'
|
25
|
-
const hashPath = window.location.hash.slice(2);
|
26
|
-
const pathSegments = hashPath.split('/');
|
27
|
-
// Remove the last segment (file name or empty string if it ends with '/')
|
28
|
-
pathSegments.pop();
|
29
|
-
// Rejoin the remaining segments to form the directory path
|
30
|
-
let directoryPath = pathSegments.join('/');
|
31
|
-
// Ensure the directory path ends with '/'
|
32
|
-
if (!directoryPath.endsWith('/')) {
|
33
|
-
directoryPath += '/';
|
34
|
-
}
|
35
|
-
return directoryPath;
|
36
|
-
};
|
37
|
-
|
38
|
-
const renderLogo = () => {
|
39
|
-
return (
|
40
|
-
<a
|
41
|
-
className='navbar-brand d-flex align-items-center'
|
42
|
-
href={logolink}
|
43
|
-
target='_blank'
|
44
|
-
rel='noreferrer'>
|
45
|
-
{typeof logo === 'string' ? (
|
46
|
-
<img
|
47
|
-
src={logo}
|
48
|
-
alt='logo'
|
49
|
-
width='65'
|
50
|
-
height='65'
|
51
|
-
className='d-inline-block align-top'
|
52
|
-
/>
|
53
|
-
) : (
|
54
|
-
logo
|
55
|
-
)}
|
56
|
-
</a>
|
57
|
-
);
|
58
|
-
};
|
59
|
-
|
60
|
-
const renderTitle = () => {
|
61
|
-
if (typeof name === 'string') {
|
62
|
-
return <h1 className='rainbow-text'>{name}</h1>;
|
63
|
-
}
|
64
|
-
const {
|
65
|
-
text = 'Visualify',
|
66
|
-
font_weight = 'bold',
|
67
|
-
color = 'rainbow',
|
68
|
-
...rest
|
69
|
-
} = name;
|
70
|
-
|
71
|
-
if (color === 'rainbow') {
|
72
|
-
return (
|
73
|
-
<h1
|
74
|
-
className='rainbow-text'
|
75
|
-
style={{ fontWeight: font_weight }}>
|
76
|
-
{text}
|
77
|
-
</h1>
|
78
|
-
);
|
79
|
-
} else {
|
80
|
-
return (
|
81
|
-
<h1 style={{ fontWeight: font_weight, color: color, ...rest }}>
|
82
|
-
{text}
|
83
|
-
</h1>
|
84
|
-
);
|
85
|
-
}
|
86
|
-
};
|
87
|
-
|
88
|
-
useEffect(() => {
|
89
|
-
const resolveNavUrl = () => {
|
90
|
-
let pathSegments = location.pathname.split('/');
|
91
|
-
//console.log('pathseg:' + pathSegments);
|
92
|
-
pathSegments.pop();
|
93
|
-
let directoryPath = pathSegments.join('/');
|
94
|
-
|
95
|
-
if (directoryPath === '') directoryPath = window.location.pathname;
|
96
|
-
//console.log('directoryPath:' + directoryPath,'windows.pathname:' + window.location.pathname,);
|
97
|
-
|
98
|
-
if (!directoryPath.endsWith('/')) directoryPath += '/';
|
99
|
-
|
100
|
-
const fullNavPath = directoryPath + '_nav.json';
|
101
|
-
const aliasPath = alias && alias[fullNavPath];
|
102
|
-
|
103
|
-
return aliasPath ? aliasPath : fullNavPath;
|
104
|
-
};
|
105
|
-
|
106
|
-
if (nav && typeof nav === 'boolean') {
|
107
|
-
const navUrl = resolveNavUrl();
|
108
|
-
|
109
|
-
// Fetch the navigation data only if the URL has changed
|
110
|
-
if (navUrl !== previousNavUrl.current) {
|
111
|
-
fetch(navUrl)
|
112
|
-
.then((res) => res.json())
|
113
|
-
.then((data) => {
|
114
|
-
// Check if the fetched data is different from the current state
|
115
|
-
if (
|
116
|
-
JSON.stringify(data) !== JSON.stringify(Navgation)
|
117
|
-
) {
|
118
|
-
setNavgation(data);
|
119
|
-
}
|
120
|
-
})
|
121
|
-
.catch((err) => {
|
122
|
-
console.error(
|
123
|
-
`Failed to fetch navigation data: ${err}`,
|
124
|
-
);
|
125
|
-
setNavgation(null);
|
126
|
-
});
|
127
|
-
|
128
|
-
// Update the ref with the new URL
|
129
|
-
previousNavUrl.current = navUrl;
|
130
|
-
}
|
131
|
-
} else if (
|
132
|
-
nav &&
|
133
|
-
typeof nav === 'object' &&
|
134
|
-
JSON.stringify(nav) !== JSON.stringify(Navgation)
|
135
|
-
) {
|
136
|
-
setNavgation(nav);
|
137
|
-
} else if (!nav) {
|
138
|
-
setNavgation(null);
|
139
|
-
}
|
140
|
-
}, [nav, alias, Navgation, location.pathname]); // Use location.pathname if only the path is relevant
|
141
|
-
|
142
|
-
// Use a ref to store the previous navigation URL
|
143
|
-
const previousNavUrl = useRef();
|
144
|
-
|
145
|
-
useEffect(() => {
|
146
|
-
// Update the active nav item based on the current location
|
147
|
-
let path = location.pathname === '/' ? '/home' : location.pathname;
|
148
|
-
setActiveNav(path.slice(1));
|
149
|
-
}, [location]);
|
150
|
-
|
151
|
-
const renderNav = () => {
|
152
|
-
if (!Navgation) return <Container />;
|
153
|
-
const currentDirectoryPath = getCurrentDirectoryPath();
|
154
|
-
const navs = Navgation.map((navItem, index) => {
|
155
|
-
let fullPath = `${currentDirectoryPath}${navItem.link}`;
|
156
|
-
if (fullPath.startsWith('/')) {
|
157
|
-
fullPath = fullPath.slice(1);
|
158
|
-
}
|
159
|
-
const isActive = activeNav === fullPath;
|
160
|
-
let navLinkClass = 'nav-link';
|
161
|
-
if (navItem.type === 'primary')
|
162
|
-
navLinkClass = 'btn btn-primary shadow no-border-radius';
|
163
|
-
if (isActive) navLinkClass += ' active';
|
164
|
-
const isExternal = navItem.link.startsWith('http');
|
165
|
-
|
166
|
-
return (
|
167
|
-
<li
|
168
|
-
className='nav-item'
|
169
|
-
key={index}>
|
170
|
-
{isExternal ? (
|
171
|
-
<a
|
172
|
-
className={navLinkClass}
|
173
|
-
href={fullPath}
|
174
|
-
target='_blank'
|
175
|
-
rel='noreferrer'>
|
176
|
-
{navItem.title}
|
177
|
-
</a>
|
178
|
-
) : (
|
179
|
-
<Link
|
180
|
-
className={navLinkClass}
|
181
|
-
to={fullPath}>
|
182
|
-
{navItem.title}
|
183
|
-
</Link>
|
184
|
-
)}
|
185
|
-
</li>
|
186
|
-
);
|
187
|
-
});
|
188
|
-
|
189
|
-
return (
|
190
|
-
<Container>
|
191
|
-
<ul
|
192
|
-
className={`navbar-nav d-flex justify-content-${nav_alignment} mx-auto`}
|
193
|
-
id='navtabs'>
|
194
|
-
{navs}
|
195
|
-
</ul>
|
196
|
-
</Container>
|
197
|
-
);
|
198
|
-
};
|
199
|
-
|
200
|
-
const renderGitHubCorner = () => {
|
201
|
-
if (!repo) return null;
|
202
|
-
|
203
|
-
// Check if it's a full URL or a "username/repo" string
|
204
|
-
const isFullUrl =
|
205
|
-
repo.startsWith('http://') || repo.startsWith('https://');
|
206
|
-
const githubUrl = isFullUrl ? repo : `https://github.com/${repo}`;
|
207
|
-
|
208
|
-
return (
|
209
|
-
<a
|
210
|
-
href={githubUrl}
|
211
|
-
className='github-corner'
|
212
|
-
aria-label='View source on GitHub'
|
213
|
-
target='_blank'
|
214
|
-
rel='noreferrer'>
|
215
|
-
{<Corner />}
|
216
|
-
</a>
|
217
|
-
);
|
218
|
-
};
|
219
|
-
|
220
|
-
return (
|
221
|
-
<header className='v-header'>
|
222
|
-
<nav className='navbar navbar-light navbar-expand-md py-3'>
|
223
|
-
<Container>
|
224
|
-
{renderLogo()}
|
225
|
-
{renderTitle()}
|
226
|
-
{renderNav()}
|
227
|
-
</Container>
|
228
|
-
</nav>
|
229
|
-
{renderGitHubCorner()}
|
230
|
-
</header>
|
231
|
-
);
|
232
|
-
}
|
233
|
-
|
234
|
-
export default Vheader;
|
1
|
+
import React, { useState, useEffect, useRef } from 'react';
|
2
|
+
import { Container } from 'react-bootstrap';
|
3
|
+
import { ReactComponent as Corner } from '../../_media/corner.svg';
|
4
|
+
import { useLocation, Link } from 'react-router-dom';
|
5
|
+
import { ReactComponent as Logo } from '../../_media/logo.svg';
|
6
|
+
|
7
|
+
function Vheader({ config }) {
|
8
|
+
const location = useLocation();
|
9
|
+
const [Navgation, setNavgation] = useState(null);
|
10
|
+
const [activeNav, setActiveNav] = useState('home');
|
11
|
+
|
12
|
+
const {
|
13
|
+
logo = <Logo />,
|
14
|
+
logolink = 'https://www.lgcyaxi.net/visualify',
|
15
|
+
name = 'Visualify',
|
16
|
+
nav = false,
|
17
|
+
alias = {},
|
18
|
+
nav_alignment = 'start',
|
19
|
+
repo,
|
20
|
+
} = config;
|
21
|
+
|
22
|
+
// Function to get the current directory path
|
23
|
+
const getCurrentDirectoryPath = () => {
|
24
|
+
// Extract the path from the hash, removing the leading '#/'
|
25
|
+
const hashPath = window.location.hash.slice(2);
|
26
|
+
const pathSegments = hashPath.split('/');
|
27
|
+
// Remove the last segment (file name or empty string if it ends with '/')
|
28
|
+
pathSegments.pop();
|
29
|
+
// Rejoin the remaining segments to form the directory path
|
30
|
+
let directoryPath = pathSegments.join('/');
|
31
|
+
// Ensure the directory path ends with '/'
|
32
|
+
if (!directoryPath.endsWith('/')) {
|
33
|
+
directoryPath += '/';
|
34
|
+
}
|
35
|
+
return directoryPath;
|
36
|
+
};
|
37
|
+
|
38
|
+
const renderLogo = () => {
|
39
|
+
return (
|
40
|
+
<a
|
41
|
+
className='navbar-brand d-flex align-items-center'
|
42
|
+
href={logolink}
|
43
|
+
target='_blank'
|
44
|
+
rel='noreferrer'>
|
45
|
+
{typeof logo === 'string' ? (
|
46
|
+
<img
|
47
|
+
src={logo}
|
48
|
+
alt='logo'
|
49
|
+
width='65'
|
50
|
+
height='65'
|
51
|
+
className='d-inline-block align-top'
|
52
|
+
/>
|
53
|
+
) : (
|
54
|
+
logo
|
55
|
+
)}
|
56
|
+
</a>
|
57
|
+
);
|
58
|
+
};
|
59
|
+
|
60
|
+
const renderTitle = () => {
|
61
|
+
if (typeof name === 'string') {
|
62
|
+
return <h1 className='rainbow-text'>{name}</h1>;
|
63
|
+
}
|
64
|
+
const {
|
65
|
+
text = 'Visualify',
|
66
|
+
font_weight = 'bold',
|
67
|
+
color = 'rainbow',
|
68
|
+
...rest
|
69
|
+
} = name;
|
70
|
+
|
71
|
+
if (color === 'rainbow') {
|
72
|
+
return (
|
73
|
+
<h1
|
74
|
+
className='rainbow-text'
|
75
|
+
style={{ fontWeight: font_weight }}>
|
76
|
+
{text}
|
77
|
+
</h1>
|
78
|
+
);
|
79
|
+
} else {
|
80
|
+
return (
|
81
|
+
<h1 style={{ fontWeight: font_weight, color: color, ...rest }}>
|
82
|
+
{text}
|
83
|
+
</h1>
|
84
|
+
);
|
85
|
+
}
|
86
|
+
};
|
87
|
+
|
88
|
+
useEffect(() => {
|
89
|
+
const resolveNavUrl = () => {
|
90
|
+
let pathSegments = location.pathname.split('/');
|
91
|
+
//console.log('pathseg:' + pathSegments);
|
92
|
+
pathSegments.pop();
|
93
|
+
let directoryPath = pathSegments.join('/');
|
94
|
+
|
95
|
+
if (directoryPath === '') directoryPath = window.location.pathname;
|
96
|
+
//console.log('directoryPath:' + directoryPath,'windows.pathname:' + window.location.pathname,);
|
97
|
+
|
98
|
+
if (!directoryPath.endsWith('/')) directoryPath += '/';
|
99
|
+
|
100
|
+
const fullNavPath = directoryPath + '_nav.json';
|
101
|
+
const aliasPath = alias && alias[fullNavPath];
|
102
|
+
|
103
|
+
return aliasPath ? aliasPath : fullNavPath;
|
104
|
+
};
|
105
|
+
|
106
|
+
if (nav && typeof nav === 'boolean') {
|
107
|
+
const navUrl = resolveNavUrl();
|
108
|
+
|
109
|
+
// Fetch the navigation data only if the URL has changed
|
110
|
+
if (navUrl !== previousNavUrl.current) {
|
111
|
+
fetch(navUrl)
|
112
|
+
.then((res) => res.json())
|
113
|
+
.then((data) => {
|
114
|
+
// Check if the fetched data is different from the current state
|
115
|
+
if (
|
116
|
+
JSON.stringify(data) !== JSON.stringify(Navgation)
|
117
|
+
) {
|
118
|
+
setNavgation(data);
|
119
|
+
}
|
120
|
+
})
|
121
|
+
.catch((err) => {
|
122
|
+
console.error(
|
123
|
+
`Failed to fetch navigation data: ${err}`,
|
124
|
+
);
|
125
|
+
setNavgation(null);
|
126
|
+
});
|
127
|
+
|
128
|
+
// Update the ref with the new URL
|
129
|
+
previousNavUrl.current = navUrl;
|
130
|
+
}
|
131
|
+
} else if (
|
132
|
+
nav &&
|
133
|
+
typeof nav === 'object' &&
|
134
|
+
JSON.stringify(nav) !== JSON.stringify(Navgation)
|
135
|
+
) {
|
136
|
+
setNavgation(nav);
|
137
|
+
} else if (!nav) {
|
138
|
+
setNavgation(null);
|
139
|
+
}
|
140
|
+
}, [nav, alias, Navgation, location.pathname]); // Use location.pathname if only the path is relevant
|
141
|
+
|
142
|
+
// Use a ref to store the previous navigation URL
|
143
|
+
const previousNavUrl = useRef();
|
144
|
+
|
145
|
+
useEffect(() => {
|
146
|
+
// Update the active nav item based on the current location
|
147
|
+
let path = location.pathname === '/' ? '/home' : location.pathname;
|
148
|
+
setActiveNav(path.slice(1));
|
149
|
+
}, [location]);
|
150
|
+
|
151
|
+
const renderNav = () => {
|
152
|
+
if (!Navgation) return <Container />;
|
153
|
+
const currentDirectoryPath = getCurrentDirectoryPath();
|
154
|
+
const navs = Navgation.map((navItem, index) => {
|
155
|
+
let fullPath = `${currentDirectoryPath}${navItem.link}`;
|
156
|
+
if (fullPath.startsWith('/')) {
|
157
|
+
fullPath = fullPath.slice(1);
|
158
|
+
}
|
159
|
+
const isActive = activeNav === fullPath;
|
160
|
+
let navLinkClass = 'nav-link';
|
161
|
+
if (navItem.type === 'primary')
|
162
|
+
navLinkClass = 'btn btn-primary shadow no-border-radius';
|
163
|
+
if (isActive) navLinkClass += ' active';
|
164
|
+
const isExternal = navItem.link.startsWith('http');
|
165
|
+
|
166
|
+
return (
|
167
|
+
<li
|
168
|
+
className='nav-item'
|
169
|
+
key={index}>
|
170
|
+
{isExternal ? (
|
171
|
+
<a
|
172
|
+
className={navLinkClass}
|
173
|
+
href={fullPath}
|
174
|
+
target='_blank'
|
175
|
+
rel='noreferrer'>
|
176
|
+
{navItem.title}
|
177
|
+
</a>
|
178
|
+
) : (
|
179
|
+
<Link
|
180
|
+
className={navLinkClass}
|
181
|
+
to={fullPath}>
|
182
|
+
{navItem.title}
|
183
|
+
</Link>
|
184
|
+
)}
|
185
|
+
</li>
|
186
|
+
);
|
187
|
+
});
|
188
|
+
|
189
|
+
return (
|
190
|
+
<Container>
|
191
|
+
<ul
|
192
|
+
className={`navbar-nav d-flex justify-content-${nav_alignment} mx-auto`}
|
193
|
+
id='navtabs'>
|
194
|
+
{navs}
|
195
|
+
</ul>
|
196
|
+
</Container>
|
197
|
+
);
|
198
|
+
};
|
199
|
+
|
200
|
+
const renderGitHubCorner = () => {
|
201
|
+
if (!repo) return null;
|
202
|
+
|
203
|
+
// Check if it's a full URL or a "username/repo" string
|
204
|
+
const isFullUrl =
|
205
|
+
repo.startsWith('http://') || repo.startsWith('https://');
|
206
|
+
const githubUrl = isFullUrl ? repo : `https://github.com/${repo}`;
|
207
|
+
|
208
|
+
return (
|
209
|
+
<a
|
210
|
+
href={githubUrl}
|
211
|
+
className='github-corner'
|
212
|
+
aria-label='View source on GitHub'
|
213
|
+
target='_blank'
|
214
|
+
rel='noreferrer'>
|
215
|
+
{<Corner />}
|
216
|
+
</a>
|
217
|
+
);
|
218
|
+
};
|
219
|
+
|
220
|
+
return (
|
221
|
+
<header className='v-header'>
|
222
|
+
<nav className='navbar navbar-light navbar-expand-md py-3'>
|
223
|
+
<Container>
|
224
|
+
{renderLogo()}
|
225
|
+
{renderTitle()}
|
226
|
+
{renderNav()}
|
227
|
+
</Container>
|
228
|
+
</nav>
|
229
|
+
{renderGitHubCorner()}
|
230
|
+
</header>
|
231
|
+
);
|
232
|
+
}
|
233
|
+
|
234
|
+
export default Vheader;
|
@@ -1,31 +1,31 @@
|
|
1
|
-
/*
|
2
|
-
* @Author : Lihao leolihao@arizona.edu
|
3
|
-
* @Date : 2023-12-20 22:21:11
|
4
|
-
* @FilePath : /visualifyjs/src/core/widgets/layout/Grid.js
|
5
|
-
* @Description :
|
6
|
-
* Copyright (c) 2023 by Lihao (leolihao@arizona.edu), All Rights Reserved.
|
7
|
-
*/
|
8
|
-
import React from 'react';
|
9
|
-
|
10
|
-
function DynamicGrid({ config = {}, children }) {
|
11
|
-
const {
|
12
|
-
rows = 2,
|
13
|
-
cols = 2,
|
14
|
-
gap = '1px',
|
15
|
-
style = {},
|
16
|
-
debug = false,
|
17
|
-
} = config;
|
18
|
-
// Custom styles for the grid
|
19
|
-
const gridStyles = {
|
20
|
-
display: 'grid',
|
21
|
-
gridTemplateRows: `repeat(${rows}, auto)`,
|
22
|
-
gridTemplateColumns: `repeat(${cols}, 1fr)`,
|
23
|
-
gap: gap,
|
24
|
-
border: debug ? '1px solid red' : 'none',
|
25
|
-
...style,
|
26
|
-
};
|
27
|
-
|
28
|
-
return <div style={gridStyles}>{children}</div>;
|
29
|
-
}
|
30
|
-
|
31
|
-
export default DynamicGrid;
|
1
|
+
/*
|
2
|
+
* @Author : Lihao leolihao@arizona.edu
|
3
|
+
* @Date : 2023-12-20 22:21:11
|
4
|
+
* @FilePath : /visualifyjs/src/core/widgets/layout/Grid.js
|
5
|
+
* @Description :
|
6
|
+
* Copyright (c) 2023 by Lihao (leolihao@arizona.edu), All Rights Reserved.
|
7
|
+
*/
|
8
|
+
import React from 'react';
|
9
|
+
|
10
|
+
function DynamicGrid({ config = {}, children }) {
|
11
|
+
const {
|
12
|
+
rows = 2,
|
13
|
+
cols = 2,
|
14
|
+
gap = '1px',
|
15
|
+
style = {},
|
16
|
+
debug = false,
|
17
|
+
} = config;
|
18
|
+
// Custom styles for the grid
|
19
|
+
const gridStyles = {
|
20
|
+
display: 'grid',
|
21
|
+
gridTemplateRows: `repeat(${rows}, auto)`,
|
22
|
+
gridTemplateColumns: `repeat(${cols}, 1fr)`,
|
23
|
+
gap: gap,
|
24
|
+
border: debug ? '1px solid red' : 'none',
|
25
|
+
...style,
|
26
|
+
};
|
27
|
+
|
28
|
+
return <div style={gridStyles}>{children}</div>;
|
29
|
+
}
|
30
|
+
|
31
|
+
export default DynamicGrid;
|
@@ -1,36 +1,36 @@
|
|
1
|
-
/*
|
2
|
-
* @Author : Lihao leolihao@arizona.edu
|
3
|
-
* @Date : 2023-12-20 21:48:29
|
4
|
-
* @FilePath : /visualifyjs/src/core/widgets/layout.js
|
5
|
-
* @Description :
|
6
|
-
* Copyright (c) 2023 by Lihao (leolihao@arizona.edu), All Rights Reserved.
|
7
|
-
*/
|
8
|
-
import React from 'react';
|
9
|
-
import DynamicGrid from './layout/Grid';
|
10
|
-
|
11
|
-
function LayoutParser({ config = {}, children }) {
|
12
|
-
const { type = 'grid', ...rest } = config;
|
13
|
-
|
14
|
-
if (type === 'grid') {
|
15
|
-
return (
|
16
|
-
<>
|
17
|
-
<DynamicGrid config={{ ...rest }}>
|
18
|
-
{React.cloneElement(children, { layout: type })}
|
19
|
-
</DynamicGrid>
|
20
|
-
</>
|
21
|
-
);
|
22
|
-
}
|
23
|
-
|
24
|
-
return (
|
25
|
-
<div>
|
26
|
-
<h1>LayoutParser</h1>
|
27
|
-
<span>
|
28
|
-
We are not support <b>{type}</b> layout type yet
|
29
|
-
</span>
|
30
|
-
<br></br>
|
31
|
-
{children}
|
32
|
-
</div>
|
33
|
-
);
|
34
|
-
}
|
35
|
-
|
36
|
-
export default LayoutParser;
|
1
|
+
/*
|
2
|
+
* @Author : Lihao leolihao@arizona.edu
|
3
|
+
* @Date : 2023-12-20 21:48:29
|
4
|
+
* @FilePath : /visualifyjs/src/core/widgets/layout.js
|
5
|
+
* @Description :
|
6
|
+
* Copyright (c) 2023 by Lihao (leolihao@arizona.edu), All Rights Reserved.
|
7
|
+
*/
|
8
|
+
import React from 'react';
|
9
|
+
import DynamicGrid from './layout/Grid';
|
10
|
+
|
11
|
+
function LayoutParser({ config = {}, children }) {
|
12
|
+
const { type = 'grid', ...rest } = config;
|
13
|
+
|
14
|
+
if (type === 'grid') {
|
15
|
+
return (
|
16
|
+
<>
|
17
|
+
<DynamicGrid config={{ ...rest }}>
|
18
|
+
{React.cloneElement(children, { layout: type })}
|
19
|
+
</DynamicGrid>
|
20
|
+
</>
|
21
|
+
);
|
22
|
+
}
|
23
|
+
|
24
|
+
return (
|
25
|
+
<div>
|
26
|
+
<h1>LayoutParser</h1>
|
27
|
+
<span>
|
28
|
+
We are not support <b>{type}</b> layout type yet
|
29
|
+
</span>
|
30
|
+
<br></br>
|
31
|
+
{children}
|
32
|
+
</div>
|
33
|
+
);
|
34
|
+
}
|
35
|
+
|
36
|
+
export default LayoutParser;
|