import React from 'react'; import { CloseOutlined, EditOutlined, EllipsisOutlined, SettingOutlined } from '@ant-design/icons'; import { Card } from 'antd'; import { PortletListView } from './PortletListView'; import { PortletLink } from './PortletLink'; import { PortletTable } from './PortletTable'; import { PortletCalendar } from './PortletCalendar'; import { PortletTab } from './PortletTab'; import { PortletProps } from './Portlet'; const defaultPortalMap: PortletMap = { PortletLink, PortletTable, PortletListView, PortletCalendar, PortletTab }; export interface PortletMap { [key: string]: React.ComponentType; } export interface PortletSwitchProps extends PortletProps { inTab?: boolean; portletMap?: PortletMap; } export const PortletSwitch = (props: PortletSwitchProps) => { return (
); }; const PortletMapping = ({ portlet, portletMap, inTab, services }: PortletSwitchProps) => { const map = { ...defaultPortalMap, ...portletMap }; if (map[portlet.type]) { const Portlet = map[portlet.type]; const portletStyle = portlet.style ? JSON.parse(portlet.style) : {}; return ; } else return ; }; const NotExists = ({ portlet }: PortletProps) => ( , , ]} > } title="控件不存在,请联系管理员" description={portlet.type} /> );