chore: add modal
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import * as icons from '@ant-design/icons';
|
||||
import { Button, Dropdown, Space } from 'antd';
|
||||
import type { MenuProps } from 'antd/es/menu';
|
||||
import react from 'react';
|
||||
|
||||
type DropdownProps = {
|
||||
trigger?: Array<'click' | 'hover' | 'contextMenu'>;
|
||||
items: MenuProps['items'];
|
||||
onClick: (e: any) => void;
|
||||
};
|
||||
const renderIcon = (icon: string) => {
|
||||
if (!icon) {
|
||||
return null;
|
||||
}
|
||||
// @ts-ignore
|
||||
const Icon = icons[icon] as React.FC;
|
||||
return react.createElement(Icon);
|
||||
};
|
||||
const DropDownActions: React.FC<DropdownProps> = (props) => {
|
||||
const { trigger, items, onClick } = props;
|
||||
return (
|
||||
<Space>
|
||||
<Dropdown menu={{ items, onClick }} trigger={trigger}>
|
||||
<Button
|
||||
onClick={(e) => e.preventDefault()}
|
||||
style={{ fontSize: '14px' }}
|
||||
type="text"
|
||||
icon={renderIcon('MoreOutlined')}
|
||||
></Button>
|
||||
</Dropdown>
|
||||
</Space>
|
||||
);
|
||||
};
|
||||
|
||||
export default DropDownActions;
|
||||
@@ -0,0 +1,20 @@
|
||||
import { Button, Space } from 'antd';
|
||||
|
||||
type ModalFooterProps = {
|
||||
onOk: () => void;
|
||||
onCancel: () => void;
|
||||
};
|
||||
const ModalFooter: React.FC<ModalFooterProps> = ({ onOk, onCancel }) => {
|
||||
return (
|
||||
<Space size={20}>
|
||||
<Button onClick={onCancel} style={{ width: '88px' }}>
|
||||
取消
|
||||
</Button>
|
||||
<Button type="primary" onClick={onOk} style={{ width: '88px' }}>
|
||||
确定
|
||||
</Button>
|
||||
</Space>
|
||||
);
|
||||
};
|
||||
|
||||
export default ModalFooter;
|
||||
@@ -39,6 +39,7 @@ const SealSelect: React.FC<SelectProps & SealFormItemProps> = (props) => {
|
||||
};
|
||||
|
||||
const handleOnBlur = (e: any) => {
|
||||
setIsFocus(false);
|
||||
props.onBlur?.(e);
|
||||
};
|
||||
|
||||
@@ -61,6 +62,7 @@ const SealSelect: React.FC<SelectProps & SealFormItemProps> = (props) => {
|
||||
onBlur={handleOnBlur}
|
||||
onSearch={handleOnSearch}
|
||||
onChange={handleChange}
|
||||
notFoundContent={null}
|
||||
>
|
||||
{children}
|
||||
</Select>
|
||||
|
||||
Reference in New Issue
Block a user