// TODO: 通用组件 - 按钮 菜单控制层 import useIcon from "../../../hooks/useIcon"; import cls from "./index.module.css"; import { useMemo, useState } from "react"; import { Switch, Select, Radio } from "antd"; import "./selector.style.overwrite.css"; // import { Switch, Select, Space } from 'antd'; import triangle from "../../../assets/Icon/triangle.svg"; const handleChange = (value: string) => { console.log(`selected ${value}`); }; function choseBg(size) { const [width, height] = size; return width === "long" && height === "middle" ? "long-middle" : width === "long" && height === "short" ? "long-short" : width === "short" && height === "middle" ? "short-middle" : width === "short" && height === "short" ? "short-short" : width === "short" && height === "long" ? "short-long" : width === "middle" && height === "middle" ? "middle-middle" : width === "middle" && height === "short" ? "middle-short" : width === "middle" && height === "long" ? "middle-long" : width === "middle" && height === "full" ? "middle-full" : "middle-middle"; } function GraphBase(props) { const size = props.size || ["middle", "middle"]; const bgClass = choseBg(size); const { icon, title, desc, switchOptions, onSwitch, dateOptions, onDateChange, defaultSelect, selectWidth, legend, } = props; const iconSrc = useIcon(icon); const colors = useMemo(() => ["#ffd160", "#2760ff", "#15e8f5"], []); const [showChart, setShowChart] = useState(true); let dto = null; let timerangeHint = null; const switchStyle = {}; if (props.switchPosition) { props.switchPosition.forEach((item, index) => { if (item != null) { switchStyle[index == 0 ? "top" : "left"] = item + "px"; } }); } if (dateOptions) { console.log("dateoptions ", title, dateOptions); dto = (