强制要求 onClose 属性,简化面板关闭逻辑
This commit is contained in:
@@ -65,7 +65,7 @@ export interface SCADADataPanelProps {
|
|||||||
/** 外部传入结束时间(ISO8601 字符串),用于初始化并触发查询 */
|
/** 外部传入结束时间(ISO8601 字符串),用于初始化并触发查询 */
|
||||||
end_time?: string;
|
end_time?: string;
|
||||||
/** 关闭面板 */
|
/** 关闭面板 */
|
||||||
onClose?: () => void;
|
onClose: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
type PanelTab = "chart" | "table";
|
type PanelTab = "chart" | "table";
|
||||||
@@ -432,7 +432,6 @@ const SCADADataPanel: React.FC<SCADADataPanelProps> = ({
|
|||||||
end_time,
|
end_time,
|
||||||
onClose,
|
onClose,
|
||||||
}) => {
|
}) => {
|
||||||
const handleClose = onClose ?? (() => {});
|
|
||||||
// 从 featureInfos 中提取设备 ID 列表
|
// 从 featureInfos 中提取设备 ID 列表
|
||||||
const deviceIds = useMemo(
|
const deviceIds = useMemo(
|
||||||
() => featureInfos.map(([id]) => id),
|
() => featureInfos.map(([id]) => id),
|
||||||
@@ -936,7 +935,7 @@ const SCADADataPanel: React.FC<SCADADataPanelProps> = ({
|
|||||||
<IconButton
|
<IconButton
|
||||||
className="panel-close-button"
|
className="panel-close-button"
|
||||||
size="small"
|
size="small"
|
||||||
onClick={handleClose}
|
onClick={onClose}
|
||||||
aria-label="关闭历史数据面板"
|
aria-label="关闭历史数据面板"
|
||||||
sx={panelHeaderActionSx}
|
sx={panelHeaderActionSx}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ interface PropertyPanelProps {
|
|||||||
id?: string;
|
id?: string;
|
||||||
type?: string;
|
type?: string;
|
||||||
properties?: PropertyItem[];
|
properties?: PropertyItem[];
|
||||||
onClose?: () => void;
|
onClose: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PropertyPanel: React.FC<PropertyPanelProps> = ({
|
const PropertyPanel: React.FC<PropertyPanelProps> = ({
|
||||||
@@ -36,7 +36,6 @@ const PropertyPanel: React.FC<PropertyPanelProps> = ({
|
|||||||
onClose,
|
onClose,
|
||||||
}) => {
|
}) => {
|
||||||
const draggableRef = useRef<HTMLDivElement>(null);
|
const draggableRef = useRef<HTMLDivElement>(null);
|
||||||
const handleClose = onClose ?? (() => {});
|
|
||||||
const headerActionSx = {
|
const headerActionSx = {
|
||||||
color: "common.white",
|
color: "common.white",
|
||||||
backgroundColor: "rgba(255,255,255,0.08)",
|
backgroundColor: "rgba(255,255,255,0.08)",
|
||||||
@@ -98,7 +97,7 @@ const PropertyPanel: React.FC<PropertyPanelProps> = ({
|
|||||||
<IconButton
|
<IconButton
|
||||||
className="panel-close-button"
|
className="panel-close-button"
|
||||||
size="small"
|
size="small"
|
||||||
onClick={handleClose}
|
onClick={onClose}
|
||||||
aria-label="关闭属性面板"
|
aria-label="关闭属性面板"
|
||||||
sx={headerActionSx}
|
sx={headerActionSx}
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user