feat: 1.升级 Ant Design Ui 至 v6 2. 修复企业充值金额输入限制
This commit is contained in:
@@ -39,6 +39,7 @@ import { useLocation } from 'react-router-dom';
|
||||
import { useActualTheme } from '../../context/Theme';
|
||||
import { normalizeLanguage } from '../../i18n/language';
|
||||
import { colord } from 'colord';
|
||||
import './antd-v5-compat.css';
|
||||
|
||||
// 与下方 Ant Design locale 一一对应的 dayjs 语言(未覆盖语言与 Ant Design 一样回退中文)。
|
||||
const DAYJS_LOCALES = {
|
||||
@@ -57,6 +58,17 @@ const DAYJS_LOCALES = {
|
||||
const PROTOTYPE_DARK_PRIMARY = '#d1963a';
|
||||
const PROTOTYPE_DARK_SEED = '#f2ad41';
|
||||
|
||||
// v5 used these shadows in both themes; v6 derives white shadows in dark mode.
|
||||
const v5ShadowTokens = {
|
||||
...Object.fromEntries(
|
||||
Object.entries(theme.getDesignToken()).filter(([name]) =>
|
||||
name.startsWith('boxShadow'),
|
||||
),
|
||||
),
|
||||
boxShadowTertiary:
|
||||
'0 1px 2px 0 rgba(0,0,0,0.03), 0 1px 6px -1px rgba(0,0,0,0.02), 0 2px 4px 0 rgba(0,0,0,0.02)',
|
||||
};
|
||||
|
||||
// 页面局部“品牌强调色”(原型 --brand):等于当前主题的种子色。
|
||||
// 浅色与自定义主色时即 colorPrimary;仅默认暗色主色 #d1963a 时回到原型种子 #f2ad41,
|
||||
// 保证浅色 / 深色 / 自定义主题色三态都只由主题 token 推导,不在页面里另写颜色。
|
||||
@@ -82,6 +94,7 @@ export const prototypeTheme = (dark) => ({
|
||||
};
|
||||
},
|
||||
token: {
|
||||
...v5ShadowTokens,
|
||||
colorPrimary: dark ? PROTOTYPE_DARK_PRIMARY : '#b96508',
|
||||
colorInfo: dark ? PROTOTYPE_DARK_PRIMARY : '#b96508',
|
||||
colorBgLayout: dark ? '#11151c' : '#f4f6f9',
|
||||
@@ -108,6 +121,13 @@ export const prototypeTheme = (dark) => ({
|
||||
},
|
||||
});
|
||||
|
||||
// Keep v5 tag borders and overlay masks while inheriting the existing theme.
|
||||
const v5ComponentDefaults = {
|
||||
tag: { variant: 'outlined' },
|
||||
modal: { mask: { blur: false } },
|
||||
drawer: { mask: { blur: false } },
|
||||
};
|
||||
|
||||
function TokenBridge() {
|
||||
const { token } = theme.useToken();
|
||||
useLayoutEffect(() => {
|
||||
@@ -249,14 +269,14 @@ export default function UiThemeProvider({ children }) {
|
||||
useEffect(() => {
|
||||
ConfigProvider.config({
|
||||
holderRender: (nodes) => (
|
||||
<ConfigProvider theme={config} locale={locale}>
|
||||
<ConfigProvider {...v5ComponentDefaults} theme={config} locale={locale}>
|
||||
{nodes}
|
||||
</ConfigProvider>
|
||||
),
|
||||
});
|
||||
}, [config, locale]);
|
||||
return (
|
||||
<ConfigProvider theme={config} locale={locale}>
|
||||
<ConfigProvider {...v5ComponentDefaults} theme={config} locale={locale}>
|
||||
<App>
|
||||
<TokenBridge />
|
||||
{children}
|
||||
|
||||
Reference in New Issue
Block a user