refactor: update scroll modal

This commit is contained in:
jialin
2025-09-16 11:26:17 +08:00
parent 29b74f85c5
commit 55b0a20a4a
17 changed files with 340 additions and 163 deletions
+2
View File
@@ -28,6 +28,8 @@ const AlertInfo: React.FC<AlertInfoProps> = (props) => {
}
}
style={{
fontWeight: 400,
whiteSpace: 'pre-line',
textAlign: 'center',
padding: '2px 5px',
borderRadius: 'var(--border-radius-base)',
+2 -2
View File
@@ -151,7 +151,7 @@ export default function useChartConfig() {
progress: {
show: true,
roundCap: false,
width: 12
width: 10
},
pointer: {
length: '80%',
@@ -163,7 +163,7 @@ export default function useChartConfig() {
axisLine: {
roundCap: false,
lineStyle: {
width: 12,
width: 10,
color: [
[0.5, 'rgba(84, 204, 152, 80%)'],
[0.8, 'rgba(250, 173, 20, 80%)'],
+9 -4
View File
@@ -22,13 +22,18 @@ const GaugeChart: React.FC<Omit<ChartProps, 'seriesData' | 'xAxisData'>> = (
title: titleConfig,
chartColorMap
} = useChartConfig();
const { value, height, width, labelFormatter, title, color } = props;
const { value, height, width, labelFormatter, title, color, gaugeConfig } =
props;
if (!value && value !== 0) {
return <EmptyData height={height} title={title}></EmptyData>;
}
const setDataOptions = () => {
const colorValue = color || strokeColorFunc(value);
const combineGaugeConfig = {
...gaugeItemConfig,
...gaugeConfig
};
return {
title: {
...titleConfig,
@@ -38,11 +43,11 @@ const GaugeChart: React.FC<Omit<ChartProps, 'seriesData' | 'xAxisData'>> = (
},
series: [
{
...gaugeItemConfig,
...combineGaugeConfig,
axisLine: {
...gaugeItemConfig.axisLine,
...combineGaugeConfig.axisLine,
lineStyle: {
...gaugeItemConfig.axisLine.lineStyle,
...combineGaugeConfig.axisLine.lineStyle,
color: [
[value / 100, colorValue],
[1, chartColorMap.gaugeBgColor]
+6
View File
@@ -13,6 +13,12 @@ export interface ChartProps {
smooth?: boolean;
color?: string;
yAxisName?: string;
gaugeConfig?: {
radius?: string;
center?: string[];
startAngle?: number;
endAngle?: number;
};
}
export interface AreaChartItemProps {
+30 -2
View File
@@ -1,8 +1,9 @@
import OverlayScroller from '@/components/overlay-scroller';
import useBodyScroll from '@/hooks/use-body-scroll';
import { Modal, type ModalProps } from 'antd';
import React from 'react';
const ScrollerModal = (props: ModalProps) => {
const ScrollerModal = (props: ModalProps & { maxContentHeight?: number }) => {
const { saveScrollHeight, restoreScrollHeight } = useBodyScroll();
React.useEffect(() => {
@@ -13,7 +14,34 @@ const ScrollerModal = (props: ModalProps) => {
}
}, [props.open]);
return <Modal {...props} />;
return (
<Modal
{...props}
styles={{
content: {
padding: 0
},
header: {
padding: 'var(--ant-modal-content-padding)',
paddingBottom: '0'
},
body: {
padding: '0'
},
footer: {
padding: '12px 24px 24px',
margin: '0'
}
}}
>
<OverlayScroller
style={{ paddingInline: 24, paddingBlockEnd: props.footer ? 0 : 32 }}
maxHeight={props.maxContentHeight || 500}
>
{props.children}
</OverlayScroller>
</Modal>
);
};
export default ScrollerModal;