Skip to content

Commit 88855ea

Browse files
author
virgoone
committed
fix: update antd deps
1 parent 39be296 commit 88855ea

File tree

66 files changed

+1894
-542
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1894
-542
lines changed

template/antd-console/.eslintrc.js

Lines changed: 0 additions & 47 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import antfu from '@antfu/eslint-config'
2+
3+
export default antfu({
4+
typescript: true,
5+
ignores: ['**/scripts'],
6+
stylistic: {
7+
indent: 2, // 4, or 'tab'
8+
quotes: 'single', // or 'double'
9+
},
10+
rules: {
11+
'unused-imports/no-unused-vars': ['warn'],
12+
'no-console': ['warn'],
13+
'prefer-regex-literals': ['warn'],
14+
'style/multiline-ternary': ['warn'],
15+
'ts/ban-ts-comment': ['warn'],
16+
'array-callback-return': ['warn'],
17+
'unicorn/no-new-array': ['warn'],
18+
'ts/no-require-imports': ['warn'],
19+
'node/prefer-global/process': ['warn'],
20+
},
21+
})

template/antd-console/package.json

Lines changed: 51 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -13,76 +13,83 @@
1313
"build": "lark build",
1414
"lint": "concurrently pnpm:lint:*",
1515
"lint:format": "prettier --write .",
16-
"lint:code": "eslint --fix . --ext .js,.ts,.tsx",
17-
"preversion": "pnpm run lint",
16+
"lint:fix": "eslint . --fix",
1817
"prepare": "husky install"
1918
},
2019
"dependencies": {
2120
"@ant-design/charts": "^1.4.2",
22-
"@ant-design/icons": "^5.1.4",
21+
"@ant-design/icons": "^5.4.0",
2322
"@ant-design/plots": "^1.2.5",
2423
"@ant-design/use-emotion-css": "^1.0.4",
2524
"@antv/data-set": "^0.11.8",
26-
"@loadable/component": "^5.15.3",
27-
"@turf/turf": "^6.5.0",
28-
"antd": "^5.6.0",
29-
"axios": "^1.4.0",
30-
"clsx": "^1.2.1",
31-
"dayjs": "^1.11.8",
25+
"@loadable/component": "^5.16.4",
26+
"@radix-ui/react-separator": "^1.1.0",
27+
"@tanstack/react-query": "^5.55.0",
28+
"@tanstack/react-query-devtools": "^5.55.0",
29+
"@turf/turf": "^7.1.0",
30+
"antd": "^5.20.5",
31+
"axios": "^1.7.7",
32+
"clsx": "^2.1.1",
33+
"dayjs": "^1.11.13",
3234
"history": "^5.3.0",
35+
"immer": "^10.1.1",
3336
"lodash": "^4.17.21",
34-
"lottie-web": "^5.12.0",
35-
"mobx": "^6.9.0",
36-
"mobx-react": "^7.6.0",
37+
"lottie-web": "^5.12.2",
3738
"mockjs": "^1.1.0",
3839
"normalize.css": "^8.0.1",
3940
"nprogress": "^0.2.0",
40-
"query-string": "^8.1.0",
41-
"react": "^18.2.0",
41+
"query-string": "^9.1.0",
42+
"react": "^18.3.1",
4243
"react-color": "^2.19.3",
4344
"react-document-title": "^2.0.3",
44-
"react-dom": "^18.2.0",
45-
"react-router": "^6.12.0",
46-
"react-router-dom": "^6.12.0",
47-
"recompose": "^0.30.0"
45+
"react-dom": "^18.3.1",
46+
"react-router": "^6.26.1",
47+
"react-router-dom": "^6.26.1",
48+
"recompose": "^0.30.0",
49+
"spark-md5": "^3.0.2",
50+
"tailwind-merge": "^2.5.2",
51+
"zustand": "^4.5.5"
4852
},
4953
"devDependencies": {
50-
"@babel/runtime": "^7.22.3",
51-
"@commitlint/cli": "^17.6.5",
52-
"@commitlint/config-conventional": "^17.6.5",
53-
"@lark-org/lark-cli": "^1.8.13",
54-
"@types/loadable__component": "^5.13.4",
55-
"@types/lodash": "^4.14.195",
56-
"@types/mockjs": "^1.0.7",
57-
"@types/node": "^20.2.5",
58-
"@types/react": "^18.2.8",
59-
"@types/react-color": "^3.0.6",
60-
"@types/react-dom": "^18.2.4",
54+
"@antfu/eslint-config": "^3.5.0",
55+
"@babel/runtime": "^7.25.6",
56+
"@commitlint/cli": "^19.4.1",
57+
"@commitlint/config-conventional": "^19.4.1",
58+
"@lark-org/lark-cli": "^1.8.14",
59+
"@tailwindcss/line-clamp": "^0.4.4",
60+
"@tailwindcss/typography": "^0.5.15",
61+
"@types/loadable__component": "^5.13.9",
62+
"@types/lodash": "^4.17.7",
63+
"@types/mockjs": "^1.0.10",
64+
"@types/node": "^22.5.4",
65+
"@types/react": "^18.3.5",
66+
"@types/react-color": "^3.0.12",
67+
"@types/react-dom": "^18.3.0",
6168
"@types/react-router": "^5.1.20",
62-
"@types/react-router-config": "^5.0.7",
69+
"@types/react-router-config": "^5.0.11",
6370
"@types/react-router-dom": "^5.3.3",
64-
"@types/styled-components": "^5.1.26",
65-
"babel-plugin-import": "^1.13.6",
71+
"@types/styled-components": "^5.1.34",
72+
"babel-plugin-import": "^1.13.8",
6673
"babel-plugin-macros": "^3.1.0",
67-
"concurrently": "^8.1.0",
74+
"concurrently": "^8.2.2",
6875
"cross-env": "^7.0.3",
6976
"enzyme": "^3.11.0",
70-
"enzyme-adapter-react-16": "^1.15.7",
77+
"enzyme-adapter-react-16": "^1.15.8",
7178
"enzyme-to-json": "^3.6.2",
72-
"eslint": "^8.42.0",
73-
"eslint-config-lark": "^0.4.0",
74-
"husky": "^8.0.3",
75-
"jest": "^29.5.0",
76-
"lint-staged": "^13.2.2",
79+
"eslint": "^9.9.1",
80+
"husky": "^9.1.5",
81+
"jest": "^29.7.0",
82+
"lint-staged": "^15.2.10",
7783
"lolex": "^6.0.0",
84+
"netlify-cli": "^17.36.0",
7885
"penv.macro": "^0.4.0",
79-
"prettier": "^2.8.8",
80-
"styled-components": "^5.3.11",
81-
"tailwindcss": "^3.3.2",
82-
"typescript": "^5.1.3"
86+
"prettier": "^3.3.3",
87+
"styled-components": "^6.1.13",
88+
"tailwindcss": "^3.4.10",
89+
"typescript": "^5.5.4"
8390
},
8491
"lint-staged": {
85-
"*.{js,ts,jsx,tsx}": "eslint src --fix",
92+
"*.{js,ts,jsx,tsx}": "eslint --fix",
8693
"**/*": "prettier -w -u"
8794
},
8895
"browserslist": {

template/antd-console/src/App.tsx

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1-
import React, { useEffect, useState } from 'react'
2-
import { BrowserRouter, Routes, Route } from 'react-router-dom'
3-
import { Provider } from 'mobx-react'
4-
import { ConfigProvider, theme as antdTheme } from 'antd'
5-
import zhCN from 'antd/locale/zh_CN'
1+
import { IconPrefix, Prefix } from '@/constants/config'
2+
import { GlobalContext } from '@/globals/context'
3+
import { useModel } from '@/store'
4+
import { theme as antdTheme, ConfigProvider } from 'antd'
65
import enUS from 'antd/locale/en_US'
6+
import zhCN from 'antd/locale/zh_CN'
77

8-
import { GlobalContext } from '@/globals/context'
9-
import store from '@/store'
8+
import React, { useEffect, useState } from 'react'
9+
import { BrowserRouter, Route, Routes } from 'react-router-dom'
1010
import PageLayout from './layout'
1111
import Login from './pages/login'
12+
import { QueryProvider } from './query-provider'
1213

1314
function App() {
1415
const defaultLang = localStorage.getItem('antd-lang') || 'zh-CN'
1516
const [lang, setLang] = useState(defaultLang)
16-
17-
const { user, global } = store
18-
17+
const store = useModel((state) => state)
1918
function getLocale() {
2019
switch (lang) {
2120
case 'zh-CN':
@@ -30,45 +29,43 @@ function App() {
3029
useEffect(() => {
3130
localStorage.setItem('antd-lang', lang)
3231
}, [lang])
33-
3432
useEffect(() => {
35-
const isLogin = localStorage.getItem('@token')
36-
37-
if (isLogin) {
38-
user.getUserInfo()
39-
user.isLogin = true
33+
if (!!localStorage.getItem('@@token')) {
34+
store.init()
4035
} else if (window.location.pathname !== '/user/login') {
4136
window.location.href = '/user/login'
4237
}
4338
}, [])
4439

4540
const contextValue = {
46-
user,
41+
user: store.info,
4742
lang,
4843
setLang,
4944
}
5045

5146
return (
52-
<BrowserRouter basename="/">
47+
<QueryProvider>
5348
<ConfigProvider
5449
locale={getLocale()}
50+
prefixCls={Prefix}
51+
iconPrefixCls={IconPrefix}
5552
theme={{
5653
algorithm:
57-
global.theme === 'light'
54+
store.theme === 'light'
5855
? antdTheme.defaultAlgorithm
5956
: antdTheme.darkAlgorithm,
6057
}}
6158
>
62-
<Provider {...store}>
63-
<GlobalContext.Provider value={contextValue}>
59+
<GlobalContext.Provider value={contextValue}>
60+
<BrowserRouter basename="/">
6461
<Routes>
6562
<Route path="/user/login" element={<Login />} />
6663
<Route path="*" element={<PageLayout />} />
6764
</Routes>
68-
</GlobalContext.Provider>
69-
</Provider>
65+
</BrowserRouter>
66+
</GlobalContext.Provider>
7067
</ConfigProvider>
71-
</BrowserRouter>
68+
</QueryProvider>
7269
)
7370
}
7471

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1+
import { useModel } from '@/store'
12
import React from 'react'
2-
import { observer } from 'mobx-react'
3-
import { Navigate, useLocation } from 'react-router-dom'
43

5-
import useStores from '@/hooks/useStores'
4+
import { Navigate, useLocation } from 'react-router-dom'
65

76
function Auth({ children }: { children: JSX.Element }) {
87
const location = useLocation()
9-
const userStore = useStores('user')
8+
const [isLogin] = useModel((state) => [state.isLogin])
109

11-
if (!userStore?.isLogin) {
10+
if (!isLogin) {
1211
return <Navigate to="/user/login" state={{ from: location }} replace />
1312
}
1413

1514
return children
1615
}
1716

18-
export default observer(Auth)
17+
export default Auth

template/antd-console/src/components/chart/style/index.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
border-radius: 4px;
1515
color: var(--color-text-2);
1616

17-
:global(.ant-badge-status-dot) {
17+
:global(.lark-badge-status-dot) {
1818
width: 10px;
1919
height: 10px;
2020
margin-right: 8px;
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import { cn } from '@/utils'
2+
3+
import * as React from 'react'
4+
5+
const Card = React.forwardRef<
6+
HTMLDivElement,
7+
React.HTMLAttributes<HTMLDivElement>
8+
>(({ className, ...props }, ref) => (
9+
<div
10+
ref={ref}
11+
className={cn(
12+
'rounded-lg border bg-card text-card-foreground shadow-sm',
13+
className
14+
)}
15+
{...props}
16+
/>
17+
))
18+
Card.displayName = 'Card'
19+
20+
const CardHeader = React.forwardRef<
21+
HTMLDivElement,
22+
React.HTMLAttributes<HTMLDivElement>
23+
>(({ className, ...props }, ref) => (
24+
<div
25+
ref={ref}
26+
className={cn('flex flex-col space-y-1.5 p-6', className)}
27+
{...props}
28+
/>
29+
))
30+
CardHeader.displayName = 'CardHeader'
31+
32+
const CardTitle = React.forwardRef<
33+
HTMLParagraphElement,
34+
React.HTMLAttributes<HTMLHeadingElement>
35+
>(({ className, ...props }, ref) => (
36+
<h3
37+
ref={ref}
38+
className={cn(
39+
'text-2xl font-semibold leading-none tracking-tight',
40+
className
41+
)}
42+
{...props}
43+
/>
44+
))
45+
CardTitle.displayName = 'CardTitle'
46+
47+
const CardDescription = React.forwardRef<
48+
HTMLParagraphElement,
49+
React.HTMLAttributes<HTMLParagraphElement>
50+
>(({ className, ...props }, ref) => (
51+
<p
52+
ref={ref}
53+
className={cn('text-sm text-muted-foreground', className)}
54+
{...props}
55+
/>
56+
))
57+
CardDescription.displayName = 'CardDescription'
58+
59+
const CardContent = React.forwardRef<
60+
HTMLDivElement,
61+
React.HTMLAttributes<HTMLDivElement>
62+
>(({ className, ...props }, ref) => (
63+
<div ref={ref} className={cn('p-6 pt-0', className)} {...props} />
64+
))
65+
CardContent.displayName = 'CardContent'
66+
67+
const CardFooter = React.forwardRef<
68+
HTMLDivElement,
69+
React.HTMLAttributes<HTMLDivElement>
70+
>(({ className, ...props }, ref) => (
71+
<div
72+
ref={ref}
73+
className={cn('flex items-center p-6 pt-0', className)}
74+
{...props}
75+
/>
76+
))
77+
CardFooter.displayName = 'CardFooter'
78+
79+
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle }

0 commit comments

Comments
 (0)