|
|
|
@ -1,20 +1,48 @@
|
|
|
|
|
import { Collapse } from "antd"; |
|
|
|
|
import { useSelector } from "react-redux"; |
|
|
|
|
|
|
|
|
|
import { mapStateSelector } from "@store"; |
|
|
|
|
import { IOverlay } from "@store"; |
|
|
|
|
|
|
|
|
|
import "./style.less"; |
|
|
|
|
|
|
|
|
|
const { Panel } = Collapse; |
|
|
|
|
|
|
|
|
|
export type OverlayListProps = { |
|
|
|
|
overlays: IOverlay[]; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const OverlayList = (props: OverlayListProps) => { |
|
|
|
|
const { overlays } = props; |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<> |
|
|
|
|
{overlays.map((overlay, index) => { |
|
|
|
|
return ( |
|
|
|
|
<div key={index} className="overlay-item"> |
|
|
|
|
{overlay.name} |
|
|
|
|
</div> |
|
|
|
|
); |
|
|
|
|
})} |
|
|
|
|
</> |
|
|
|
|
); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const Catalog = () => { |
|
|
|
|
const callback = (key: string | string[]) => console.log(key); |
|
|
|
|
// const callback = (key: string | string[]) => console.log(key);
|
|
|
|
|
const { rectangles, polygons } = useSelector(mapStateSelector); |
|
|
|
|
return ( |
|
|
|
|
<Collapse |
|
|
|
|
defaultActiveKey={["1"]} |
|
|
|
|
onChange={callback} |
|
|
|
|
// onChange={callback}
|
|
|
|
|
expandIconPosition="right" |
|
|
|
|
> |
|
|
|
|
<Panel header="矩形" key="1"></Panel> |
|
|
|
|
<Panel header="多边形" key="2"></Panel> |
|
|
|
|
<Panel header="线段" key="3"></Panel> |
|
|
|
|
<Panel header="矩形" key={1}> |
|
|
|
|
<OverlayList overlays={rectangles} /> |
|
|
|
|
</Panel> |
|
|
|
|
<Panel header="多边形" key={2}> |
|
|
|
|
<OverlayList overlays={polygons} /> |
|
|
|
|
</Panel> |
|
|
|
|
</Collapse> |
|
|
|
|
); |
|
|
|
|
}; |
|
|
|
|