Add behavior details panel

This commit is contained in:
MrKBear 2022-04-03 22:56:16 +08:00
parent 7fd22bb5fd
commit 2cf9a22907
6 changed files with 42 additions and 4 deletions

View File

@ -48,6 +48,8 @@ const EN_US = {
"Panel.Info.Group.Details.View": "Edit view group attributes", "Panel.Info.Group.Details.View": "Edit view group attributes",
"Panel.Title.Behavior.List.View": "Behavior list", "Panel.Title.Behavior.List.View": "Behavior list",
"Panel.Info.Behavior.List.View": "Edit view behavior list", "Panel.Info.Behavior.List.View": "Edit view behavior list",
"Panel.Title.Behavior.Details.View": "Behavior",
"Panel.Info.Behavior.Details.View": "Edit view Behavior attributes",
"Popup.Title.Unnamed": "Popup message", "Popup.Title.Unnamed": "Popup message",
"Popup.Title.Confirm": "Confirm message", "Popup.Title.Confirm": "Confirm message",
"Popup.Action.Yes": "Confirm", "Popup.Action.Yes": "Confirm",
@ -109,5 +111,6 @@ const EN_US = {
"Panel.Info.Group.Details.Attr.Error.Unspecified": "Unspecified group object", "Panel.Info.Group.Details.Attr.Error.Unspecified": "Unspecified group object",
"Panel.Info.Label.Details.Error.Unspecified": "Label object not specified", "Panel.Info.Label.Details.Error.Unspecified": "Label object not specified",
"Panel.Info.Label.List.Error.Nodata": "There are no labels in the model, click the button to create", "Panel.Info.Label.List.Error.Nodata": "There are no labels in the model, click the button to create",
"Panel.Info.Behavior.Details.Error.Not.Behavior": "Please specify a behavior first to view the details",
} }
export default EN_US; export default EN_US;

View File

@ -48,6 +48,8 @@ const ZH_CN = {
"Panel.Info.Group.Details.View": "编辑查看群属性", "Panel.Info.Group.Details.View": "编辑查看群属性",
"Panel.Title.Behavior.List.View": "行为列表", "Panel.Title.Behavior.List.View": "行为列表",
"Panel.Info.Behavior.List.View": "编辑查看行为列表", "Panel.Info.Behavior.List.View": "编辑查看行为列表",
"Panel.Title.Behavior.Details.View": "行为",
"Panel.Info.Behavior.Details.View": "编辑查看行为属性",
"Popup.Title.Unnamed": "弹窗消息", "Popup.Title.Unnamed": "弹窗消息",
"Popup.Title.Confirm": "确认消息", "Popup.Title.Confirm": "确认消息",
"Popup.Action.Yes": "确定", "Popup.Action.Yes": "确定",
@ -109,5 +111,6 @@ const ZH_CN = {
"Panel.Info.Group.Details.Attr.Error.Unspecified": "未指定群对象", "Panel.Info.Group.Details.Attr.Error.Unspecified": "未指定群对象",
"Panel.Info.Label.Details.Error.Unspecified": "未指定标签对象", "Panel.Info.Label.Details.Error.Unspecified": "未指定标签对象",
"Panel.Info.Label.List.Error.Nodata": "模型中没有标签,点击按钮以创建", "Panel.Info.Label.List.Error.Nodata": "模型中没有标签,点击按钮以创建",
"Panel.Info.Behavior.Details.Error.Not.Behavior": "请先指定一个行为以查看详情",
} }
export default ZH_CN; export default ZH_CN;

View File

@ -75,9 +75,9 @@ class SimulatorWeb extends Component {
items: [ items: [
{ {
items: [ items: [
{panels: ["RenderView", "Label Aa Bb", "Label aaa"]}, {panels: ["RenderView"]},
{ {
items: [{panels: ["BehaviorList", "Label bbb"]}, {panels: ["LabelList"]}], items: [{panels: ["BehaviorList"]}, {panels: ["LabelList"]}],
scale: 80, scale: 80,
layout: LayoutDirection.X layout: LayoutDirection.X
} }
@ -87,9 +87,9 @@ class SimulatorWeb extends Component {
}, },
{ {
items: [{ items: [{
panels: ["ObjectList", "Test tab"] panels: ["ObjectList"]
}, { }, {
panels: ["GroupDetails", "RangeDetails", "LabelDetails"] panels: ["GroupDetails", "RangeDetails", "LabelDetails", "BehaviorDetails"]
}], }],
scale: 30, scale: 30,
layout: LayoutDirection.Y layout: LayoutDirection.Y

View File

@ -0,0 +1,26 @@
import { Component, ReactNode} from "react";
import { useStatusWithEvent, IMixinStatusProps } from "@Context/Status";
import { Behavior } from "@Model/Behavior";
import { Message } from "@Component/Message/Message";
import "./BehaviorDetails.scss";
interface IBehaviorDetailsProps {}
@useStatusWithEvent("focusBehaviorChange")
class BehaviorDetails extends Component<IBehaviorDetailsProps & IMixinStatusProps> {
private renderFrom(behavior: Behavior): ReactNode {
return <></>;
}
public render(): ReactNode {
if (this.props.status) {
if (this.props.status.focusBehavior) {
return this.renderFrom(this.props.status.focusBehavior);
}
}
return <Message i18nKey="Panel.Info.Behavior.Details.Error.Not.Behavior"/>;
}
}
export { BehaviorDetails };

View File

@ -9,6 +9,7 @@ import { LabelList } from "./LabelList/LabelList";
import { LabelDetails } from "./LabelDetails/LabelDetails"; import { LabelDetails } from "./LabelDetails/LabelDetails";
import { GroupDetails } from "./GroupDetails/GroupDetails"; import { GroupDetails } from "./GroupDetails/GroupDetails";
import { BehaviorList } from "./BehaviorList/BehaviorList"; import { BehaviorList } from "./BehaviorList/BehaviorList";
import { BehaviorDetails } from "./BehaviorDetails/BehaviorDetails";
interface IPanelInfo { interface IPanelInfo {
nameKey: string; nameKey: string;
@ -29,6 +30,7 @@ type PanelId = ""
| "LabelDetails" // 标签属性 | "LabelDetails" // 标签属性
| "GroupDetails" // 群属性 | "GroupDetails" // 群属性
| "BehaviorList" // 行为列表 | "BehaviorList" // 行为列表
| "BehaviorDetails" // 行为属性
; ;
const PanelInfoMap = new Map<PanelId, IPanelInfo>(); const PanelInfoMap = new Map<PanelId, IPanelInfo>();
@ -60,6 +62,10 @@ PanelInfoMap.set("BehaviorList", {
nameKey: "Panel.Title.Behavior.List.View", introKay: "Panel.Info.Behavior.List.View", nameKey: "Panel.Title.Behavior.List.View", introKay: "Panel.Info.Behavior.List.View",
class: BehaviorList, hidePadding: true class: BehaviorList, hidePadding: true
}); });
PanelInfoMap.set("BehaviorDetails", {
nameKey: "Panel.Title.Behavior.Details.View", introKay: "Panel.Info.Behavior.Details.View",
class: BehaviorDetails
});
function getPanelById(panelId: PanelId): ReactNode { function getPanelById(panelId: PanelId): ReactNode {
switch (panelId) { switch (panelId) {