feat: 1.升级 Ant Design Ui 至 v6 2. 修复企业充值金额输入限制

This commit is contained in:
zhanjunhao
2026-11-10 18:49:38 +08:00
parent 6ea8a0f7c2
commit 7364edd68c
106 changed files with 1417 additions and 1010 deletions
+55 -23
View File
@@ -27,7 +27,7 @@ import {
paginationEvents,
paginationShowTotal,
} from './pagination';
import { overlayMaskClosable } from './overlayPolicy';
import { overlayMask } from './overlayPolicy';
import './pagination.css';
import { useIsMobile } from '../../hooks/common/useIsMobile';
import { useConsolePage } from '../console/ConsoleContext';
@@ -132,7 +132,7 @@ export const Card = forwardRef(function Card(
variant={
props.variant ?? (bordered === false ? 'borderless' : 'outlined')
}
size={size === 'small' ? 'small' : 'default'}
size={size === 'small' ? 'small' : 'medium'}
title={
props.title ??
header?.title ??
@@ -141,7 +141,7 @@ export const Card = forwardRef(function Card(
: undefined)
}
extra={headerExtraContent ?? header?.extra}
styles={{ header: headerStyle, body: bodyStyle }}
styles={{ header: headerStyle, body: bodyStyle, ...props.styles }}
>
{props.children}
{footer && <div className='ui-card-footer'>{footer}</div>}
@@ -151,15 +151,15 @@ export const Card = forwardRef(function Card(
export const Space = ({ spacing, vertical, size, ...props }) => (
<Ant.Space
{...props}
direction={vertical ? 'vertical' : 'horizontal'}
orientation={vertical ? 'vertical' : 'horizontal'}
size={spacing === 'medium' ? 'middle' : (spacing ?? size)}
/>
);
export const Divider = ({ margin, align, layout, style, ...props }) => (
<Ant.Divider
{...props}
orientation={align}
type={layout === 'vertical' ? 'vertical' : 'horizontal'}
titlePlacement={align}
orientation={layout === 'vertical' ? 'vertical' : 'horizontal'}
style={{ margin, ...style }}
/>
);
@@ -174,6 +174,7 @@ export const Tag = forwardRef(function Tag(
prefix,
children,
color,
bordered,
...props
},
ref,
@@ -182,6 +183,7 @@ export const Tag = forwardRef(function Tag(
<Ant.Tag
{...props}
ref={ref}
variant={props.variant ?? (bordered === false ? 'filled' : 'outlined')}
color={
['white', 'grey', 'light-blue', 'light-green'].includes(color)
? {
@@ -231,6 +233,8 @@ export const Spin = ({
style,
className,
'data-testid': testId,
tip,
wrapperClassName,
...props
}) =>
children ? (
@@ -239,14 +243,20 @@ export const Spin = ({
className={`ui-spin-shell ${className || ''}`}
data-testid={testId}
>
<Ant.Spin {...props} size={controlSize(size)}>
<Ant.Spin
{...props}
description={tip ?? props.description}
classNames={{ root: wrapperClassName, ...props.classNames }}
size={size === 'default' ? 'medium' : size}
>
<div style={childStyle}>{children}</div>
</Ant.Spin>
</div>
) : (
<Ant.Spin
{...props}
size={controlSize(size)}
size={size === 'default' ? 'medium' : size}
description={tip ?? props.description}
style={style}
className={className}
data-testid={testId}
@@ -556,8 +566,8 @@ export const Timeline = Object.assign(
.filter(React.isValidElement)
.map((child) => ({
color: child.props.type === 'ongoing' ? 'blue' : undefined,
label: child.props.time,
children: (
title: child.props.time,
content: (
<>
{child.props.children}
{child.props.extra}
@@ -634,7 +644,7 @@ export const Banner = ({
return (
<Component
{...props}
message={title}
title={title}
type={type === 'danger' ? 'error' : type}
showIcon
closable={!!closeIcon}
@@ -642,9 +652,9 @@ export const Banner = ({
/>
);
};
export const Alert = (props) => {
export const Alert = ({ message, ...props }) => {
const Component = useConsolePage() ? ConsoleAlert : Ant.Alert;
return <Component {...props} />;
return <Component {...props} title={props.title ?? message} />;
};
function modalProps({
@@ -659,20 +669,23 @@ function modalProps({
type,
bodyStyle,
maskStyle,
mask,
maskClosable,
destroyOnClose,
...props
}) {
return {
...props,
maskClosable: overlayMaskClosable(props.maskClosable),
mask: overlayMask(mask, maskClosable),
open: visible,
title: header === null ? null : (props.title ?? header),
keyboard: closeOnEsc,
forceRender: lazyRender === false,
destroyOnHidden: keepDOM === false || destroyOnClose,
destroyOnHidden:
keepDOM === false || destroyOnClose || props.destroyOnHidden,
width: size === 'full-width' ? '100%' : props.width,
okButtonProps: { danger: okType === 'danger', ...props.okButtonProps },
styles: { body: bodyStyle, mask: maskStyle },
styles: { body: bodyStyle, mask: maskStyle, ...props.styles },
};
}
export const Modal = Object.assign(
@@ -702,18 +715,31 @@ export const SideSheet = ({
headerStyle,
maskStyle,
destroyOnClose,
mask,
maskClosable,
width,
height,
...props
}) => {
const Component = useConsolePage() ? ConsoleDrawer : Ant.Drawer;
return (
<Component
{...props}
maskClosable={overlayMaskClosable(props.maskClosable)}
mask={overlayMask(mask, maskClosable)}
size={
props.size ??
(['top', 'bottom'].includes(props.placement) ? height : width)
}
open={visible}
onClose={onCancel}
keyboard={closeOnEsc}
destroyOnHidden={destroyOnClose}
styles={{ body: bodyStyle, header: headerStyle, mask: maskStyle }}
destroyOnHidden={destroyOnClose ?? props.destroyOnHidden}
styles={{
body: bodyStyle,
header: headerStyle,
mask: maskStyle,
...props.styles,
}}
/>
);
};
@@ -727,7 +753,12 @@ export const ImagePreview = ({
}) => (
<Ant.Image.PreviewGroup
items={Array.isArray(src) ? src : [src]}
preview={{ visible, onVisibleChange, current: currentIndex, onChange }}
preview={{
open: visible,
onOpenChange: onVisibleChange,
current: currentIndex,
onChange,
}}
/>
);
@@ -747,11 +778,12 @@ Toast.destroyAll = Ant.message.destroy;
export const Notification = Object.fromEntries(
['success', 'info', 'warning', 'error', 'open'].map((method) => [
method,
(config) =>
({ title, message, content, description, btn, actions, ...config }) =>
Ant.notification[method]({
...config,
message: config.title ?? config.message,
description: config.content ?? config.description,
title: title ?? message,
description: content ?? description,
actions: actions ?? btn,
}),
]),
);