+
- ) : (
-
- )
+ isDark
+ ? (
+
+ )
+ : (
+
+ )
}
/>
@@ -291,7 +295,7 @@ const renderMobileActions = ({ t, isTopDarkHeader, isDark, handleThemeToggle, mo
style={{
fontSize: 20,
cursor: 'pointer',
- color: isTopDarkHeader ? '#fff' : undefined,
+ color: isTopDarkHeader ? '#fff' : undefined
}}
/>
@@ -301,11 +305,13 @@ const renderMobileActions = ({ t, isTopDarkHeader, isDark, handleThemeToggle, mo
const renderHeaderActions = (isMobile, props) => (isMobile ? renderMobileActions(props) : renderDesktopActions(props))
const renderUserTrigger = (isAuthenticated, user, iconButtonStyle) =>
- isAuthenticated && user ? (
- } />
- ) : (
- } type="default" shape="round" style={iconButtonStyle} />
- )
+ isAuthenticated && user
+ ? (
+ } />
+ )
+ : (
+ } type='default' shape='round' style={iconButtonStyle} />
+ )
const ProHeader = ({ layout, onSettingClick, children, onMobileMenuClick }) => {
const { t } = useTranslation()
@@ -346,7 +352,7 @@ const ProHeader = ({ layout, onSettingClick, children, onMobileMenuClick }) => {
onSettingClick,
redirectGithub,
redirectWiki,
- redirectWrapped,
+ redirectWrapped
}),
[t, primaryNavItems, onSettingClick, redirectGithub, redirectWiki, redirectWrapped]
)
@@ -380,7 +386,7 @@ const ProHeader = ({ layout, onSettingClick, children, onMobileMenuClick }) => {
)
const {
- token: { colorBgContainer, colorBorder },
+ token: { colorBgContainer, colorBorder }
} = theme.useToken()
const { themeSettings, updateSettings } = useProThemeContext()
const prefersDark =
@@ -420,19 +426,19 @@ const ProHeader = ({ layout, onSettingClick, children, onMobileMenuClick }) => {
style={{
backgroundColor: headerBackground,
borderBottom: headerBorder,
- padding: isMobile ? '0 16px' : 0,
+ padding: isMobile ? '0 16px' : 0
}}
>
{renderMobileMenuTrigger(isMobile, onMobileMenuClick)}
redirectTo('/')}
style={isMobile ? { flex: '0 0 auto', justifyContent: 'flex-start' } : {}}
>
{/* Pro React
{process.env.DEPLOYED_ENV} */}
- {!isMobile &&

}
-
+ {!isMobile &&

}
+
{renderDesktopNav(isMobile, layout, children)}
@@ -448,7 +454,7 @@ const ProHeader = ({ layout, onSettingClick, children, onMobileMenuClick }) => {
redirectWiki,
redirectWrapped,
mobileMoreItems,
- setSearchOpen,
+ setSearchOpen
})}
{renderUserTrigger(isAuthenticated, user, iconButtonStyle)}
@@ -467,7 +473,7 @@ ProHeader.propTypes = {
onSettingClick: PropTypes.func,
children: PropTypes.node,
// `isMobile` 由全局 Zustand 管理,组件直接读取,不再通过 props 传入
- onMobileMenuClick: PropTypes.func,
+ onMobileMenuClick: PropTypes.func
}
export default ProHeader
diff --git a/src/pages/layout/proSecNav/index.jsx b/src/pages/layout/proSecNav/index.jsx
index 72a6163d..cdc1ff5a 100644
--- a/src/pages/layout/proSecNav/index.jsx
+++ b/src/pages/layout/proSecNav/index.jsx
@@ -10,10 +10,12 @@ import { annotatedRootRouter, flattenRoutes } from '@src/routers'
import styles from './index.module.less'
+import { mainLayoutMenu } from '@src/config/menu.config'
+
const PAGE_EXTENSIONS = ['.jsx', '.tsx', '.js', '.ts']
const PAGE_CANDIDATE_TEMPLATES = [
(path, ext) => `/src/pages${path}${ext}`,
- (path, ext) => `/src/pages${path}/index${ext}`,
+ (path, ext) => `/src/pages${path}/index${ext}`
]
const pageModules = import.meta?.glob?.('/src/pages/**/*.{js,jsx,ts,tsx}') ?? {}
@@ -66,8 +68,6 @@ const resolvePageModuleKey = (() => {
}
})()
-import { mainLayoutMenu } from '@src/config/menu.config'
-
let lazyComponentsCache = null
let lazyComponentsPromise = null
const loadLazyComponents = () => {
@@ -208,7 +208,7 @@ const ProSecNav = ({ mode = 'inline', theme = 'light', onMenuClick }) => {
}
return (
-
+
{labelText || path}
)
@@ -228,7 +228,7 @@ const ProSecNav = ({ mode = 'inline', theme = 'light', onMenuClick }) => {
const base = {
...rest,
path,
- label: Label,
+ label: Label
}
if (children && Array.isArray(children)) {
const validChildren = children.map(translateItem).filter(Boolean)
@@ -442,7 +442,7 @@ const ProSecNav = ({ mode = 'inline', theme = 'light', onMenuClick }) => {
ProSecNav.propTypes = {
mode: PropTypes.string,
theme: PropTypes.string,
- onMenuClick: PropTypes.func,
+ onMenuClick: PropTypes.func
}
export default ProSecNav
diff --git a/src/routers/authRouter.jsx b/src/routers/authRouter.jsx
index d3539c95..bf91a9a2 100644
--- a/src/routers/authRouter.jsx
+++ b/src/routers/authRouter.jsx
@@ -51,7 +51,7 @@ const AuthRouter = (props) => {
matchPath(
{
path: pattern.endsWith('/*') ? pattern : `${pattern}/*`,
- end: false,
+ end: false
},
normalized
)
@@ -208,7 +208,7 @@ const AuthRouter = (props) => {
return (
<>
{contextHolder}
-
+
>
)
}
@@ -227,7 +227,7 @@ const AuthRouter = (props) => {
AuthRouter.propTypes = {
route: PropTypes.object,
- children: PropTypes.node,
+ children: PropTypes.node
}
export default AuthRouter
diff --git a/src/routers/modules/chart.routes.jsx b/src/routers/modules/chart.routes.jsx
index 38748022..ef5bcb4d 100644
--- a/src/routers/modules/chart.routes.jsx
+++ b/src/routers/modules/chart.routes.jsx
@@ -10,36 +10,36 @@ export const chartRoutes = [
path: 'geo',
name: 'Geo Chart',
key: '/geo',
- element: ,
+ element:
},
{
path: 'echarts',
name: 'React Echarts',
key: '/echarts',
- element: ,
+ element:
},
{
path: 'big-screen',
name: 'Big Screen',
key: '/big-screen',
- element: ,
+ element:
},
{
path: 'svg-viewer',
name: 'SVG Viewer',
key: '/svg-viewer',
- element: ,
+ element:
},
{
path: 'topology',
name: 'Topology',
key: '/topology',
- element: ,
+ element:
},
{
path: 'mermaid',
name: 'Mermaid',
key: '/mermaid',
- element: ,
- },
+ element:
+ }
]
diff --git a/src/utils/hashRouter.ts b/src/utils/hashRouter.ts
index 6d8e884c..359ab623 100644
--- a/src/utils/hashRouter.ts
+++ b/src/utils/hashRouter.ts
@@ -23,13 +23,13 @@ export class HashRouterUtils {
g[key] += 1
// 尽量输出可读信息,同时给出调用栈
-
+
console.groupCollapsed(`[DEBUG_NAV_TO] non-string to/path from ${source}`)
-
+
console.log('value:', value)
-
+
console.trace('stack')
-
+
console.groupEnd()
} catch {
// ignore
diff --git a/webpack/webpack.common.js b/webpack/webpack.common.js
index 7ea5d556..57d4fc96 100644
--- a/webpack/webpack.common.js
+++ b/webpack/webpack.common.js
@@ -82,7 +82,7 @@ const prodPublicPath = normalizePublicPath(
const config = {
entry: {
- app: `${paths.src}/index.tsx`,
+ app: `${paths.src}/index.tsx`
},
output: {
path: paths.build,
@@ -92,7 +92,7 @@ const config = {
// library: '',
// libraryTarget: 'umd',
// chunkLoadingGlobal: '',
- clean: true,
+ clean: true
// contentBase: path.join(__dirname, "public"), // 配置额外的静态文件内容的访问路径
},
resolve: {
@@ -111,16 +111,16 @@ const config = {
'@pages': path.resolve('./src/pages'),
'@routers': path.resolve('./src/routers'),
'@utils': path.resolve('./src/utils'),
- '@theme': path.resolve('./src/theme'),
+ '@theme': path.resolve('./src/theme')
},
- symlinks: false,
+ symlinks: false
},
plugins: [
new Dotenv({
- path: path.resolve(__dirname, '..', dotEnv),
+ path: path.resolve(__dirname, '..', dotEnv)
}),
codeInspectorPlugin({
- bundler: 'webpack',
+ bundler: 'webpack'
}),
new HtmlWebpackPlugin({
title: isDev ? 'Pro React Dev' : 'Pro React Admin',
@@ -144,8 +144,8 @@ const config = {
minifyCSS: true,
minifyJS: true,
minifyURLs: true,
- useShortDoctype: true,
- },
+ useShortDoctype: true
+ }
}),
new AntdDayjsWebpackPlugin(),
new CaseSensitivePathsPlugin(),
@@ -159,7 +159,7 @@ const config = {
new NodePolyfillPlugin(),
new WebpackBar(),
new ForkTsCheckerWebpackPlugin({
- async: true,
+ async: true
}),
new ESLintWebpackPlugin({
// 指定检查文件的根目录
@@ -167,8 +167,8 @@ const config = {
exclude: 'node_modules', // 默认值
cache: true, // 开启缓存
// 缓存目录
- cacheLocation: path.resolve(__dirname, '../node_modules/.cache/.eslintcache'),
- }),
+ cacheLocation: path.resolve(__dirname, '../node_modules/.cache/.eslintcache')
+ })
],
module: {
// 将缺失的导出提示成错误而不是警告
@@ -177,8 +177,8 @@ const config = {
{
test: /\.m?js$/,
resolve: {
- fullySpecified: false,
- },
+ fullySpecified: false
+ }
},
{
test: /\.module\.css$/,
@@ -195,18 +195,18 @@ const config = {
localIdentName: isDev ? '[path][name]__[local]--[hash:base64:5]' : '[local]--[hash:base64:5]',
localIdentContext: paths.src,
namedExport: false,
- exportLocalsConvention: 'camelCase',
+ exportLocalsConvention: 'camelCase'
},
- importLoaders: 1,
- },
+ importLoaders: 1
+ }
},
- 'postcss-loader',
- ],
+ 'postcss-loader'
+ ]
},
{
test: /\.css$/,
exclude: /\.module\.css$/,
- use: ['style-loader', 'css-loader', 'postcss-loader'],
+ use: ['style-loader', 'css-loader', 'postcss-loader']
},
{
test: /\.less$/i,
@@ -223,10 +223,10 @@ const config = {
localIdentName: isDev ? '[path][name]__[local]--[hash:base64:5]' : '[local]--[hash:base64:5]',
localIdentContext: paths.src,
namedExport: false,
- exportLocalsConvention: 'camelCase',
+ exportLocalsConvention: 'camelCase'
},
- importLoaders: 2,
- },
+ importLoaders: 2
+ }
},
{
loader: 'postcss-loader',
@@ -240,18 +240,18 @@ const config = {
'postcss-preset-env',
{
autoprefixer: {
- flexbox: 'no-2009',
+ flexbox: 'no-2009'
},
- stage: 3,
- },
+ stage: 3
+ }
],
- 'postcss-normalize',
- ],
+ 'postcss-normalize'
+ ]
},
- sourceMap: true,
- },
- },
- ],
+ sourceMap: true
+ }
+ }
+ ]
},
{
test: /\.(js|jsx|ts|tsx)$/,
@@ -261,17 +261,17 @@ const config = {
loader: 'esbuild-loader',
options: {
// loader: 'tsx',
- target: 'es2020',
- },
+ target: 'es2020'
+ }
},
{
loader: 'babel-loader',
options: {
presets: [['@babel/preset-env', { modules: false }], '@babel/preset-react'],
- plugins: ['@babel/plugin-transform-object-rest-spread', '@babel/plugin-transform-runtime'],
- },
- },
- ],
+ plugins: ['@babel/plugin-transform-object-rest-spread', '@babel/plugin-transform-runtime']
+ }
+ }
+ ]
},
{
test: /\.(png|jpe?g|gif|webp|eot|ttf|woff|woff2|mp4|mp3|mkv|pdf)$/i,
@@ -279,29 +279,29 @@ const config = {
parser: {
// Conditions for converting to base64
dataUrlCondition: {
- maxSize: 25 * 1024, // 25kb
- },
+ maxSize: 25 * 1024 // 25kb
+ }
},
generator: {
- filename: 'images/[contenthash][ext][query]',
- },
+ filename: 'images/[contenthash][ext][query]'
+ }
},
{
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
- loader: 'babel-loader',
+ loader: 'babel-loader'
},
{
loader: '@svgr/webpack',
options: {
babel: false,
- icon: true,
- },
- },
- ],
- },
- ],
+ icon: true
+ }
+ }
+ ]
+ }
+ ]
},
stats: {
...(isAnalyze
@@ -318,7 +318,7 @@ const config = {
dependentModules: true,
reasons: true,
ids: true,
- errorDetails: true,
+ errorDetails: true
}
: {
all: false,
@@ -326,15 +326,15 @@ const config = {
warnings: true,
errorDetails: true,
moduleTrace: true,
- excludeAssets: /node_modules/,
- }),
+ excludeAssets: /node_modules/
+ })
},
// 性能提示
performance: {
hints: isDev ? false : 'warning',
maxEntrypointSize: 512000,
- maxAssetSize: 512000,
- },
+ maxAssetSize: 512000
+ }
}
if (USE_ANALYZE) {
diff --git a/webpack/webpack.prod.js b/webpack/webpack.prod.js
index dfecefa8..09021e33 100644
--- a/webpack/webpack.prod.js
+++ b/webpack/webpack.prod.js
@@ -42,8 +42,8 @@ const prodWebpackConfig = merge(common, {
? {
alias: {
...(hasOptimizedAudio ? { '@assets/audio': optimizedAudioDir } : {}),
- ...(hasOptimizedVideo ? { '@assets/video': optimizedVideoDir } : {}),
- },
+ ...(hasOptimizedVideo ? { '@assets/video': optimizedVideoDir } : {})
+ }
}
: undefined,
// 使用文件缓存
@@ -53,42 +53,42 @@ const prodWebpackConfig = merge(common, {
devtool: process.env.DEBUG_PROD === '1' ? 'source-map' : false,
plugins: [
new webpack.ProvidePlugin({
- React: 'react',
+ React: 'react'
}),
new MiniCssExtractPlugin({
filename: 'static/css/[name].[contenthash].css',
chunkFilename: 'static/css/[name].[contenthash].css',
- ignoreOrder: true,
+ ignoreOrder: true
}),
new PurgeCSSPlugin({
paths: glob.sync(`${path.join(__dirname, '../src')}/**/*`, { nodir: true }),
only: ['bundle', 'vendor', 'dist'],
safelist: {
- standard: [/^ant-/],
- },
+ standard: [/^ant-/]
+ }
}),
new CompressionWebpackPlugin({
algorithm: 'gzip',
test: /\.(js|css|html|svg)$/,
threshold: 8192,
- minRatio: 0.8,
+ minRatio: 0.8
}),
new CopyWebpackPlugin({
patterns: [
{
from: path.resolve(__dirname, '../public-optimized/audio'),
to: path.resolve(__dirname, '../dist/audio'),
- noErrorOnMissing: true,
+ noErrorOnMissing: true
},
{
from: path.resolve(__dirname, '../public'),
to: path.resolve(__dirname, '../dist'),
globOptions: {
- ignore: ['**/index.html', '**/audio/**'],
- },
- },
- ],
- }),
+ ignore: ['**/index.html', '**/audio/**']
+ }
+ }
+ ]
+ })
],
optimization: {
minimize: process.env.DEBUG_PROD !== '1',
@@ -98,7 +98,7 @@ const prodWebpackConfig = merge(common, {
: [
new CssMinimizerPlugin(),
new EsbuildPlugin({
- target: 'es2015',
+ target: 'es2015'
}),
new HtmlMinimizerPlugin(),
new ImageMinimizerPlugin({
@@ -112,11 +112,11 @@ const prodWebpackConfig = merge(common, {
jpeg: { quality: 78, mozjpeg: true },
png: { compressionLevel: 9, palette: true },
webp: { quality: 80 },
- avif: { quality: 50 },
- },
- },
- },
- }),
+ avif: { quality: 50 }
+ }
+ }
+ }
+ })
],
splitChunks: {
chunks: 'all',
@@ -131,35 +131,35 @@ const prodWebpackConfig = merge(common, {
minChunks: 1,
priority: 10,
enforce: true,
- chunks: 'all',
+ chunks: 'all'
},
react: {
- test(module) {
+ test (module) {
return module.resource && module.resource.includes('node_modules/react')
},
chunks: 'initial',
filename: 'react.[contenthash].js',
priority: 1,
maxInitialRequests: 2,
- minChunks: 1,
- },
+ minChunks: 1
+ }
// commons: {
// name: 'commons',
// minChunks: 2,
// chunks: 'all',
// priority: 5,
// },
- },
+ }
},
runtimeChunk: {
- name: 'runtime',
- },
+ name: 'runtime'
+ }
},
performance: {
hints: 'warning',
maxEntrypointSize: 800000,
- maxAssetSize: 400000,
- },
+ maxAssetSize: 400000
+ }
})
if (useSentryMap) {
@@ -173,7 +173,7 @@ if (useSentryMap) {
authToken: sentryAuthToken,
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
- telemetry: false,
+ telemetry: false
})
)
} else {
@@ -195,11 +195,11 @@ if (process.env.DIST_ZIP === '1' || process.env.DIST_ZIP === 'true') {
archive: [
{
source: path.resolve(__dirname, '../dist'),
- destination: path.resolve(__dirname, '../dist-zip/pro-react-admin.zip'),
- },
- ],
- },
- },
+ destination: path.resolve(__dirname, '../dist-zip/pro-react-admin.zip')
+ }
+ ]
+ }
+ }
})
)
}