fix: table list action

This commit is contained in:
jialin
2024-07-01 15:35:48 +08:00
parent 018c8cd208
commit 0f9123ee4f
21 changed files with 316 additions and 169 deletions
+9 -1
View File
@@ -25,7 +25,6 @@ const LineChart: React.FC<LineChartProps> = (props) => {
labelFormatter
} = props;
const config = {
title,
height,
xField: xField || 'time',
yField: yField || 'value',
@@ -50,6 +49,15 @@ const LineChart: React.FC<LineChartProps> = (props) => {
style: {
fill: 'rgba(84, 204, 152,0.8)'
},
title: {
title,
style: {
align: 'center',
titleFontSize: 14,
titleFill: 'rgba(0,0,0,0.88)',
titleFontWeight: 500
}
},
legend: {
color: {
layout: { justifyContent: 'center' }
+6 -7
View File
@@ -85,15 +85,14 @@ const BarChart: React.FC<BarChartProps> = (props) => {
},
style: {
// fill: (params: any) => {
// return (
// params.color ||
// 'linear-gradient(90deg,rgba(84, 204, 152,0.8) 0%,rgb(0, 168, 143,.7) 100%)'
// );
// },
fill: (params: any) => {
return (
params.color ||
'linear-gradient(90deg,rgba(84, 204, 152,0.8) 0%,rgb(0, 168, 143,.7) 100%)'
);
},
// radiusTopLeft: 12,
// radiusTopRight: 12,
fill: 'rgba(84, 204, 152,0.8)',
align: 'center',
width: 20
}
+8
View File
@@ -0,0 +1,8 @@
export const titleStyle = {
style: {
align: 'center',
titleFontSize: 14,
titleFill: 'rgba(0,0,0,0.88)',
titleFontWeight: 500
}
};
@@ -0,0 +1,61 @@
import { MoreOutlined } from '@ant-design/icons';
import { Button, Dropdown, Tooltip, type MenuProps } from 'antd';
import _ from 'lodash';
interface DropdownButtonsProps {
items: MenuProps['items'];
size?: 'small' | 'middle' | 'large';
onSelect: (val: any, item?: any) => void;
}
const DropdownButtons: React.FC<DropdownButtonsProps> = ({
items,
size = 'small',
onSelect
}) => {
const handleMenuClick = (item: any) => {
console.log('menu click', item.key);
const selectItem = _.find(items, { key: item.key });
onSelect(item.key, selectItem);
};
const handleButtonClick = (e: any) => {
const headItem = _.head(items);
onSelect(headItem.key, headItem);
};
if (!items?.length) {
return null;
}
return (
<>
{items?.length === 1 ? (
<Button
icon={_.get(items, '0.icon')}
size={size}
onClick={handleButtonClick}
></Button>
) : (
<Dropdown.Button
menu={{
items: _.tail(items),
onClick: handleMenuClick
}}
buttonsRender={([leftButton, rightButton]) => [
<Tooltip title={_.head(items)?.label} key="leftButton">
<Button
onClick={handleButtonClick}
size={size}
icon={_.head(items)?.icon}
></Button>
</Tooltip>,
<Button icon={<MoreOutlined />} size={size} key="menu"></Button>
]}
></Dropdown.Button>
)}
</>
);
};
export default DropdownButtons;
@@ -39,7 +39,6 @@ const SealInputNumber: React.FC<InputNumberProps & SealFormItemProps> = (
};
const handleChange = (e: any) => {
e.target.value = e.target.value?.trim?.();
props.onChange?.(e);
};
@@ -49,7 +48,6 @@ const SealInputNumber: React.FC<InputNumberProps & SealFormItemProps> = (
};
const handleOnBlur = (e: any) => {
e.target.value = e.target.value?.trim?.();
if (!inputRef.current?.value) {
setIsFocus(false);
props.onBlur?.(e);