Complete main UI #37

Merged
FatttSnake merged 192 commits from FatttSnake into dev 2024-02-23 16:31:17 +08:00
63 changed files with 217 additions and 275 deletions
Showing only changes of commit b0be3bc4a7 - Show all commits

View File

@@ -1,4 +1,3 @@
import React from 'react'
import { getRouter } from '@/router' import { getRouter } from '@/router'
import FullscreenLoadingMask from '@/components/common/FullscreenLoadingMask' import FullscreenLoadingMask from '@/components/common/FullscreenLoadingMask'
@@ -6,7 +5,7 @@ export const AppContext = createContext<{ refreshRouter: () => void }>({
refreshRouter: () => undefined refreshRouter: () => undefined
}) })
const App: React.FC = () => { const App = () => {
const [routerState, setRouterState] = useState(getRouter) const [routerState, setRouterState] = useState(getRouter)
return ( return (

8
src/ant-design.d.ts vendored
View File

@@ -1,4 +1,4 @@
import * as React from 'react' import { ComponentType, ForwardRefExoticComponent, Key, SVGProps } from 'react'
import { CustomIconComponentProps } from '@ant-design/icons/es/components/Icon' import { CustomIconComponentProps } from '@ant-design/icons/es/components/Icon'
import { TablePaginationConfig } from 'antd/lib' import { TablePaginationConfig } from 'antd/lib'
import { ColumnsType, FilterValue, SorterResult, SortOrder } from 'antd/es/table/interface' import { ColumnsType, FilterValue, SorterResult, SortOrder } from 'antd/es/table/interface'
@@ -7,8 +7,8 @@ import type { DataNode } from 'antd/es/tree'
declare global { declare global {
type IconComponent = type IconComponent =
| React.ComponentType<CustomIconComponentProps | React.SVGProps<SVGSVGElement>> | ComponentType<CustomIconComponentProps | SVGProps<SVGSVGElement>>
| React.ForwardRefExoticComponent<CustomIconComponentProps> | ForwardRefExoticComponent<CustomIconComponentProps>
type _TablePaginationConfig = TablePaginationConfig type _TablePaginationConfig = TablePaginationConfig
@@ -18,7 +18,7 @@ declare global {
type _SortOrder = SortOrder type _SortOrder = SortOrder
type _CheckboxChangeEvent = CheckboxChangeEvent type _CheckboxChangeEvent = CheckboxChangeEvent
interface _DataNode extends DataNode { interface _DataNode extends DataNode {
value: React.Key value: Key
fullTitle?: string fullTitle?: string
parentId?: number parentId?: number
children?: _DataNode[] children?: _DataNode[]

View File

@@ -1,4 +1,3 @@
import React from 'react'
import { editor, Selection } from 'monaco-editor' import { editor, Selection } from 'monaco-editor'
import MonacoEditor, { Monaco } from '@monaco-editor/react' import MonacoEditor, { Monaco } from '@monaco-editor/react'
import '@/components/Playground/CodeEditor/Editor/editor.scss' import '@/components/Playground/CodeEditor/Editor/editor.scss'
@@ -19,7 +18,7 @@ interface EditorProps {
onJumpFile?: (fileName: string) => void onJumpFile?: (fileName: string) => void
} }
const Editor: React.FC<EditorProps> = ({ const Editor = ({
tsConfig, tsConfig,
files = {}, files = {},
selectedFileName = '', selectedFileName = '',
@@ -28,7 +27,7 @@ const Editor: React.FC<EditorProps> = ({
onChange, onChange,
options, options,
onJumpFile onJumpFile
}) => { }: EditorProps) => {
const editorRef = useRef<editor.IStandaloneCodeEditor>() const editorRef = useRef<editor.IStandaloneCodeEditor>()
const monacoRef = useRef<Monaco>() const monacoRef = useRef<Monaco>()
const { doOpenEditor, loadJsxSyntaxHighlight, autoLoadExtraLib } = useEditor() const { doOpenEditor, loadJsxSyntaxHighlight, autoLoadExtraLib } = useEditor()

View File

@@ -1,4 +1,4 @@
import React from 'react' import { Dispatch, SetStateAction, KeyboardEvent, ChangeEvent, MouseEvent } from 'react'
interface ItemProps { interface ItemProps {
className?: string className?: string
@@ -7,7 +7,7 @@ interface ItemProps {
value: string value: string
active?: boolean active?: boolean
hasEditing?: boolean hasEditing?: boolean
setHasEditing?: React.Dispatch<React.SetStateAction<boolean>> setHasEditing?: Dispatch<SetStateAction<boolean>>
onOk?: (fileName: string) => void onOk?: (fileName: string) => void
onCancel?: () => void onCancel?: () => void
onRemove?: (fileName: string) => void onRemove?: (fileName: string) => void
@@ -15,7 +15,7 @@ interface ItemProps {
onValidate?: (newFileName: string, oldFileName: string) => boolean onValidate?: (newFileName: string, oldFileName: string) => boolean
} }
const Item: React.FC<ItemProps> = ({ const Item = ({
className, className,
readonly = false, readonly = false,
value, value,
@@ -28,7 +28,7 @@ const Item: React.FC<ItemProps> = ({
onClick, onClick,
onValidate, onValidate,
...prop ...prop
}) => { }: ItemProps) => {
const inputRef = useRef<HTMLInputElement>(null) const inputRef = useRef<HTMLInputElement>(null)
const [fileName, setFileName] = useState(value) const [fileName, setFileName] = useState(value)
const [creating, setCreating] = useState(prop.creating) const [creating, setCreating] = useState(prop.creating)
@@ -41,7 +41,7 @@ const Item: React.FC<ItemProps> = ({
onClick?.() onClick?.()
} }
const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => { const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {
if (event.key === 'Enter') { if (event.key === 'Enter') {
event.preventDefault() event.preventDefault()
finishNameFile() finishNameFile()
@@ -89,11 +89,11 @@ const Item: React.FC<ItemProps> = ({
}) })
} }
const handleOnChange = (e: React.ChangeEvent<HTMLInputElement>) => { const handleOnChange = (e: ChangeEvent<HTMLInputElement>) => {
setFileName(e.target.value) setFileName(e.target.value)
} }
const handleOnDelete = (e: React.MouseEvent<HTMLDivElement>) => { const handleOnDelete = (e: MouseEvent<HTMLDivElement>) => {
e.stopPropagation() e.stopPropagation()
if (hasEditing) { if (hasEditing) {
return return

View File

@@ -1,4 +1,3 @@
import React from 'react'
import '@/components/Playground/CodeEditor/FileSelector/file-selector.scss' import '@/components/Playground/CodeEditor/FileSelector/file-selector.scss'
import HideScrollbar, { HideScrollbarElement } from '@/components/common/HideScrollbar' import HideScrollbar, { HideScrollbarElement } from '@/components/common/HideScrollbar'
import FlexBox from '@/components/common/FlexBox' import FlexBox from '@/components/common/FlexBox'
@@ -22,7 +21,7 @@ interface FileSelectorProps {
selectedFileName?: string selectedFileName?: string
} }
const FileSelector: React.FC<FileSelectorProps> = ({ const FileSelector = ({
files = {}, files = {},
onChange, onChange,
onError, onError,
@@ -32,7 +31,7 @@ const FileSelector: React.FC<FileSelectorProps> = ({
onAddFile, onAddFile,
onUpdateFileName, onUpdateFileName,
selectedFileName = '' selectedFileName = ''
}) => { }: FileSelectorProps) => {
const hideScrollbarRef = useRef<HideScrollbarElement>(null) const hideScrollbarRef = useRef<HideScrollbarElement>(null)
const [tabs, setTabs] = useState<string[]>([]) const [tabs, setTabs] = useState<string[]>([])
const [creating, setCreating] = useState(false) const [creating, setCreating] = useState(false)

View File

@@ -1,4 +1,3 @@
import React from 'react'
import _ from 'lodash' import _ from 'lodash'
import '@/components/Playground/CodeEditor/code-editor.scss' import '@/components/Playground/CodeEditor/code-editor.scss'
import FlexBox from '@/components/common/FlexBox' import FlexBox from '@/components/common/FlexBox'
@@ -29,7 +28,7 @@ interface CodeEditorProps {
onError?: (msg: string) => void onError?: (msg: string) => void
} }
const CodeEditor: React.FC<CodeEditorProps> = ({ const CodeEditor = ({
theme, theme,
tsConfig, tsConfig,
files, files,
@@ -44,7 +43,7 @@ const CodeEditor: React.FC<CodeEditorProps> = ({
onChangeFileContent, onChangeFileContent,
onError, onError,
...props ...props
}) => { }: CodeEditorProps) => {
const filteredFilesName = getFileNameList(files).filter( const filteredFilesName = getFileNameList(files).filter(
(item) => ![IMPORT_MAP_FILE_NAME, TS_CONFIG_FILE_NAME].includes(item) && !files[item].hidden (item) => ![IMPORT_MAP_FILE_NAME, TS_CONFIG_FILE_NAME].includes(item) && !files[item].hidden
) )

View File

@@ -1,4 +1,3 @@
import React, { useRef, useState } from 'react'
import { useUpdatedEffect } from '@/util/hooks' import { useUpdatedEffect } from '@/util/hooks'
import '@/components/Playground/Output/Preview/preview.scss' import '@/components/Playground/Output/Preview/preview.scss'
import { IFiles, IImportMap } from '@/components/Playground/shared' import { IFiles, IImportMap } from '@/components/Playground/shared'
@@ -34,7 +33,7 @@ const getIframeUrl = (iframeRaw: string) => {
const iframeUrl = getIframeUrl(iframeRaw) const iframeUrl = getIframeUrl(iframeRaw)
const Preview: React.FC<PreviewProps> = ({ iframeKey, files, importMap }) => { const Preview = ({ iframeKey, files, importMap }: PreviewProps) => {
const iframeRef = useRef<HTMLIFrameElement>(null) const iframeRef = useRef<HTMLIFrameElement>(null)
const [errorMsg, setErrorMsg] = useState('') const [errorMsg, setErrorMsg] = useState('')
const [loaded, setLoaded] = useState(false) const [loaded, setLoaded] = useState(false)

View File

@@ -1,4 +1,3 @@
import React from 'react'
import MonacoEditor from '@monaco-editor/react' import MonacoEditor from '@monaco-editor/react'
import { Loader } from 'esbuild-wasm' import { Loader } from 'esbuild-wasm'
import '@/components/Playground/Output/Transform/transform.scss' import '@/components/Playground/Output/Transform/transform.scss'
@@ -13,7 +12,7 @@ interface OutputProps {
theme?: ITheme theme?: ITheme
} }
const Transform: React.FC<OutputProps> = ({ file, theme }) => { const Transform = ({ file, theme }: OutputProps) => {
const [compiledCode, setCompiledCode] = useState('') const [compiledCode, setCompiledCode] = useState('')
const [errorMsg, setErrorMsg] = useState('') const [errorMsg, setErrorMsg] = useState('')

View File

@@ -1,4 +1,3 @@
import React from 'react'
import FlexBox from '@/components/common/FlexBox' import FlexBox from '@/components/common/FlexBox'
import { IFiles, IImportMap } from '@/components/Playground/shared' import { IFiles, IImportMap } from '@/components/Playground/shared'
import FileSelector from '@/components/Playground/CodeEditor/FileSelector' import FileSelector from '@/components/Playground/CodeEditor/FileSelector'
@@ -11,7 +10,7 @@ interface OutputProps {
importMap: IImportMap importMap: IImportMap
} }
const Output: React.FC<OutputProps> = ({ files, selectedFileName, importMap }) => { const Output = ({ files, selectedFileName, importMap }: OutputProps) => {
const [selectedTab, setSelectedTab] = useState('Preview') const [selectedTab, setSelectedTab] = useState('Preview')
return ( return (

View File

@@ -1,4 +1,3 @@
import React, { useState } from 'react'
import '@/components/Playground/playground.scss' import '@/components/Playground/playground.scss'
import { useUpdatedEffect } from '@/util/hooks' import { useUpdatedEffect } from '@/util/hooks'
import { IFiles, IImportMap, ITsConfig } from '@/components/Playground/shared' import { IFiles, IImportMap, ITsConfig } from '@/components/Playground/shared'
@@ -17,11 +16,7 @@ interface PlaygroundProps {
initTsConfigRaw: string initTsConfigRaw: string
} }
const Playground: React.FC<PlaygroundProps> = ({ const Playground = ({ initFiles, initImportMapRaw, initTsConfigRaw }: PlaygroundProps) => {
initFiles,
initImportMapRaw,
initTsConfigRaw
}) => {
const [files, setFiles] = useState(initFiles) const [files, setFiles] = useState(initFiles)
const [selectedFileName, setSelectedFileName] = useState(MAIN_FILE_NAME) const [selectedFileName, setSelectedFileName] = useState(MAIN_FILE_NAME)
const [importMapRaw, setImportMapRaw] = useState<string>(initImportMapRaw) const [importMapRaw, setImportMapRaw] = useState<string>(initImportMapRaw)

View File

@@ -1,8 +1,7 @@
import React from 'react' import { DetailedHTMLProps, HTMLAttributes } from 'react'
import '@/assets/css/components/common/card.scss' import '@/assets/css/components/common/card.scss'
interface CardProps interface CardProps extends DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> {}
extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {}
const Card = forwardRef<HTMLDivElement, CardProps>(({ className, ...props }, ref) => { const Card = forwardRef<HTMLDivElement, CardProps>(({ className, ...props }, ref) => {
return <div className={`card-box${className ? ` ${className}` : ''}`} {...props} ref={ref} /> return <div className={`card-box${className ? ` ${className}` : ''}`} {...props} ref={ref} />

View File

@@ -1,12 +1,11 @@
import React from 'react' import { DetailedHTMLProps, HTMLAttributes } from 'react'
import '@/assets/css/components/common/fit-center.scss' import '@/assets/css/components/common/fit-center.scss'
interface FitCenterProps interface FitCenterProps extends DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
vertical?: boolean vertical?: boolean
} }
const FitCenter: React.FC<FitCenterProps> = ({ className, vertical, ...props }) => { const FitCenter = ({ className, vertical, ...props }: FitCenterProps) => {
return ( return (
<div <div
className={`fit-center${className ? ` ${className}` : ''}${ className={`fit-center${className ? ` ${className}` : ''}${

View File

@@ -1,8 +1,8 @@
import React from 'react' import { DetailedHTMLProps, HTMLAttributes } from 'react'
import '@/assets/css/components/common/fit-fullscreen.scss' import '@/assets/css/components/common/fit-fullscreen.scss'
interface FitFullscreenProps interface FitFullscreenProps
extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> { extends DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
zIndex?: number zIndex?: number
backgroundColor?: string backgroundColor?: string
} }

View File

@@ -1,8 +1,7 @@
import React from 'react' import { DetailedHTMLProps, HTMLAttributes } from 'react'
import '@/assets/css/components/common/flex-box.scss' import '@/assets/css/components/common/flex-box.scss'
interface FlexBoxProps interface FlexBoxProps extends DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
direction?: 'horizontal' | 'vertical' direction?: 'horizontal' | 'vertical'
gap?: number gap?: number
} }

View File

@@ -1,10 +1,9 @@
import React from 'react'
import Icon from '@ant-design/icons' import Icon from '@ant-design/icons'
import '@/assets/css/components/common/fullscreen-loading-mask.scss' import '@/assets/css/components/common/fullscreen-loading-mask.scss'
import { COLOR_FONT_MAIN } from '@/constants/common.constants' import { COLOR_FONT_MAIN } from '@/constants/common.constants'
import FitFullscreen from '@/components/common/FitFullscreen' import FitFullscreen from '@/components/common/FitFullscreen'
const FullscreenLoadingMask: React.FC = () => { const FullscreenLoadingMask = () => {
const loadingIcon = ( const loadingIcon = (
<> <>
<Icon <Icon

View File

@@ -1,8 +1,8 @@
import React from 'react' import { TouchEvent, MouseEvent, KeyboardEvent, DetailedHTMLProps, HTMLAttributes } from 'react'
import '@/assets/css/components/common/hide-scrollbar.scss' import '@/assets/css/components/common/hide-scrollbar.scss'
interface HideScrollbarProps interface HideScrollbarProps
extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> { extends DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
isPreventScroll?: boolean isPreventScroll?: boolean
isPreventVerticalScroll?: boolean isPreventVerticalScroll?: boolean
isPreventHorizontalScroll?: boolean isPreventHorizontalScroll?: boolean
@@ -210,7 +210,7 @@ const HideScrollbar = forwardRef<HideScrollbarElement, HideScrollbarProps>(
}, [autoHideWaitingTime, horizontalScrollbarPosition]) }, [autoHideWaitingTime, horizontalScrollbarPosition])
const handleDefaultTouchStart = useCallback( const handleDefaultTouchStart = useCallback(
(event: React.TouchEvent) => { (event: TouchEvent) => {
if (event.touches.length !== 1 || isPreventScroll) { if (event.touches.length !== 1 || isPreventScroll) {
lastTouchPositionRef.current = { x: -1, y: -1 } lastTouchPositionRef.current = { x: -1, y: -1 }
return return
@@ -223,7 +223,7 @@ const HideScrollbar = forwardRef<HideScrollbarElement, HideScrollbarProps>(
) )
const handleDefaultTouchmove = useCallback( const handleDefaultTouchmove = useCallback(
(event: React.TouchEvent) => { (event: TouchEvent) => {
if (event.touches.length !== 1 || isPreventScroll) { if (event.touches.length !== 1 || isPreventScroll) {
lastTouchPositionRef.current = { x: -1, y: -1 } lastTouchPositionRef.current = { x: -1, y: -1 }
return return
@@ -252,7 +252,7 @@ const HideScrollbar = forwardRef<HideScrollbarElement, HideScrollbarProps>(
[isPreventHorizontalScroll, isPreventScroll, isPreventVerticalScroll] [isPreventHorizontalScroll, isPreventScroll, isPreventVerticalScroll]
) )
const handleDefaultMouseDown = (event: React.MouseEvent) => { const handleDefaultMouseDown = (event: MouseEvent) => {
if (isPreventAnyScroll) if (isPreventAnyScroll)
if (event.button === 1) { if (event.button === 1) {
event.preventDefault() event.preventDefault()
@@ -260,7 +260,7 @@ const HideScrollbar = forwardRef<HideScrollbarElement, HideScrollbarProps>(
} }
const handleDefaultKeyDown = useCallback( const handleDefaultKeyDown = useCallback(
(event: React.KeyboardEvent) => { (event: KeyboardEvent) => {
if ( if (
isPreventScroll && isPreventScroll &&
[ [
@@ -297,7 +297,7 @@ const HideScrollbar = forwardRef<HideScrollbarElement, HideScrollbarProps>(
) )
const handleScrollbarMouseEvent = (eventFlag: string, scrollbarFlag: string) => { const handleScrollbarMouseEvent = (eventFlag: string, scrollbarFlag: string) => {
return (event: React.MouseEvent) => { return (event: MouseEvent) => {
switch (eventFlag) { switch (eventFlag) {
case 'down': case 'down':
lastScrollbarClickPositionRef.current = { lastScrollbarClickPositionRef.current = {
@@ -348,7 +348,7 @@ const HideScrollbar = forwardRef<HideScrollbarElement, HideScrollbarProps>(
} }
const handleScrollbarTouchEvent = (eventFlag: string, scrollbarFlag: string) => { const handleScrollbarTouchEvent = (eventFlag: string, scrollbarFlag: string) => {
return (event: React.TouchEvent) => { return (event: TouchEvent) => {
switch (eventFlag) { switch (eventFlag) {
case 'start': case 'start':
if (event.touches.length !== 1) { if (event.touches.length !== 1) {

View File

@@ -1,4 +1,3 @@
import React from 'react'
import _ from 'lodash' import _ from 'lodash'
import '@/assets/css/components/common/indicator.scss' import '@/assets/css/components/common/indicator.scss'
@@ -8,7 +7,7 @@ interface IndicatorProps {
onSwitch?: (index: number) => void onSwitch?: (index: number) => void
} }
const Indicator: React.FC<IndicatorProps> = ({ total, current, onSwitch }) => { const Indicator = ({ total, current, onSwitch }: IndicatorProps) => {
const handleClick = (index: number) => { const handleClick = (index: number) => {
return () => { return () => {
onSwitch?.(index) onSwitch?.(index)

View File

@@ -1,13 +1,13 @@
import React from 'react' import { PropsWithChildren, ReactNode } from 'react'
import Icon from '@ant-design/icons' import Icon from '@ant-design/icons'
import '@/assets/css/components/common/loading-mask.scss' import '@/assets/css/components/common/loading-mask.scss'
import { COLOR_FONT_MAIN } from '@/constants/common.constants' import { COLOR_FONT_MAIN } from '@/constants/common.constants'
interface LoadingMaskProps extends React.PropsWithChildren { interface LoadingMaskProps extends PropsWithChildren {
hidden?: boolean hidden?: boolean
maskContent?: React.ReactNode maskContent?: ReactNode
} }
const LoadingMask: React.FC<LoadingMaskProps> = (props) => { const LoadingMask = (props: LoadingMaskProps) => {
const loadingIcon = ( const loadingIcon = (
<> <>
<Icon <Icon

View File

@@ -1,12 +1,12 @@
import React from 'react' import { PropsWithChildren } from 'react'
import { hasPathPermission, hasPermission } from '@/util/auth' import { hasPathPermission, hasPermission } from '@/util/auth'
interface PermissionProps extends React.PropsWithChildren { interface PermissionProps extends PropsWithChildren {
operationCode?: string operationCode?: string
path?: string path?: string
} }
const Permission: React.FC<PermissionProps> = (props) => { const Permission = (props: PermissionProps) => {
if ( if (
(!props.operationCode || hasPermission(props.operationCode)) && (!props.operationCode || hasPermission(props.operationCode)) &&
(!props.path || hasPathPermission(props.path)) (!props.path || hasPathPermission(props.path))

View File

@@ -1,4 +1,3 @@
import React, { useState } from 'react'
import Icon from '@ant-design/icons' import Icon from '@ant-design/icons'
import { COLOR_ERROR } from '@/constants/common.constants' import { COLOR_ERROR } from '@/constants/common.constants'
import { getRedirectUrl } from '@/util/route' import { getRedirectUrl } from '@/util/route'
@@ -6,7 +5,7 @@ import { useUpdatedEffect } from '@/util/hooks'
import { getAvatar, getLoginStatus, getNickname, removeToken } from '@/util/auth' import { getAvatar, getLoginStatus, getNickname, removeToken } from '@/util/auth'
import { r_auth_logout } from '@/services/auth' import { r_auth_logout } from '@/services/auth'
const Footer: React.FC = () => { const Footer = () => {
const matches = useMatches() const matches = useMatches()
const lastMatch = matches.reduce((_, second) => second) const lastMatch = matches.reduce((_, second) => second)
const location = useLocation() const location = useLocation()

View File

@@ -1,4 +1,4 @@
import React from 'react' import { ReactNode, MouseEvent } from 'react'
import Icon from '@ant-design/icons' import Icon from '@ant-design/icons'
import Submenu from '@/components/common/Sidebar/Submenu' import Submenu from '@/components/common/Sidebar/Submenu'
@@ -6,15 +6,15 @@ type ItemProps = {
icon?: IconComponent icon?: IconComponent
text?: string text?: string
path: string path: string
children?: React.ReactNode children?: ReactNode
end?: boolean end?: boolean
} }
const Item: React.FC<ItemProps> = (props) => { const Item = (props: ItemProps) => {
const [submenuTop, setSubmenuTop] = useState(0) const [submenuTop, setSubmenuTop] = useState(0)
const [submenuLeft, setSubmenuLeft] = useState(0) const [submenuLeft, setSubmenuLeft] = useState(0)
const showSubmenu = (e: React.MouseEvent) => { const showSubmenu = (e: MouseEvent) => {
const parentElement = e.currentTarget.parentElement const parentElement = e.currentTarget.parentElement
if (parentElement?.childElementCount === 2) { if (parentElement?.childElementCount === 2) {
const parentClientRect = parentElement.getBoundingClientRect() const parentClientRect = parentElement.getBoundingClientRect()

View File

@@ -1,6 +1,6 @@
import React from 'react' import { PropsWithChildren } from 'react'
const ItemList: React.FC<React.PropsWithChildren> = (props) => { const ItemList = (props: PropsWithChildren) => {
return <ul>{props.children}</ul> return <ul>{props.children}</ul>
} }

View File

@@ -1,11 +1,11 @@
import React from 'react' import { PropsWithChildren } from 'react'
import HideScrollbar, { HideScrollbarElement } from '@/components/common/HideScrollbar' import HideScrollbar, { HideScrollbarElement } from '@/components/common/HideScrollbar'
export interface SidebarScrollElement { export interface SidebarScrollElement {
refreshLayout(): void refreshLayout(): void
} }
const Scroll = forwardRef<SidebarScrollElement, React.PropsWithChildren>((props, ref) => { const Scroll = forwardRef<SidebarScrollElement, PropsWithChildren>((props, ref) => {
useImperativeHandle<SidebarScrollElement, SidebarScrollElement>(ref, () => { useImperativeHandle<SidebarScrollElement, SidebarScrollElement>(ref, () => {
return { return {
refreshLayout() { refreshLayout() {

View File

@@ -1,8 +1,9 @@
import React from 'react' import { DetailedHTMLProps, HTMLAttributes } from 'react'
const Separate: React.FC< const Separate = ({
React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> className,
> = ({ className, ...props }) => { ...props
}: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>) => {
return <div className={`separate ${className ? ` ${className}` : ''}`} {...props} /> return <div className={`separate ${className ? ` ${className}` : ''}`} {...props} />
} }

View File

@@ -1,11 +1,11 @@
import React from 'react' import { PropsWithChildren } from 'react'
interface SidebarSubmenuProps extends React.PropsWithChildren { interface SidebarSubmenuProps extends PropsWithChildren {
submenuTop: number submenuTop: number
submenuLeft: number submenuLeft: number
} }
const Submenu: React.FC<SidebarSubmenuProps> = (props) => { const Submenu = (props: SidebarSubmenuProps) => {
return ( return (
<ul <ul
className={'submenu'} className={'submenu'}

View File

@@ -1,4 +1,4 @@
import React from 'react' import { PropsWithChildren, ReactNode } from 'react'
import Icon from '@ant-design/icons' import Icon from '@ant-design/icons'
import '@/assets/css/components/common/sidebar.scss' import '@/assets/css/components/common/sidebar.scss'
import { getLocalStorage, setLocalStorage } from '@/util/browser' import { getLocalStorage, setLocalStorage } from '@/util/browser'
@@ -9,21 +9,14 @@ import Separate from '@/components/common/Sidebar/Separate'
import Submenu from '@/components/common/Sidebar/Submenu' import Submenu from '@/components/common/Sidebar/Submenu'
import Footer from '@/components/common/Sidebar/Footer' import Footer from '@/components/common/Sidebar/Footer'
interface SidebarProps extends React.PropsWithChildren { interface SidebarProps extends PropsWithChildren {
title: string title: string
width?: string width?: string
onSidebarSwitch?: (hidden: boolean) => void onSidebarSwitch?: (hidden: boolean) => void
bottomFixed?: React.ReactNode bottomFixed?: ReactNode
} }
const Sidebar: React.FC<SidebarProps> & { const Sidebar = (props: SidebarProps) => {
Item: typeof Item
ItemList: typeof ItemList
Scroll: typeof Scroll
Separate: typeof Separate
Submenu: typeof Submenu
Footer: typeof Footer
} = (props) => {
const [hideSidebar, setHideSidebar] = useState(getLocalStorage('HIDE_SIDEBAR') === 'true') const [hideSidebar, setHideSidebar] = useState(getLocalStorage('HIDE_SIDEBAR') === 'true')
const switchSidebar = () => { const switchSidebar = () => {

View File

@@ -1,13 +1,13 @@
import React from 'react' import { StrictMode } from 'react'
import ReactDOM from 'react-dom/client' import { createRoot } from 'react-dom/client'
import zh_CN from 'antd/locale/zh_CN' import zh_CN from 'antd/locale/zh_CN'
import '@/assets/css/base.scss' import '@/assets/css/base.scss'
import '@/assets/css/common.scss' import '@/assets/css/common.scss'
import { COLOR_MAIN } from '@/constants/common.constants' import { COLOR_MAIN } from '@/constants/common.constants'
import App from './App' import App from './App'
ReactDOM.createRoot(document.getElementById('root')!).render( createRoot(document.getElementById('root')!).render(
<React.StrictMode> <StrictMode>
<AntdConfigProvider <AntdConfigProvider
theme={{ theme={{
token: { colorPrimary: COLOR_MAIN, colorLinkHover: COLOR_MAIN }, token: { colorPrimary: COLOR_MAIN, colorLinkHover: COLOR_MAIN },
@@ -21,5 +21,5 @@ ReactDOM.createRoot(document.getElementById('root')!).render(
> >
<App /> <App />
</AntdConfigProvider> </AntdConfigProvider>
</React.StrictMode> </StrictMode>
) )

View File

@@ -1,9 +1,8 @@
import React from 'react'
import FitFullscreen from '@/components/common/FitFullscreen' import FitFullscreen from '@/components/common/FitFullscreen'
import Playground from '@/components/Playground' import Playground from '@/components/Playground'
import { initFiles, initImportMap, initTsConfig } from '@/components/Playground/files' import { initFiles, initImportMap, initTsConfig } from '@/components/Playground/files'
const OnlineEditor: React.FC = () => { const OnlineEditor = () => {
return ( return (
<> <>
<FitFullscreen> <FitFullscreen>

View File

@@ -1,4 +1,3 @@
import React, { useCallback } from 'react'
import Icon from '@ant-design/icons' import Icon from '@ant-design/icons'
import { Turnstile, TurnstileInstance } from '@marsidev/react-turnstile' import { Turnstile, TurnstileInstance } from '@marsidev/react-turnstile'
import { import {
@@ -14,7 +13,7 @@ import { r_auth_forget, r_auth_retrieve } from '@/services/auth'
import FitCenter from '@/components/common/FitCenter' import FitCenter from '@/components/common/FitCenter'
import FlexBox from '@/components/common/FlexBox' import FlexBox from '@/components/common/FlexBox'
const Forget: React.FC = () => { const Forget = () => {
const navigate = useNavigate() const navigate = useNavigate()
const [searchParams] = useSearchParams() const [searchParams] = useSearchParams()
const turnstileRef = useRef<TurnstileInstance>() const turnstileRef = useRef<TurnstileInstance>()

View File

@@ -1,4 +1,3 @@
import React, { useCallback } from 'react'
import Icon from '@ant-design/icons' import Icon from '@ant-design/icons'
import { Turnstile, TurnstileInstance } from '@marsidev/react-turnstile' import { Turnstile, TurnstileInstance } from '@marsidev/react-turnstile'
import { import {
@@ -17,7 +16,7 @@ import { AppContext } from '@/App'
import FitCenter from '@/components/common/FitCenter' import FitCenter from '@/components/common/FitCenter'
import FlexBox from '@/components/common/FlexBox' import FlexBox from '@/components/common/FlexBox'
const SignIn: React.FC = () => { const SignIn = () => {
const { refreshRouter } = useContext(AppContext) const { refreshRouter } = useContext(AppContext)
const navigate = useNavigate() const navigate = useNavigate()
const [searchParams] = useSearchParams() const [searchParams] = useSearchParams()

View File

@@ -1,4 +1,3 @@
import React, { useCallback } from 'react'
import Icon from '@ant-design/icons' import Icon from '@ant-design/icons'
import { Turnstile, TurnstileInstance } from '@marsidev/react-turnstile' import { Turnstile, TurnstileInstance } from '@marsidev/react-turnstile'
import { import {
@@ -14,7 +13,7 @@ import { r_auth_register, r_auth_resend } from '@/services/auth'
import FitCenter from '@/components/common/FitCenter' import FitCenter from '@/components/common/FitCenter'
import FlexBox from '@/components/common/FlexBox' import FlexBox from '@/components/common/FlexBox'
const SignUp: React.FC = () => { const SignUp = () => {
const location = useLocation() const location = useLocation()
const navigate = useNavigate() const navigate = useNavigate()
const turnstileRef = useRef<TurnstileInstance>() const turnstileRef = useRef<TurnstileInstance>()

View File

@@ -1,4 +1,3 @@
import React from 'react'
import { import {
COLOR_BACKGROUND, COLOR_BACKGROUND,
PERMISSION_ACCOUNT_NEED_INIT, PERMISSION_ACCOUNT_NEED_INIT,
@@ -15,7 +14,7 @@ import { AppContext } from '@/App'
import FitCenter from '@/components/common/FitCenter' import FitCenter from '@/components/common/FitCenter'
import FlexBox from '@/components/common/FlexBox' import FlexBox from '@/components/common/FlexBox'
const Verify: React.FC = () => { const Verify = () => {
const { refreshRouter } = useContext(AppContext) const { refreshRouter } = useContext(AppContext)
const navigate = useNavigate() const navigate = useNavigate()
const [searchParams] = useSearchParams() const [searchParams] = useSearchParams()

View File

@@ -1,4 +1,3 @@
import React from 'react'
import '@/assets/css/pages/sign.scss' import '@/assets/css/pages/sign.scss'
import { useUpdatedEffect } from '@/util/hooks' import { useUpdatedEffect } from '@/util/hooks'
import FitFullscreen from '@/components/common/FitFullscreen' import FitFullscreen from '@/components/common/FitFullscreen'
@@ -9,7 +8,7 @@ import Verify from '@/pages/Sign/Verify'
import Forget from '@/pages/Sign/Forget' import Forget from '@/pages/Sign/Forget'
import SignIn from '@/pages/Sign/SignIn' import SignIn from '@/pages/Sign/SignIn'
const Sign: React.FC = () => { const Sign = () => {
const lastPage = useRef('none') const lastPage = useRef('none')
const currentPage = useRef('none') const currentPage = useRef('none')
const match = useMatches().reduce((_, second) => second) const match = useMatches().reduce((_, second) => second)

View File

@@ -1,4 +1,4 @@
import React from 'react' import { ChangeEvent, Key, KeyboardEvent } from 'react'
import Icon from '@ant-design/icons' import Icon from '@ant-design/icons'
import { import {
COLOR_ERROR_SECONDARY, COLOR_ERROR_SECONDARY,
@@ -28,7 +28,7 @@ import HideScrollbar from '@/components/common/HideScrollbar'
import FlexBox from '@/components/common/FlexBox' import FlexBox from '@/components/common/FlexBox'
import Card from '@/components/common/Card' import Card from '@/components/common/Card'
const Group: React.FC = () => { const Group = () => {
const [modal, contextHolder] = AntdModal.useModal() const [modal, contextHolder] = AntdModal.useModal()
const [form] = AntdForm.useForm<GroupAddEditParam>() const [form] = AntdForm.useForm<GroupAddEditParam>()
const formValues = AntdForm.useWatch([], form) const formValues = AntdForm.useWatch([], form)
@@ -55,7 +55,7 @@ const Group: React.FC = () => {
const [roleData, setRoleData] = useState<RoleVo[]>([]) const [roleData, setRoleData] = useState<RoleVo[]>([])
const [isLoadingRole, setIsLoadingRole] = useState(false) const [isLoadingRole, setIsLoadingRole] = useState(false)
const [isSubmitting, setIsSubmitting] = useState(false) const [isSubmitting, setIsSubmitting] = useState(false)
const [tableSelectedItem, setTableSelectedItem] = useState<React.Key[]>([]) const [tableSelectedItem, setTableSelectedItem] = useState<Key[]>([])
const dataColumns: _ColumnsType<GroupWithRoleGetVo> = [ const dataColumns: _ColumnsType<GroupWithRoleGetVo> = [
{ {
@@ -172,7 +172,7 @@ const Group: React.FC = () => {
} }
} }
const handleOnTableSelectChange = (selectedRowKeys: React.Key[]) => { const handleOnTableSelectChange = (selectedRowKeys: Key[]) => {
setTableSelectedItem(selectedRowKeys) setTableSelectedItem(selectedRowKeys)
} }
@@ -331,7 +331,7 @@ const Group: React.FC = () => {
} }
} }
const handleOnSearchNameChange = (e: React.ChangeEvent<HTMLInputElement>) => { const handleOnSearchNameChange = (e: ChangeEvent<HTMLInputElement>) => {
setSearchName(e.target.value) setSearchName(e.target.value)
if (isUseRegex) { if (isUseRegex) {
@@ -346,7 +346,7 @@ const Group: React.FC = () => {
} }
} }
const handleOnSearchNameKeyDown = (e: React.KeyboardEvent) => { const handleOnSearchNameKeyDown = (e: KeyboardEvent) => {
if (e.key === 'Enter') { if (e.key === 'Enter') {
getGroup() getGroup()
} }

View File

@@ -1,4 +1,4 @@
import React from 'react' import { ChangeEvent, KeyboardEvent } from 'react'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { COLOR_FONT_SECONDARY, DATABASE_SELECT_SUCCESS } from '@/constants/common.constants' import { COLOR_FONT_SECONDARY, DATABASE_SELECT_SUCCESS } from '@/constants/common.constants'
import { useUpdatedEffect } from '@/util/hooks' import { useUpdatedEffect } from '@/util/hooks'
@@ -9,7 +9,7 @@ import Card from '@/components/common/Card'
import HideScrollbar from '@/components/common/HideScrollbar' import HideScrollbar from '@/components/common/HideScrollbar'
import FlexBox from '@/components/common/FlexBox' import FlexBox from '@/components/common/FlexBox'
const Log: React.FC = () => { const Log = () => {
const [logData, setLogData] = useState<SysLogGetVo[]>([]) const [logData, setLogData] = useState<SysLogGetVo[]>([])
const [loading, setLoading] = useState(false) const [loading, setLoading] = useState(false)
const [tableParams, setTableParams] = useState<TableParam>({ const [tableParams, setTableParams] = useState<TableParam>({
@@ -159,11 +159,11 @@ const Log: React.FC = () => {
} }
} }
const handleOnSearchUrlChange = (e: React.ChangeEvent<HTMLInputElement>) => { const handleOnSearchUrlChange = (e: ChangeEvent<HTMLInputElement>) => {
setSearchRequestUrl(e.target.value) setSearchRequestUrl(e.target.value)
} }
const handleOnSearchUrlKeyDown = (e: React.KeyboardEvent) => { const handleOnSearchUrlKeyDown = (e: KeyboardEvent) => {
if (e.key === 'Enter') { if (e.key === 'Enter') {
getLog() getLog()
} }

View File

@@ -1,4 +1,4 @@
import React from 'react' import { ChangeEvent, Key, KeyboardEvent } from 'react'
import Icon from '@ant-design/icons' import Icon from '@ant-design/icons'
import { import {
COLOR_ERROR_SECONDARY, COLOR_ERROR_SECONDARY,
@@ -28,7 +28,7 @@ import HideScrollbar from '@/components/common/HideScrollbar'
import FlexBox from '@/components/common/FlexBox' import FlexBox from '@/components/common/FlexBox'
import Card from '@/components/common/Card' import Card from '@/components/common/Card'
const Role: React.FC = () => { const Role = () => {
const [modal, contextHolder] = AntdModal.useModal() const [modal, contextHolder] = AntdModal.useModal()
const [form] = AntdForm.useForm<RoleAddEditParam>() const [form] = AntdForm.useForm<RoleAddEditParam>()
const formValues = AntdForm.useWatch([], form) const formValues = AntdForm.useWatch([], form)
@@ -55,7 +55,7 @@ const Role: React.FC = () => {
const [powerTreeData, setPowerTreeData] = useState<_DataNode[]>([]) const [powerTreeData, setPowerTreeData] = useState<_DataNode[]>([])
const [isLoadingPower, setIsLoadingPower] = useState(false) const [isLoadingPower, setIsLoadingPower] = useState(false)
const [isSubmitting, setIsSubmitting] = useState(false) const [isSubmitting, setIsSubmitting] = useState(false)
const [tableSelectedItem, setTableSelectedItem] = useState<React.Key[]>([]) const [tableSelectedItem, setTableSelectedItem] = useState<Key[]>([])
const dataColumns: _ColumnsType<RoleWithPowerGetVo> = [ const dataColumns: _ColumnsType<RoleWithPowerGetVo> = [
{ {
@@ -164,7 +164,7 @@ const Role: React.FC = () => {
} }
} }
const handleOnTableSelectChange = (selectedRowKeys: React.Key[]) => { const handleOnTableSelectChange = (selectedRowKeys: Key[]) => {
setTableSelectedItem(selectedRowKeys) setTableSelectedItem(selectedRowKeys)
} }
@@ -320,7 +320,7 @@ const Role: React.FC = () => {
} }
} }
const handleOnSearchNameChange = (e: React.ChangeEvent<HTMLInputElement>) => { const handleOnSearchNameChange = (e: ChangeEvent<HTMLInputElement>) => {
setSearchName(e.target.value) setSearchName(e.target.value)
if (isUseRegex) { if (isUseRegex) {
@@ -335,7 +335,7 @@ const Role: React.FC = () => {
} }
} }
const handleOnSearchNameKeyDown = (e: React.KeyboardEvent) => { const handleOnSearchNameKeyDown = (e: KeyboardEvent) => {
if (e.key === 'Enter') { if (e.key === 'Enter') {
getRole() getRole()
} }

View File

@@ -1,10 +1,9 @@
import React from 'react'
import { useUpdatedEffect } from '@/util/hooks' import { useUpdatedEffect } from '@/util/hooks'
import { hasPermission } from '@/util/auth' import { hasPermission } from '@/util/auth'
import { r_sys_settings_base_get, r_sys_settings_base_update } from '@/services/system' import { r_sys_settings_base_get, r_sys_settings_base_update } from '@/services/system'
import { SettingsCard } from '@/pages/System/Settings' import { SettingsCard } from '@/pages/System/Settings'
const Base: React.FC = () => { const Base = () => {
const [baseForm] = AntdForm.useForm<BaseSettingsParam>() const [baseForm] = AntdForm.useForm<BaseSettingsParam>()
const baseFormValues = AntdForm.useWatch([], baseForm) const baseFormValues = AntdForm.useWatch([], baseForm)
const [loading, setLoading] = useState(false) const [loading, setLoading] = useState(false)

View File

@@ -1,4 +1,3 @@
import React from 'react'
import Icon from '@ant-design/icons' import Icon from '@ant-design/icons'
import { useUpdatedEffect } from '@/util/hooks' import { useUpdatedEffect } from '@/util/hooks'
import { hasPermission } from '@/util/auth' import { hasPermission } from '@/util/auth'
@@ -9,7 +8,7 @@ import {
} from '@/services/system' } from '@/services/system'
import { SettingsCard } from '@/pages/System/Settings' import { SettingsCard } from '@/pages/System/Settings'
const Mail: React.FC = () => { const Mail = () => {
const [modal, contextHolder] = AntdModal.useModal() const [modal, contextHolder] = AntdModal.useModal()
const [mailForm] = AntdForm.useForm<MailSettingsParam>() const [mailForm] = AntdForm.useForm<MailSettingsParam>()
const mailFormValues = AntdForm.useWatch([], mailForm) const mailFormValues = AntdForm.useWatch([], mailForm)

View File

@@ -1,4 +1,4 @@
import React, { useState } from 'react' import { ChangeEvent } from 'react'
import Icon from '@ant-design/icons' import Icon from '@ant-design/icons'
import { DATABASE_DUPLICATE_KEY, DATABASE_INSERT_SUCCESS } from '@/constants/common.constants' import { DATABASE_DUPLICATE_KEY, DATABASE_INSERT_SUCCESS } from '@/constants/common.constants'
import { useUpdatedEffect } from '@/util/hooks' import { useUpdatedEffect } from '@/util/hooks'
@@ -10,7 +10,7 @@ import {
} from '@/services/system' } from '@/services/system'
import { SettingsCard } from '@/pages/System/Settings' import { SettingsCard } from '@/pages/System/Settings'
const SensitiveWord: React.FC = () => { const SensitiveWord = () => {
const [dataSource, setDataSource] = useState<SensitiveWordVo[]>() const [dataSource, setDataSource] = useState<SensitiveWordVo[]>()
const [targetKeys, setTargetKeys] = useState<string[]>([]) const [targetKeys, setTargetKeys] = useState<string[]>([])
const [selectedKeys, setSelectedKeys] = useState<string[]>([]) const [selectedKeys, setSelectedKeys] = useState<string[]>([])
@@ -64,7 +64,7 @@ const SensitiveWord: React.FC = () => {
}) })
} }
const handleOnChange = (e: React.ChangeEvent<HTMLInputElement>) => { const handleOnChange = (e: ChangeEvent<HTMLInputElement>) => {
setNewWord(e.target.value) setNewWord(e.target.value)
} }

View File

@@ -1,4 +1,4 @@
import React from 'react' import { PropsWithChildren, ReactNode } from 'react'
import Icon from '@ant-design/icons' import Icon from '@ant-design/icons'
import '@/assets/css/pages/system/settings.scss' import '@/assets/css/pages/system/settings.scss'
import FitFullscreen from '@/components/common/FitFullscreen' import FitFullscreen from '@/components/common/FitFullscreen'
@@ -11,16 +11,16 @@ import Base from '@/pages/System/Settings/Base'
import Mail from '@/pages/System/Settings/Mail' import Mail from '@/pages/System/Settings/Mail'
import SensitiveWord from '@/pages/System/Settings/SensitiveWord' import SensitiveWord from '@/pages/System/Settings/SensitiveWord'
interface SettingsCardProps extends React.PropsWithChildren { interface SettingsCardProps extends PropsWithChildren {
icon: IconComponent icon: IconComponent
title: string title: string
loading?: boolean loading?: boolean
modifyOperationCode?: string modifyOperationCode?: string
expand?: React.ReactNode expand?: ReactNode
onReset?: () => void onReset?: () => void
onSave?: () => void onSave?: () => void
} }
export const SettingsCard: React.FC<SettingsCardProps> = (props) => { export const SettingsCard = (props: SettingsCardProps) => {
return ( return (
<Card> <Card>
<FlexBox className={'settings-card'}> <FlexBox className={'settings-card'}>
@@ -50,7 +50,7 @@ export const SettingsCard: React.FC<SettingsCardProps> = (props) => {
) )
} }
const Settings: React.FC = () => { const Settings = () => {
return ( return (
<> <>
<FitFullscreen data-component={'system-settings'}> <FitFullscreen data-component={'system-settings'}>

View File

@@ -1,4 +1,3 @@
import React from 'react'
import Icon from '@ant-design/icons' import Icon from '@ant-design/icons'
import * as echarts from 'echarts/core' import * as echarts from 'echarts/core'
import { useUpdatedEffect } from '@/util/hooks' import { useUpdatedEffect } from '@/util/hooks'
@@ -8,7 +7,7 @@ import FlexBox from '@/components/common/FlexBox'
import { getTooltipTimeFormatter, lineEChartsBaseOption } from '@/pages/System/Statistics/shared' import { getTooltipTimeFormatter, lineEChartsBaseOption } from '@/pages/System/Statistics/shared'
import { CommonCard } from '@/pages/System/Statistics' import { CommonCard } from '@/pages/System/Statistics'
const ActiveInfo: React.FC = () => { const ActiveInfo = () => {
const activeInfoDivRef = useRef<HTMLDivElement>(null) const activeInfoDivRef = useRef<HTMLDivElement>(null)
const activeInfoEChartsRef = useRef<echarts.EChartsType | null>(null) const activeInfoEChartsRef = useRef<echarts.EChartsType | null>(null)
const [isLoading, setIsLoading] = useState(false) const [isLoading, setIsLoading] = useState(false)

View File

@@ -1,4 +1,3 @@
import React from 'react'
import * as echarts from 'echarts/core' import * as echarts from 'echarts/core'
import { BarSeriesOption } from 'echarts/charts' import { BarSeriesOption } from 'echarts/charts'
import { useUpdatedEffect } from '@/util/hooks' import { useUpdatedEffect } from '@/util/hooks'
@@ -11,7 +10,7 @@ import {
} from '@/pages/System/Statistics/shared' } from '@/pages/System/Statistics/shared'
import { CommonCard } from '@/pages/System/Statistics' import { CommonCard } from '@/pages/System/Statistics'
const CPUInfo: React.FC = () => { const CPUInfo = () => {
const keyDivRef = useRef<HTMLDivElement>(null) const keyDivRef = useRef<HTMLDivElement>(null)
const percentDivRef = useRef<HTMLDivElement>(null) const percentDivRef = useRef<HTMLDivElement>(null)
const cpuInfoDivRef = useRef<HTMLDivElement>(null) const cpuInfoDivRef = useRef<HTMLDivElement>(null)

View File

@@ -1,10 +1,9 @@
import React from 'react'
import { useUpdatedEffect } from '@/util/hooks' import { useUpdatedEffect } from '@/util/hooks'
import { r_sys_statistics_hardware } from '@/services/system' import { r_sys_statistics_hardware } from '@/services/system'
import FlexBox from '@/components/common/FlexBox' import FlexBox from '@/components/common/FlexBox'
import { CommonCard } from '@/pages/System/Statistics' import { CommonCard } from '@/pages/System/Statistics'
const HardwareInfo: React.FC = () => { const HardwareInfo = () => {
const [hardwareInfoData, setHardwareInfoData] = useState<HardwareInfoVo>() const [hardwareInfoData, setHardwareInfoData] = useState<HardwareInfoVo>()
useUpdatedEffect(() => { useUpdatedEffect(() => {

View File

@@ -1,4 +1,3 @@
import React from 'react'
import Icon from '@ant-design/icons' import Icon from '@ant-design/icons'
import * as echarts from 'echarts/core' import * as echarts from 'echarts/core'
import { useUpdatedEffect } from '@/util/hooks' import { useUpdatedEffect } from '@/util/hooks'
@@ -8,7 +7,7 @@ import FlexBox from '@/components/common/FlexBox'
import { getTooltipTimeFormatter, lineEChartsBaseOption } from '@/pages/System/Statistics/shared' import { getTooltipTimeFormatter, lineEChartsBaseOption } from '@/pages/System/Statistics/shared'
import { CommonCard } from '@/pages/System/Statistics' import { CommonCard } from '@/pages/System/Statistics'
const OnlineInfo: React.FC = () => { const OnlineInfo = () => {
const onlineInfoDivRef = useRef<HTMLDivElement>(null) const onlineInfoDivRef = useRef<HTMLDivElement>(null)
const onlineInfoEChartsRef = useRef<echarts.EChartsType | null>(null) const onlineInfoEChartsRef = useRef<echarts.EChartsType | null>(null)
const [isLoading, setIsLoading] = useState(false) const [isLoading, setIsLoading] = useState(false)

View File

@@ -1,11 +1,10 @@
import React from 'react'
import { useUpdatedEffect } from '@/util/hooks' import { useUpdatedEffect } from '@/util/hooks'
import { utcToLocalTime } from '@/util/datetime' import { utcToLocalTime } from '@/util/datetime'
import { r_sys_statistics_software } from '@/services/system' import { r_sys_statistics_software } from '@/services/system'
import FlexBox from '@/components/common/FlexBox' import FlexBox from '@/components/common/FlexBox'
import { CommonCard } from '@/pages/System/Statistics' import { CommonCard } from '@/pages/System/Statistics'
const SoftwareInfo: React.FC = () => { const SoftwareInfo = () => {
const [softwareInfoData, setSoftwareInfoData] = useState<SoftwareInfoVo>() const [softwareInfoData, setSoftwareInfoData] = useState<SoftwareInfoVo>()
useUpdatedEffect(() => { useUpdatedEffect(() => {

View File

@@ -1,4 +1,3 @@
import React, { useEffect, useState } from 'react'
import * as echarts from 'echarts/core' import * as echarts from 'echarts/core'
import { BarSeriesOption } from 'echarts/charts' import { BarSeriesOption } from 'echarts/charts'
import { formatByteSize } from '@/util/common' import { formatByteSize } from '@/util/common'
@@ -12,7 +11,7 @@ import {
} from '@/pages/System/Statistics/shared' } from '@/pages/System/Statistics/shared'
import { CommonCard } from '@/pages/System/Statistics' import { CommonCard } from '@/pages/System/Statistics'
const StorageInfo: React.FC = () => { const StorageInfo = () => {
const keyDivRef = useRef<HTMLDivElement>(null) const keyDivRef = useRef<HTMLDivElement>(null)
const percentDivRef = useRef<HTMLDivElement>(null) const percentDivRef = useRef<HTMLDivElement>(null)
const storageInfoDivRef = useRef<HTMLDivElement>(null) const storageInfoDivRef = useRef<HTMLDivElement>(null)

View File

@@ -1,4 +1,4 @@
import React from 'react' import { PropsWithChildren, ReactNode } from 'react'
import Icon from '@ant-design/icons' import Icon from '@ant-design/icons'
import '@/assets/css/pages/system/statistics.scss' import '@/assets/css/pages/system/statistics.scss'
import Card from '@/components/common/Card' import Card from '@/components/common/Card'
@@ -14,14 +14,14 @@ import HardwareInfo from '@/pages/System/Statistics/HardwareInfo'
import CPUInfo from '@/pages/System/Statistics/CPUInfo' import CPUInfo from '@/pages/System/Statistics/CPUInfo'
import StorageInfo from '@/pages/System/Statistics/StorageInfo' import StorageInfo from '@/pages/System/Statistics/StorageInfo'
interface CommonCardProps extends React.PropsWithChildren { interface CommonCardProps extends PropsWithChildren {
icon: IconComponent icon: IconComponent
title: React.ReactNode title: ReactNode
loading?: boolean loading?: boolean
expand?: React.ReactNode expand?: ReactNode
} }
export const CommonCard: React.FC<CommonCardProps> = (props) => { export const CommonCard = (props: CommonCardProps) => {
return ( return (
<Card style={{ overflow: 'visible' }}> <Card style={{ overflow: 'visible' }}>
<FlexBox className={'common-card'}> <FlexBox className={'common-card'}>
@@ -41,7 +41,7 @@ export const CommonCard: React.FC<CommonCardProps> = (props) => {
) )
} }
const Statistics: React.FC = () => { const Statistics = () => {
return ( return (
<> <>
<FitFullscreen data-component={'system-statistics'}> <FitFullscreen data-component={'system-statistics'}>

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react' import { ChangeEvent, Key, KeyboardEvent } from 'react'
import Icon from '@ant-design/icons' import Icon from '@ant-design/icons'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { import {
@@ -36,7 +36,7 @@ interface ChangePasswordFields extends UserChangePasswordParam {
needChangePassword: boolean needChangePassword: boolean
} }
const User: React.FC = () => { const User = () => {
const [modal, contextHolder] = AntdModal.useModal() const [modal, contextHolder] = AntdModal.useModal()
const [isDrawerOpen, setIsDrawerOpen] = useState(false) const [isDrawerOpen, setIsDrawerOpen] = useState(false)
@@ -66,7 +66,7 @@ const User: React.FC = () => {
} 项 共 ${total}` } 项 共 ${total}`
} }
}) })
const [tableSelectedItem, setTableSelectedItem] = useState<React.Key[]>([]) const [tableSelectedItem, setTableSelectedItem] = useState<Key[]>([])
const [userData, setUserData] = useState<UserWithRoleInfoVo[]>([]) const [userData, setUserData] = useState<UserWithRoleInfoVo[]>([])
const [isLoadingUserData, setIsLoadingUserData] = useState(false) const [isLoadingUserData, setIsLoadingUserData] = useState(false)
@@ -254,7 +254,7 @@ const User: React.FC = () => {
} }
} }
const handleOnTableSelectChange = (selectedRowKeys: React.Key[]) => { const handleOnTableSelectChange = (selectedRowKeys: Key[]) => {
setTableSelectedItem(selectedRowKeys) setTableSelectedItem(selectedRowKeys)
} }
@@ -570,7 +570,7 @@ const User: React.FC = () => {
} }
} }
const handleOnSearchValueChange = (e: React.ChangeEvent<HTMLInputElement>) => { const handleOnSearchValueChange = (e: ChangeEvent<HTMLInputElement>) => {
setSearchValue(e.target.value) setSearchValue(e.target.value)
if (isUseRegex) { if (isUseRegex) {
@@ -585,7 +585,7 @@ const User: React.FC = () => {
} }
} }
const handleOnSearchNameKeyDown = (e: React.KeyboardEvent) => { const handleOnSearchNameKeyDown = (e: KeyboardEvent) => {
if (e.key === 'Enter') { if (e.key === 'Enter') {
getUser() getUser()
} }

View File

@@ -1,4 +1,4 @@
import React from 'react' import { DetailedHTMLProps, HTMLAttributes, ReactNode } from 'react'
import Icon from '@ant-design/icons' import Icon from '@ant-design/icons'
import VanillaTilt, { TiltOptions } from 'vanilla-tilt' import VanillaTilt, { TiltOptions } from 'vanilla-tilt'
import '@/assets/css/pages/system/index.scss' import '@/assets/css/pages/system/index.scss'
@@ -9,9 +9,9 @@ import Card from '@/components/common/Card'
import Permission from '@/components/common/Permission' import Permission from '@/components/common/Permission'
interface CommonCardProps interface CommonCardProps
extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> { extends DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
icon: IconComponent icon: IconComponent
description?: React.ReactNode description?: ReactNode
options?: TiltOptions options?: TiltOptions
url?: string url?: string
} }
@@ -61,7 +61,7 @@ const CommonCard = forwardRef<HTMLDivElement, CommonCardProps>(
} }
) )
const System: React.FC = () => { const System = () => {
return ( return (
<> <>
<FitFullscreen data-component={'system'}> <FitFullscreen data-component={'system'}>

View File

@@ -1,11 +1,10 @@
import React from 'react'
import '@/assets/css/pages/system-framework.scss' import '@/assets/css/pages/system-framework.scss'
import { getSystemRouteJson } from '@/router/system' import { getSystemRouteJson } from '@/router/system'
import FitFullscreen from '@/components/common/FitFullscreen' import FitFullscreen from '@/components/common/FitFullscreen'
import Sidebar from '@/components/common/Sidebar' import Sidebar from '@/components/common/Sidebar'
import FullscreenLoadingMask from '@/components/common/FullscreenLoadingMask' import FullscreenLoadingMask from '@/components/common/FullscreenLoadingMask'
const SystemFramework: React.FC = () => { const SystemFramework = () => {
return ( return (
<> <>
<FitFullscreen data-component={'system-framework'} className={'flex-horizontal'}> <FitFullscreen data-component={'system-framework'} className={'flex-horizontal'}>

View File

@@ -1,6 +1,4 @@
import React from 'react' const All = () => {
const All: React.FC = () => {
return <></> return <></>
} }

View File

@@ -1,6 +1,4 @@
import React from 'react' const Translation = () => {
const Translation: React.FC = () => {
return <></> return <></>
} }

View File

@@ -1,6 +1,4 @@
import React from 'react' const Tools = () => {
const Tools: React.FC = () => {
return <></> return <></>
} }

View File

@@ -1,4 +1,3 @@
import React from 'react'
import '@/assets/css/pages/tools-framework.scss' import '@/assets/css/pages/tools-framework.scss'
import { tools } from '@/router/tools' import { tools } from '@/router/tools'
import FitFullscreen from '@/components/common/FitFullscreen' import FitFullscreen from '@/components/common/FitFullscreen'
@@ -6,7 +5,7 @@ import Sidebar from '@/components/common/Sidebar'
import { SidebarScrollElement } from '@/components/common/Sidebar/Scroll' import { SidebarScrollElement } from '@/components/common/Sidebar/Scroll'
import FullscreenLoadingMask from '@/components/common/FullscreenLoadingMask' import FullscreenLoadingMask from '@/components/common/FullscreenLoadingMask'
const ToolsFramework: React.FC = () => { const ToolsFramework = () => {
const sidebarScrollRef = useRef<SidebarScrollElement>(null) const sidebarScrollRef = useRef<SidebarScrollElement>(null)
const handleOnSidebarSwitch = () => { const handleOnSidebarSwitch = () => {

View File

@@ -1,6 +1,4 @@
import React from 'react' const User = () => {
const User: React.FC = () => {
return <></> return <></>
} }

View File

@@ -1,4 +1,3 @@
import React from 'react'
import '@/assets/css/pages/user-framework.scss' import '@/assets/css/pages/user-framework.scss'
import user from '@/router/user' import user from '@/router/user'
import { hasPathPermission } from '@/util/auth' import { hasPathPermission } from '@/util/auth'
@@ -6,7 +5,7 @@ import FitFullscreen from '@/components/common/FitFullscreen'
import Sidebar from '@/components/common/Sidebar' import Sidebar from '@/components/common/Sidebar'
import FullscreenLoadingMask from '@/components/common/FullscreenLoadingMask' import FullscreenLoadingMask from '@/components/common/FullscreenLoadingMask'
const ToolsFramework: React.FC = () => { const ToolsFramework = () => {
return ( return (
<> <>
<FitFullscreen data-component={'user-framework'} className={'flex-horizontal'}> <FitFullscreen data-component={'user-framework'} className={'flex-horizontal'}>

View File

@@ -1,17 +1,16 @@
import React from 'react'
import _ from 'lodash' import _ from 'lodash'
import system from '@/router/system' import system from '@/router/system'
import user from '@/router/user' import user from '@/router/user'
import tools from '@/router/tools' import tools from '@/router/tools'
import { getAuthRoute, mapJsonToRoute, setTitle } from '@/util/route' import { getAuthRoute, mapJsonToRoute, setTitle } from '@/util/route'
const lazySignPage = React.lazy(() => import('@/pages/Sign')) const lazySignPage = lazy(() => import('@/pages/Sign'))
const root: RouteJsonObject[] = [ const root: RouteJsonObject[] = [
{ {
path: '/', path: '/',
absolutePath: '/', absolutePath: '/',
component: React.lazy(() => import('@/AuthRoute')), component: lazy(() => import('@/AuthRoute')),
children: [ children: [
{ {
path: 'register', path: 'register',
@@ -41,13 +40,13 @@ const root: RouteJsonObject[] = [
path: 'loading', path: 'loading',
absolutePath: '/loading', absolutePath: '/loading',
id: 'loading', id: 'loading',
component: React.lazy(() => import('@/components/common/FullscreenLoadingMask')) component: lazy(() => import('@/components/common/FullscreenLoadingMask'))
}, },
{ {
path: 'user', path: 'user',
absolutePath: '/user', absolutePath: '/user',
id: 'userFramework', id: 'userFramework',
component: React.lazy(() => import('@/pages/UserFramework')), component: lazy(() => import('@/pages/UserFramework')),
children: setTitle(user, '个人中心'), children: setTitle(user, '个人中心'),
name: '个人中心', name: '个人中心',
auth: true auth: true
@@ -56,7 +55,7 @@ const root: RouteJsonObject[] = [
path: 'system', path: 'system',
absolutePath: '/system', absolutePath: '/system',
id: 'systemFramework', id: 'systemFramework',
component: React.lazy(() => import('@/pages/SystemFramework')), component: lazy(() => import('@/pages/SystemFramework')),
children: setTitle(system, '系统配置'), children: setTitle(system, '系统配置'),
name: '系统配置', name: '系统配置',
auth: true, auth: true,
@@ -66,14 +65,14 @@ const root: RouteJsonObject[] = [
path: 'online-editor', path: 'online-editor',
absolutePath: '/online-editor', absolutePath: '/online-editor',
id: 'online-editor', id: 'online-editor',
component: React.lazy(() => import('@/pages/OnlineEditor')), component: lazy(() => import('@/pages/OnlineEditor')),
name: '在线编辑器' name: '在线编辑器'
}, },
{ {
path: '', path: '',
absolutePath: '/', absolutePath: '/',
id: 'toolsFramework', id: 'toolsFramework',
component: React.lazy(() => import('@/pages/ToolsFramework')), component: lazy(() => import('@/pages/ToolsFramework')),
children: setTitle(tools, '氧工具'), children: setTitle(tools, '氧工具'),
name: '工具', name: '工具',
auth: false auth: false

View File

@@ -1,4 +1,3 @@
import React from 'react'
import { getAuthRoute } from '@/util/route' import { getAuthRoute } from '@/util/route'
const system: RouteJsonObject[] = [ const system: RouteJsonObject[] = [
@@ -6,18 +5,18 @@ const system: RouteJsonObject[] = [
path: '', path: '',
absolutePath: '/system', absolutePath: '/system',
id: 'system', id: 'system',
component: React.lazy(() => import('@/pages/System')), component: lazy(() => import('@/pages/System')),
name: '系统管理', name: '系统管理',
icon: React.lazy(() => import('~icons/oxygen/setting')), icon: lazy(() => import('~icons/oxygen/setting')),
menu: true menu: true
}, },
{ {
path: 'statistics', path: 'statistics',
absolutePath: '/system/statistics', absolutePath: '/system/statistics',
id: 'system-statistics', id: 'system-statistics',
component: React.lazy(() => import('@/pages/System/Statistics')), component: lazy(() => import('@/pages/System/Statistics')),
name: '系统概况', name: '系统概况',
icon: React.lazy(() => import('~icons/oxygen/chart')), icon: lazy(() => import('~icons/oxygen/chart')),
menu: true, menu: true,
autoHide: true autoHide: true
}, },
@@ -25,9 +24,9 @@ const system: RouteJsonObject[] = [
path: 'settings', path: 'settings',
absolutePath: '/system/settings', absolutePath: '/system/settings',
id: 'system-settings', id: 'system-settings',
component: React.lazy(() => import('@/pages/System/Settings')), component: lazy(() => import('@/pages/System/Settings')),
name: '系统设置', name: '系统设置',
icon: React.lazy(() => import('~icons/oxygen/option')), icon: lazy(() => import('~icons/oxygen/option')),
menu: true, menu: true,
autoHide: true autoHide: true
}, },
@@ -35,9 +34,9 @@ const system: RouteJsonObject[] = [
path: 'user', path: 'user',
absolutePath: '/system/user', absolutePath: '/system/user',
id: 'system-user', id: 'system-user',
component: React.lazy(() => import('@/pages/System/User')), component: lazy(() => import('@/pages/System/User')),
name: '用户管理', name: '用户管理',
icon: React.lazy(() => import('~icons/oxygen/user')), icon: lazy(() => import('~icons/oxygen/user')),
menu: true, menu: true,
autoHide: true autoHide: true
}, },
@@ -45,9 +44,9 @@ const system: RouteJsonObject[] = [
path: 'role', path: 'role',
absolutePath: '/system/role', absolutePath: '/system/role',
id: 'system-role', id: 'system-role',
component: React.lazy(() => import('@/pages/System/Role')), component: lazy(() => import('@/pages/System/Role')),
name: '角色管理', name: '角色管理',
icon: React.lazy(() => import('~icons/oxygen/role')), icon: lazy(() => import('~icons/oxygen/role')),
menu: true, menu: true,
autoHide: true autoHide: true
}, },
@@ -55,9 +54,9 @@ const system: RouteJsonObject[] = [
path: 'group', path: 'group',
absolutePath: '/system/group', absolutePath: '/system/group',
id: 'system-group', id: 'system-group',
component: React.lazy(() => import('@/pages/System/Group')), component: lazy(() => import('@/pages/System/Group')),
name: '群组管理', name: '群组管理',
icon: React.lazy(() => import('~icons/oxygen/group')), icon: lazy(() => import('~icons/oxygen/group')),
menu: true, menu: true,
autoHide: true autoHide: true
}, },
@@ -65,9 +64,9 @@ const system: RouteJsonObject[] = [
path: 'log', path: 'log',
absolutePath: '/system/log', absolutePath: '/system/log',
id: 'system-log', id: 'system-log',
component: React.lazy(() => import('@/pages/System/Log')), component: lazy(() => import('@/pages/System/Log')),
name: '系统日志', name: '系统日志',
icon: React.lazy(() => import('~icons/oxygen/log')), icon: lazy(() => import('~icons/oxygen/log')),
menu: true, menu: true,
autoHide: true autoHide: true
}, },

View File

@@ -1,13 +1,11 @@
import React from 'react'
export const tools: RouteJsonObject[] = [ export const tools: RouteJsonObject[] = [
{ {
path: '', path: '',
absolutePath: '/', absolutePath: '/',
id: 'tools', id: 'tools',
component: React.lazy(() => import('@/pages/Tools')), component: lazy(() => import('@/pages/Tools')),
name: '主页', name: '主页',
icon: React.lazy(() => import('~icons/oxygen/home')), icon: lazy(() => import('~icons/oxygen/home')),
menu: true, menu: true,
auth: false auth: false
}, },
@@ -15,10 +13,10 @@ export const tools: RouteJsonObject[] = [
path: 'all', path: 'all',
absolutePath: '/all', absolutePath: '/all',
id: 'tools-all', id: 'tools-all',
component: React.lazy(() => import('@/pages/Tools')), component: lazy(() => import('@/pages/Tools')),
name: '全部工具', name: '全部工具',
titlePostfix: ' - 全部工具', titlePostfix: ' - 全部工具',
icon: React.lazy(() => import('~icons/oxygen/tool')), icon: lazy(() => import('~icons/oxygen/tool')),
menu: true, menu: true,
auth: false auth: false
}, },
@@ -26,9 +24,9 @@ export const tools: RouteJsonObject[] = [
path: 'translation', path: 'translation',
absolutePath: '/translation', absolutePath: '/translation',
id: 'tools-translation', id: 'tools-translation',
component: React.lazy(() => import('@/pages/Tools/Translation')), component: lazy(() => import('@/pages/Tools/Translation')),
name: '翻译', name: '翻译',
icon: React.lazy(() => import('~icons/oxygen/jenkins')), icon: lazy(() => import('~icons/oxygen/jenkins')),
menu: true, menu: true,
auth: false, auth: false,
children: [ children: [
@@ -37,7 +35,7 @@ export const tools: RouteJsonObject[] = [
absolutePath: '/translation/1', absolutePath: '/translation/1',
id: '1', id: '1',
name: '翻译1', name: '翻译1',
icon: React.lazy(() => import('~icons/oxygen/logo')), icon: lazy(() => import('~icons/oxygen/logo')),
menu: true, menu: true,
auth: false auth: false
}, },
@@ -55,9 +53,9 @@ export const tools: RouteJsonObject[] = [
path: 'translation-', path: 'translation-',
absolutePath: '/translation-', absolutePath: '/translation-',
id: 'tools-translation-', id: 'tools-translation-',
component: React.lazy(() => import('@/pages/Tools/Translation')), component: lazy(() => import('@/pages/Tools/Translation')),
name: '翻译-', name: '翻译-',
icon: React.lazy(() => import('~icons/oxygen/jenkins')), icon: lazy(() => import('~icons/oxygen/jenkins')),
menu: true, menu: true,
auth: false, auth: false,
children: [ children: [
@@ -83,9 +81,9 @@ export const tools: RouteJsonObject[] = [
path: 'translation--', path: 'translation--',
absolutePath: '/translation--', absolutePath: '/translation--',
id: 'tools-translation--', id: 'tools-translation--',
component: React.lazy(() => import('@/pages/Tools/Translation')), component: lazy(() => import('@/pages/Tools/Translation')),
name: '翻译--', name: '翻译--',
icon: React.lazy(() => import('~icons/oxygen/jenkins')), icon: lazy(() => import('~icons/oxygen/jenkins')),
menu: true, menu: true,
auth: false auth: false
}, },
@@ -93,9 +91,9 @@ export const tools: RouteJsonObject[] = [
path: 'translation--1', path: 'translation--1',
absolutePath: '/translation--1', absolutePath: '/translation--1',
id: 'tools-translation--1', id: 'tools-translation--1',
component: React.lazy(() => import('@/pages/Tools/Translation')), component: lazy(() => import('@/pages/Tools/Translation')),
name: '翻译--1', name: '翻译--1',
icon: React.lazy(() => import('~icons/oxygen/jenkins')), icon: lazy(() => import('~icons/oxygen/jenkins')),
menu: true, menu: true,
auth: false auth: false
}, },
@@ -103,9 +101,9 @@ export const tools: RouteJsonObject[] = [
path: 'translation--2', path: 'translation--2',
absolutePath: '/translation--2', absolutePath: '/translation--2',
id: 'tools-translation--2', id: 'tools-translation--2',
component: React.lazy(() => import('@/pages/Tools/Translation')), component: lazy(() => import('@/pages/Tools/Translation')),
name: '翻译--2', name: '翻译--2',
icon: React.lazy(() => import('~icons/oxygen/jenkins')), icon: lazy(() => import('~icons/oxygen/jenkins')),
menu: true, menu: true,
auth: false auth: false
}, },
@@ -113,9 +111,9 @@ export const tools: RouteJsonObject[] = [
path: 'translation--3', path: 'translation--3',
absolutePath: '/translation--3', absolutePath: '/translation--3',
id: 'tools-translation--3', id: 'tools-translation--3',
component: React.lazy(() => import('@/pages/Tools/Translation')), component: lazy(() => import('@/pages/Tools/Translation')),
name: '翻译--3', name: '翻译--3',
icon: React.lazy(() => import('~icons/oxygen/jenkins')), icon: lazy(() => import('~icons/oxygen/jenkins')),
menu: true, menu: true,
auth: false auth: false
}, },
@@ -123,9 +121,9 @@ export const tools: RouteJsonObject[] = [
path: 'translation--4', path: 'translation--4',
absolutePath: '/translation--4', absolutePath: '/translation--4',
id: 'tools-translation--4', id: 'tools-translation--4',
component: React.lazy(() => import('@/pages/Tools/Translation')), component: lazy(() => import('@/pages/Tools/Translation')),
name: '翻译--4', name: '翻译--4',
icon: React.lazy(() => import('~icons/oxygen/jenkins')), icon: lazy(() => import('~icons/oxygen/jenkins')),
menu: true, menu: true,
auth: false auth: false
}, },
@@ -133,9 +131,9 @@ export const tools: RouteJsonObject[] = [
path: 'translation--5', path: 'translation--5',
absolutePath: '/translation--5', absolutePath: '/translation--5',
id: 'tools-translation--5', id: 'tools-translation--5',
component: React.lazy(() => import('@/pages/Tools/Translation')), component: lazy(() => import('@/pages/Tools/Translation')),
name: '翻译--5', name: '翻译--5',
icon: React.lazy(() => import('~icons/oxygen/jenkins')), icon: lazy(() => import('~icons/oxygen/jenkins')),
menu: true, menu: true,
auth: false auth: false
}, },
@@ -143,9 +141,9 @@ export const tools: RouteJsonObject[] = [
path: 'translation--6', path: 'translation--6',
absolutePath: '/translation--6', absolutePath: '/translation--6',
id: 'tools-translation--6', id: 'tools-translation--6',
component: React.lazy(() => import('@/pages/Tools/Translation')), component: lazy(() => import('@/pages/Tools/Translation')),
name: '翻译--6', name: '翻译--6',
icon: React.lazy(() => import('~icons/oxygen/jenkins')), icon: lazy(() => import('~icons/oxygen/jenkins')),
menu: true, menu: true,
auth: false auth: false
}, },
@@ -153,9 +151,9 @@ export const tools: RouteJsonObject[] = [
path: 'translation--7', path: 'translation--7',
absolutePath: '/translation--7', absolutePath: '/translation--7',
id: 'tools-translation--7', id: 'tools-translation--7',
component: React.lazy(() => import('@/pages/Tools/Translation')), component: lazy(() => import('@/pages/Tools/Translation')),
name: '翻译--7', name: '翻译--7',
icon: React.lazy(() => import('~icons/oxygen/jenkins')), icon: lazy(() => import('~icons/oxygen/jenkins')),
menu: true, menu: true,
auth: false auth: false
}, },
@@ -163,9 +161,9 @@ export const tools: RouteJsonObject[] = [
path: 'translation--8', path: 'translation--8',
absolutePath: '/translation--8', absolutePath: '/translation--8',
id: 'tools-translation--8', id: 'tools-translation--8',
component: React.lazy(() => import('@/pages/Tools/Translation')), component: lazy(() => import('@/pages/Tools/Translation')),
name: '翻译--8', name: '翻译--8',
icon: React.lazy(() => import('~icons/oxygen/jenkins')), icon: lazy(() => import('~icons/oxygen/jenkins')),
menu: true, menu: true,
auth: false auth: false
}, },
@@ -173,9 +171,9 @@ export const tools: RouteJsonObject[] = [
path: 'translation--9', path: 'translation--9',
absolutePath: '/translation--9', absolutePath: '/translation--9',
id: 'tools-translation--9', id: 'tools-translation--9',
component: React.lazy(() => import('@/pages/Tools/Translation')), component: lazy(() => import('@/pages/Tools/Translation')),
name: '翻译--9', name: '翻译--9',
icon: React.lazy(() => import('~icons/oxygen/jenkins')), icon: lazy(() => import('~icons/oxygen/jenkins')),
menu: true, menu: true,
auth: false auth: false
}, },
@@ -183,9 +181,9 @@ export const tools: RouteJsonObject[] = [
path: 'translation--10', path: 'translation--10',
absolutePath: '/translation--10', absolutePath: '/translation--10',
id: 'tools-translation--10', id: 'tools-translation--10',
component: React.lazy(() => import('@/pages/Tools/Translation')), component: lazy(() => import('@/pages/Tools/Translation')),
name: '翻译--10', name: '翻译--10',
icon: React.lazy(() => import('~icons/oxygen/jenkins')), icon: lazy(() => import('~icons/oxygen/jenkins')),
menu: true, menu: true,
auth: false auth: false
}, },
@@ -193,9 +191,9 @@ export const tools: RouteJsonObject[] = [
path: 'translation--1-', path: 'translation--1-',
absolutePath: '/translation--1-', absolutePath: '/translation--1-',
id: 'tools-translation--1-', id: 'tools-translation--1-',
component: React.lazy(() => import('@/pages/Tools/Translation')), component: lazy(() => import('@/pages/Tools/Translation')),
name: '翻译--1-', name: '翻译--1-',
icon: React.lazy(() => import('~icons/oxygen/jenkins')), icon: lazy(() => import('~icons/oxygen/jenkins')),
menu: true, menu: true,
auth: false auth: false
}, },
@@ -203,9 +201,9 @@ export const tools: RouteJsonObject[] = [
path: 'translation--2-', path: 'translation--2-',
absolutePath: '/translation--2-', absolutePath: '/translation--2-',
id: 'tools-translation--2-', id: 'tools-translation--2-',
component: React.lazy(() => import('@/pages/Tools/Translation')), component: lazy(() => import('@/pages/Tools/Translation')),
name: '翻译--2-', name: '翻译--2-',
icon: React.lazy(() => import('~icons/oxygen/jenkins')), icon: lazy(() => import('~icons/oxygen/jenkins')),
menu: true, menu: true,
auth: false auth: false
}, },
@@ -213,9 +211,9 @@ export const tools: RouteJsonObject[] = [
path: 'translation--3-', path: 'translation--3-',
absolutePath: '/translation--3-', absolutePath: '/translation--3-',
id: 'tools-translation--3-', id: 'tools-translation--3-',
component: React.lazy(() => import('@/pages/Tools/Translation')), component: lazy(() => import('@/pages/Tools/Translation')),
name: '翻译--3-', name: '翻译--3-',
icon: React.lazy(() => import('~icons/oxygen/jenkins')), icon: lazy(() => import('~icons/oxygen/jenkins')),
menu: true, menu: true,
auth: false auth: false
}, },
@@ -223,9 +221,9 @@ export const tools: RouteJsonObject[] = [
path: 'translation--4-', path: 'translation--4-',
absolutePath: '/translation--4-', absolutePath: '/translation--4-',
id: 'tools-translation--4-', id: 'tools-translation--4-',
component: React.lazy(() => import('@/pages/Tools/Translation')), component: lazy(() => import('@/pages/Tools/Translation')),
name: '翻译--4-', name: '翻译--4-',
icon: React.lazy(() => import('~icons/oxygen/jenkins')), icon: lazy(() => import('~icons/oxygen/jenkins')),
menu: true, menu: true,
auth: false auth: false
}, },
@@ -233,9 +231,9 @@ export const tools: RouteJsonObject[] = [
path: 'translation--5-', path: 'translation--5-',
absolutePath: '/translation--5-', absolutePath: '/translation--5-',
id: 'tools-translation--5-', id: 'tools-translation--5-',
component: React.lazy(() => import('@/pages/Tools/Translation')), component: lazy(() => import('@/pages/Tools/Translation')),
name: '翻译--5-', name: '翻译--5-',
icon: React.lazy(() => import('~icons/oxygen/jenkins')), icon: lazy(() => import('~icons/oxygen/jenkins')),
menu: true, menu: true,
auth: false auth: false
}, },
@@ -243,9 +241,9 @@ export const tools: RouteJsonObject[] = [
path: 'translation--6-', path: 'translation--6-',
absolutePath: '/translation--6-', absolutePath: '/translation--6-',
id: 'tools-translation--6-', id: 'tools-translation--6-',
component: React.lazy(() => import('@/pages/Tools/Translation')), component: lazy(() => import('@/pages/Tools/Translation')),
name: '翻译--6-', name: '翻译--6-',
icon: React.lazy(() => import('~icons/oxygen/jenkins')), icon: lazy(() => import('~icons/oxygen/jenkins')),
menu: true, menu: true,
auth: false auth: false
}, },
@@ -253,9 +251,9 @@ export const tools: RouteJsonObject[] = [
path: 'translation--7-', path: 'translation--7-',
absolutePath: '/translation--7-', absolutePath: '/translation--7-',
id: 'tools-translation--7-', id: 'tools-translation--7-',
component: React.lazy(() => import('@/pages/Tools/Translation')), component: lazy(() => import('@/pages/Tools/Translation')),
name: '翻译--7-', name: '翻译--7-',
icon: React.lazy(() => import('~icons/oxygen/jenkins')), icon: lazy(() => import('~icons/oxygen/jenkins')),
menu: true, menu: true,
auth: false auth: false
}, },
@@ -263,9 +261,9 @@ export const tools: RouteJsonObject[] = [
path: 'translation--8-', path: 'translation--8-',
absolutePath: '/translation--8-', absolutePath: '/translation--8-',
id: 'tools-translation--8-', id: 'tools-translation--8-',
component: React.lazy(() => import('@/pages/Tools/Translation')), component: lazy(() => import('@/pages/Tools/Translation')),
name: '翻译--8-', name: '翻译--8-',
icon: React.lazy(() => import('~icons/oxygen/jenkins')), icon: lazy(() => import('~icons/oxygen/jenkins')),
menu: true, menu: true,
auth: false auth: false
}, },
@@ -273,9 +271,9 @@ export const tools: RouteJsonObject[] = [
path: 'translation--9-', path: 'translation--9-',
absolutePath: '/translation--9-', absolutePath: '/translation--9-',
id: 'tools-translation--9-', id: 'tools-translation--9-',
component: React.lazy(() => import('@/pages/Tools/Translation')), component: lazy(() => import('@/pages/Tools/Translation')),
name: '翻译--9-', name: '翻译--9-',
icon: React.lazy(() => import('~icons/oxygen/jenkins')), icon: lazy(() => import('~icons/oxygen/jenkins')),
menu: true, menu: true,
auth: false auth: false
}, },
@@ -283,9 +281,9 @@ export const tools: RouteJsonObject[] = [
path: 'translation--10-', path: 'translation--10-',
absolutePath: '/translation--10-', absolutePath: '/translation--10-',
id: 'tools-translation--10-', id: 'tools-translation--10-',
component: React.lazy(() => import('@/pages/Tools/Translation')), component: lazy(() => import('@/pages/Tools/Translation')),
name: '翻译--10-', name: '翻译--10-',
icon: React.lazy(() => import('~icons/oxygen/jenkins')), icon: lazy(() => import('~icons/oxygen/jenkins')),
menu: true, menu: true,
auth: false, auth: false,
children: [ children: [

View File

@@ -1,13 +1,11 @@
import React from 'react'
const user: RouteJsonObject[] = [ const user: RouteJsonObject[] = [
{ {
path: '', path: '',
absolutePath: '/user', absolutePath: '/user',
id: 'user', id: 'user',
component: React.lazy(() => import('@/pages/User')), component: lazy(() => import('@/pages/User')),
name: '个人档案', name: '个人档案',
icon: React.lazy(() => import('~icons/oxygen/user')), icon: lazy(() => import('~icons/oxygen/user')),
menu: true menu: true
}, },
{ {

View File

@@ -1,4 +1,4 @@
import React from 'react' import { Key } from 'react'
import { import {
URL_SYS_USER_INFO, URL_SYS_USER_INFO,
URL_SYS_USER, URL_SYS_USER,
@@ -34,7 +34,7 @@ export const r_sys_user_change_password = (param: UserChangePasswordParam) =>
export const r_sys_user_delete = (id: string) => request.delete(`${URL_SYS_USER}/${id}`) export const r_sys_user_delete = (id: string) => request.delete(`${URL_SYS_USER}/${id}`)
export const r_sys_user_delete_list = (ids: React.Key[]) => request.delete(URL_SYS_USER, { ids }) export const r_sys_user_delete_list = (ids: Key[]) => request.delete(URL_SYS_USER, { ids })
export const r_sys_power_get_list = () => request.get<PowerSetVo>(URL_SYS_POWER_LIST) export const r_sys_power_get_list = () => request.get<PowerSetVo>(URL_SYS_POWER_LIST)
@@ -52,7 +52,7 @@ export const r_sys_role_update = (param: RoleAddEditParam) => request.put(URL_SY
export const r_sys_role_delete = (id: string) => request.delete(`${URL_SYS_ROLE}/${id}`) export const r_sys_role_delete = (id: string) => request.delete(`${URL_SYS_ROLE}/${id}`)
export const r_sys_role_delete_list = (ids: React.Key[]) => request.delete(URL_SYS_ROLE, { ids }) export const r_sys_role_delete_list = (ids: Key[]) => request.delete(URL_SYS_ROLE, { ids })
export const r_sys_group_get = (param: GroupGetParam) => export const r_sys_group_get = (param: GroupGetParam) =>
request.get<PageVo<GroupWithRoleGetVo>>(URL_SYS_GROUP, param) request.get<PageVo<GroupWithRoleGetVo>>(URL_SYS_GROUP, param)
@@ -68,7 +68,7 @@ export const r_sys_group_update = (param: GroupAddEditParam) => request.put(URL_
export const r_sys_group_delete = (id: string) => request.delete(`${URL_SYS_GROUP}/${id}`) export const r_sys_group_delete = (id: string) => request.delete(`${URL_SYS_GROUP}/${id}`)
export const r_sys_group_delete_list = (ids: React.Key[]) => request.delete(URL_SYS_GROUP, { ids }) export const r_sys_group_delete_list = (ids: Key[]) => request.delete(URL_SYS_GROUP, { ids })
export const r_sys_log_get = (param: SysLogGetParam) => export const r_sys_log_get = (param: SysLogGetParam) =>
request.get<PageVo<SysLogGetVo>>(URL_SYS_LOG, param) request.get<PageVo<SysLogGetVo>>(URL_SYS_LOG, param)

View File

@@ -1,4 +1,4 @@
import ReactDOM from 'react-dom/client' import { createRoot } from 'react-dom/client'
import FullscreenLoadingMask from '@/components/common/FullscreenLoadingMask' import FullscreenLoadingMask from '@/components/common/FullscreenLoadingMask'
import { floor } from 'lodash' import { floor } from 'lodash'
@@ -47,7 +47,7 @@ export const showLoadingMask = (id: string) => {
'position: fixed; width: 100vw; height: 100vh; z-index: 10000; left: 0; top: 0;' 'position: fixed; width: 100vw; height: 100vh; z-index: 10000; left: 0; top: 0;'
) )
return ReactDOM.createRoot(container).render(<FullscreenLoadingMask />) return createRoot(container).render(<FullscreenLoadingMask />)
} }
export const removeLoadingMask = (id: string) => { export const removeLoadingMask = (id: string) => {

View File

@@ -1,9 +1,6 @@
import React from 'react' import { DependencyList, EffectCallback } from 'react'
export const useUpdatedEffect = ( export const useUpdatedEffect = (effect: EffectCallback, dependencies: DependencyList) => {
effect: React.EffectCallback,
dependencies: React.DependencyList
) => {
const isFirstRender = useRef(true) const isFirstRender = useRef(true)
useEffect(() => { useEffect(() => {