import React, { Component, CSSProperties } from 'react'; import { DeleteOutlined, DownloadOutlined, EditOutlined, PlusCircleOutlined, ReadOutlined } from '@ant-design/icons'; import { Button, Popconfirm } from 'antd'; import { OperatorSwitch } from './EntityList'; import { ButtonProps } from 'antd/lib/button'; export interface OperatorBarProps { onCreate?: () => void; onUpdate?: () => void; onDelete?: () => void; onView?: () => void; onExportSelected?: () => void; onExportAll?: () => void; operatorVisible?: OperatorSwitch; operatorEnable: OperatorSwitch; extraOperators?: React.ReactNode; deleteConfirm?: React.ReactNode; } const buttonCss: CSSProperties = { marginRight: '0.5rem', }; export class OperatorBar extends Component { static defaultProps = { deleteConfirm: '确定删除所选记录吗?' }; render() { const { onCreate, onUpdate, onView, onDelete, operatorVisible, operatorEnable, onExportSelected, onExportAll, extraOperators, deleteConfirm, } = this.props; if (!operatorVisible) return null; const btProps: ButtonProps = { type: 'primary', style: buttonCss }; return (
{operatorVisible.create && ( )} {operatorVisible.update && ( )} {operatorVisible.view && ( )} {operatorVisible.delete && ( )} {operatorVisible.exportSelected && ( )} {operatorVisible.exportAll && ( )} {extraOperators}
); } }