Compare commits
5 Commits
3351769106
...
c3d4c13c10
Author | SHA1 | Date | |
---|---|---|---|
c3d4c13c10 | |||
5b9d59f8b3 | |||
f0c006affa | |||
a2499a5d3b | |||
9979203fda |
@ -1,13 +1,13 @@
|
|||||||
import { BehaviorRecorder, IAnyBehaviorRecorder } from "@Model/Behavior";
|
import { BehaviorRecorder, IAnyBehaviorRecorder } from "@Model/Behavior";
|
||||||
import { Template } from "@Behavior/Template";
|
import { Template } from "@Behavior/Template";
|
||||||
import { Dynamics } from "@Behavior/Dynamics";
|
import { PhysicsDynamics } from "@Behavior/PhysicsDynamics";
|
||||||
import { Brownian } from "@Behavior/Brownian";
|
import { Brownian } from "@Behavior/Brownian";
|
||||||
import { BoundaryConstraint } from "@Behavior/BoundaryConstraint";
|
import { BoundaryConstraint } from "@Behavior/BoundaryConstraint";
|
||||||
import { Tracking } from "@Behavior/Tracking";
|
import { Tracking } from "@Behavior/Tracking";
|
||||||
|
|
||||||
const AllBehaviors: IAnyBehaviorRecorder[] = [
|
const AllBehaviors: IAnyBehaviorRecorder[] = [
|
||||||
new BehaviorRecorder(Template),
|
new BehaviorRecorder(Template),
|
||||||
new BehaviorRecorder(Dynamics),
|
new BehaviorRecorder(PhysicsDynamics),
|
||||||
new BehaviorRecorder(Brownian),
|
new BehaviorRecorder(Brownian),
|
||||||
new BehaviorRecorder(BoundaryConstraint),
|
new BehaviorRecorder(BoundaryConstraint),
|
||||||
new BehaviorRecorder(Tracking),
|
new BehaviorRecorder(Tracking),
|
||||||
|
@ -17,7 +17,7 @@ class BoundaryConstraint extends Behavior<IBoundaryConstraintBehaviorParameter,
|
|||||||
|
|
||||||
public override behaviorName: string = "$Title";
|
public override behaviorName: string = "$Title";
|
||||||
|
|
||||||
public override iconName: string = "Running";
|
public override iconName: string = "Quantity";
|
||||||
|
|
||||||
public override describe: string = "$Intro";
|
public override describe: string = "$Intro";
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ class Brownian extends Behavior<IBrownianBehaviorParameter, IBrownianBehaviorEve
|
|||||||
|
|
||||||
public override behaviorName: string = "$Title";
|
public override behaviorName: string = "$Title";
|
||||||
|
|
||||||
public override iconName: string = "Running";
|
public override iconName: string = "ScatterChart";
|
||||||
|
|
||||||
public override describe: string = "$Intro";
|
public override describe: string = "$Intro";
|
||||||
|
|
||||||
|
@ -3,22 +3,23 @@ import Group from "@Model/Group";
|
|||||||
import Individual from "@Model/Individual";
|
import Individual from "@Model/Individual";
|
||||||
import { Model } from "@Model/Model";
|
import { Model } from "@Model/Model";
|
||||||
|
|
||||||
type IDynamicsBehaviorParameter = {
|
type IPhysicsDynamicsBehaviorParameter = {
|
||||||
mass: "number",
|
mass: "number",
|
||||||
maxAcceleration: "number",
|
maxAcceleration: "number",
|
||||||
maxVelocity: "number",
|
maxVelocity: "number",
|
||||||
resistance: "number"
|
resistance: "number",
|
||||||
|
limit: "boolean"
|
||||||
}
|
}
|
||||||
|
|
||||||
type IDynamicsBehaviorEvent = {}
|
type IPhysicsDynamicsBehaviorEvent = {}
|
||||||
|
|
||||||
class Dynamics extends Behavior<IDynamicsBehaviorParameter, IDynamicsBehaviorEvent> {
|
class PhysicsDynamics extends Behavior<IPhysicsDynamicsBehaviorParameter, IPhysicsDynamicsBehaviorEvent> {
|
||||||
|
|
||||||
public override behaviorId: string = "Dynamics";
|
public override behaviorId: string = "PhysicsDynamics";
|
||||||
|
|
||||||
public override behaviorName: string = "$Title";
|
public override behaviorName: string = "$Title";
|
||||||
|
|
||||||
public override iconName: string = "Running";
|
public override iconName: string = "SliderHandleSize";
|
||||||
|
|
||||||
public override describe: string = "$Intro";
|
public override describe: string = "$Intro";
|
||||||
|
|
||||||
@ -26,9 +27,16 @@ class Dynamics extends Behavior<IDynamicsBehaviorParameter, IDynamicsBehaviorEve
|
|||||||
|
|
||||||
public override parameterOption = {
|
public override parameterOption = {
|
||||||
mass: { name: "$Mass", type: "number", defaultValue: 1, numberStep: .01, numberMin: .001 },
|
mass: { name: "$Mass", type: "number", defaultValue: 1, numberStep: .01, numberMin: .001 },
|
||||||
maxAcceleration: { name: "$Max.Acceleration", type: "number", defaultValue: 5, numberStep: .1, numberMin: 0 },
|
resistance: { name: "$Resistance", type: "number", defaultValue: 0.5, numberStep: .1, numberMin: 0 },
|
||||||
maxVelocity: { name: "$Max.Velocity", type: "number", defaultValue: 10, numberStep: .1, numberMin: 0 },
|
limit: { name: "$Limit", type: "boolean", defaultValue: true },
|
||||||
resistance: { name: "$Resistance", type: "number", defaultValue: 0.5, numberStep: .1, numberMin: 0 }
|
maxAcceleration: {
|
||||||
|
name: "$Max.Acceleration", type: "number", defaultValue: 5,
|
||||||
|
numberStep: .1, numberMin: 0, condition: { key: "limit", value: true }
|
||||||
|
},
|
||||||
|
maxVelocity: {
|
||||||
|
name: "$Max.Velocity", type: "number", defaultValue: 10,
|
||||||
|
numberStep: .1, numberMin: 0, condition: { key: "limit", value: true }
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
public override finalEffect = (individual: Individual, group: Group, model: Model, t: number): void => {
|
public override finalEffect = (individual: Individual, group: Group, model: Model, t: number): void => {
|
||||||
@ -54,12 +62,14 @@ class Dynamics extends Behavior<IDynamicsBehaviorParameter, IDynamicsBehaviorEve
|
|||||||
individual.acceleration[2] = individual.force[2] / this.parameter.mass;
|
individual.acceleration[2] = individual.force[2] / this.parameter.mass;
|
||||||
|
|
||||||
// 加速度约束
|
// 加速度约束
|
||||||
|
if (this.parameter.limit) {
|
||||||
const lengthA = individual.vectorLength(individual.acceleration);
|
const lengthA = individual.vectorLength(individual.acceleration);
|
||||||
if (lengthA > this.parameter.maxAcceleration) {
|
if (lengthA > this.parameter.maxAcceleration) {
|
||||||
individual.acceleration[0] = individual.acceleration[0] * this.parameter.maxAcceleration / lengthA;
|
individual.acceleration[0] = individual.acceleration[0] * this.parameter.maxAcceleration / lengthA;
|
||||||
individual.acceleration[1] = individual.acceleration[1] * this.parameter.maxAcceleration / lengthA;
|
individual.acceleration[1] = individual.acceleration[1] * this.parameter.maxAcceleration / lengthA;
|
||||||
individual.acceleration[2] = individual.acceleration[2] * this.parameter.maxAcceleration / lengthA;
|
individual.acceleration[2] = individual.acceleration[2] * this.parameter.maxAcceleration / lengthA;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 计算速度
|
// 计算速度
|
||||||
individual.velocity[0] = individual.velocity[0] + individual.acceleration[0] * t;
|
individual.velocity[0] = individual.velocity[0] + individual.acceleration[0] * t;
|
||||||
@ -67,12 +77,14 @@ class Dynamics extends Behavior<IDynamicsBehaviorParameter, IDynamicsBehaviorEve
|
|||||||
individual.velocity[2] = individual.velocity[2] + individual.acceleration[2] * t;
|
individual.velocity[2] = individual.velocity[2] + individual.acceleration[2] * t;
|
||||||
|
|
||||||
// 速度约束
|
// 速度约束
|
||||||
|
if (this.parameter.limit) {
|
||||||
const lengthV = individual.vectorLength(individual.velocity);
|
const lengthV = individual.vectorLength(individual.velocity);
|
||||||
if (lengthV > this.parameter.maxVelocity) {
|
if (lengthV > this.parameter.maxVelocity) {
|
||||||
individual.velocity[0] = individual.velocity[0] * this.parameter.maxVelocity / lengthV;
|
individual.velocity[0] = individual.velocity[0] * this.parameter.maxVelocity / lengthV;
|
||||||
individual.velocity[1] = individual.velocity[1] * this.parameter.maxVelocity / lengthV;
|
individual.velocity[1] = individual.velocity[1] * this.parameter.maxVelocity / lengthV;
|
||||||
individual.velocity[2] = individual.velocity[2] * this.parameter.maxVelocity / lengthV;
|
individual.velocity[2] = individual.velocity[2] * this.parameter.maxVelocity / lengthV;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 应用速度
|
// 应用速度
|
||||||
individual.position[0] = individual.position[0] + individual.velocity[0] * t;
|
individual.position[0] = individual.position[0] + individual.velocity[0] * t;
|
||||||
@ -87,12 +99,16 @@ class Dynamics extends Behavior<IDynamicsBehaviorParameter, IDynamicsBehaviorEve
|
|||||||
|
|
||||||
public override terms: Record<string, Record<string, string>> = {
|
public override terms: Record<string, Record<string, string>> = {
|
||||||
"$Title": {
|
"$Title": {
|
||||||
"ZH_CN": "动力学",
|
"ZH_CN": "物理动力学",
|
||||||
"EN_US": "Dynamics"
|
"EN_US": "Physics dynamics"
|
||||||
},
|
},
|
||||||
"$Intro": {
|
"$Intro": {
|
||||||
"ZH_CN": "一切可以运动物体的必要行为,执行物理法则。",
|
"ZH_CN": "一切按照物理规则运动物体的行为, 按照牛顿经典物理运动公式执行。",
|
||||||
"EN_US": "All necessary behaviors that can move objects and implement the laws of physics."
|
"EN_US": "The behavior of all moving objects according to physical rules is carried out according to Newton's classical physical motion formula."
|
||||||
|
},
|
||||||
|
"$Limit": {
|
||||||
|
"ZH_CN": "开启限制",
|
||||||
|
"EN_US": "Enable limit"
|
||||||
},
|
},
|
||||||
"$Mass": {
|
"$Mass": {
|
||||||
"ZH_CN": "质量 (Kg)",
|
"ZH_CN": "质量 (Kg)",
|
||||||
@ -117,4 +133,4 @@ class Dynamics extends Behavior<IDynamicsBehaviorParameter, IDynamicsBehaviorEve
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export { Dynamics };
|
export { PhysicsDynamics };
|
@ -16,7 +16,7 @@ class Tracking extends Behavior<ITrackingBehaviorParameter, ITrackingBehaviorEve
|
|||||||
|
|
||||||
public override behaviorName: string = "$Title";
|
public override behaviorName: string = "$Title";
|
||||||
|
|
||||||
public override iconName: string = "BullseyeTarget";
|
public override iconName: string = "Bullseye";
|
||||||
|
|
||||||
public override describe: string = "$Intro";
|
public override describe: string = "$Intro";
|
||||||
|
|
||||||
|
@ -32,9 +32,15 @@ class Parameter<P extends IParameter> extends Component<IParameterProps<P> & IMi
|
|||||||
private renderParameter<K extends keyof P>
|
private renderParameter<K extends keyof P>
|
||||||
(key: K, option: IParameterOptionItem<P[K]>, value: IParamValue<P[K]>): ReactNode {
|
(key: K, option: IParameterOptionItem<P[K]>, value: IParamValue<P[K]>): ReactNode {
|
||||||
|
|
||||||
const language = this.props.setting?.language ?? "EN_US";
|
|
||||||
const indexKey = `${this.props.key}-${key}`;
|
const indexKey = `${this.props.key}-${key}`;
|
||||||
|
|
||||||
|
// 条件检测
|
||||||
|
if (option.condition && this.props.value[option.condition.key] !== option.condition.value) {
|
||||||
|
return <Fragment key={indexKey}/>;
|
||||||
|
}
|
||||||
|
|
||||||
const type = option.type;
|
const type = option.type;
|
||||||
|
const language = this.props.setting?.language ?? "EN_US";
|
||||||
let keyI18n: string, keyI18nOption: Record<string, string> | undefined;
|
let keyI18n: string, keyI18nOption: Record<string, string> | undefined;
|
||||||
|
|
||||||
// Custom I18N
|
// Custom I18N
|
||||||
|
@ -57,8 +57,11 @@ const EN_US = {
|
|||||||
"Popup.Action.No": "Cancel",
|
"Popup.Action.No": "Cancel",
|
||||||
"Popup.Action.Objects.Confirm.Title": "Confirm Delete",
|
"Popup.Action.Objects.Confirm.Title": "Confirm Delete",
|
||||||
"Popup.Action.Objects.Confirm.Delete": "Delete",
|
"Popup.Action.Objects.Confirm.Delete": "Delete",
|
||||||
|
"Popup.Action.Objects.Confirm.Restore.Title": "Confirm Restore",
|
||||||
|
"Popup.Action.Objects.Confirm.Restore": "Restore",
|
||||||
"Popup.Delete.Objects.Confirm": "Are you sure you want to delete this object(s)? The object is deleted and cannot be recalled.",
|
"Popup.Delete.Objects.Confirm": "Are you sure you want to delete this object(s)? The object is deleted and cannot be recalled.",
|
||||||
"Popup.Delete.Behavior.Confirm": "Are you sure you want to delete this behavior? The behavior is deleted and cannot be recalled.",
|
"Popup.Delete.Behavior.Confirm": "Are you sure you want to delete this behavior? The behavior is deleted and cannot be recalled.",
|
||||||
|
"Popup.Restore.Behavior.Confirm": "Are you sure you want to reset all parameters of this behavior? This operation cannot be recalled.",
|
||||||
"Popup.Setting.Title": "Preferences setting",
|
"Popup.Setting.Title": "Preferences setting",
|
||||||
"Popup.Add.Behavior.Title": "Add behavior",
|
"Popup.Add.Behavior.Title": "Add behavior",
|
||||||
"Popup.Add.Behavior.Action.Add": "Add all select behavior",
|
"Popup.Add.Behavior.Action.Add": "Add all select behavior",
|
||||||
@ -108,6 +111,7 @@ const EN_US = {
|
|||||||
"Common.Attr.Key.Generation.Error.Invalid.Label": "The specified label has expired",
|
"Common.Attr.Key.Generation.Error.Invalid.Label": "The specified label has expired",
|
||||||
"Common.Attr.Key.Kill.Random": "Random kill",
|
"Common.Attr.Key.Kill.Random": "Random kill",
|
||||||
"Common.Attr.Key.Kill.Count": "Kill count",
|
"Common.Attr.Key.Kill.Count": "Kill count",
|
||||||
|
"Common.Attr.Key.Behavior.Restore": "Restore default parameters",
|
||||||
"Common.Render.Attr.Key.Display.Shape": "Display Shape",
|
"Common.Render.Attr.Key.Display.Shape": "Display Shape",
|
||||||
"Common.Render.Attr.Key.Display.Shape.Square": "Square",
|
"Common.Render.Attr.Key.Display.Shape.Square": "Square",
|
||||||
"Common.Render.Attr.Key.Display.Shape.Hollow.Square": "Hollow square",
|
"Common.Render.Attr.Key.Display.Shape.Hollow.Square": "Hollow square",
|
||||||
|
@ -57,13 +57,16 @@ const ZH_CN = {
|
|||||||
"Popup.Action.No": "取消",
|
"Popup.Action.No": "取消",
|
||||||
"Popup.Action.Objects.Confirm.Title": "删除确认",
|
"Popup.Action.Objects.Confirm.Title": "删除确认",
|
||||||
"Popup.Action.Objects.Confirm.Delete": "删除",
|
"Popup.Action.Objects.Confirm.Delete": "删除",
|
||||||
|
"Popup.Action.Objects.Confirm.Restore.Title": "重置确认",
|
||||||
|
"Popup.Action.Objects.Confirm.Restore": "重置",
|
||||||
"Popup.Delete.Objects.Confirm": "你确定要删除这个(些)对象吗?对象被删除将无法撤回。",
|
"Popup.Delete.Objects.Confirm": "你确定要删除这个(些)对象吗?对象被删除将无法撤回。",
|
||||||
"Popup.Delete.Behavior.Confirm": "你确定要删除这个行为吗?行为被删除将无法撤回。",
|
"Popup.Delete.Behavior.Confirm": "你确定要删除这个行为吗?行为被删除将无法撤回。",
|
||||||
|
"Popup.Restore.Behavior.Confirm": "你确定要重置此行为的全部参数吗?此操作无法撤回。",
|
||||||
"Popup.Setting.Title": "首选项设置",
|
"Popup.Setting.Title": "首选项设置",
|
||||||
"Popup.Add.Behavior.Title": "添加行为",
|
"Popup.Add.Behavior.Title": "添加行为",
|
||||||
"Popup.Add.Behavior.Action.Add": "添加全部选中行为",
|
"Popup.Add.Behavior.Action.Add": "添加全部选中行为",
|
||||||
"Popup.Add.Behavior.Select.Counter": "找不到名为 \"{name}\" 的行为",
|
"Popup.Add.Behavior.Select.Counter": "已选择 {count} 个行为",
|
||||||
"Popup.Add.Behavior.Select.Nodata": "Could not find behavior named \"{name}\"",
|
"Popup.Add.Behavior.Select.Nodata": "找不到名为 \"{name}\" 的行为",
|
||||||
"Popup.Behavior.Info.Title": "行为详情: {behavior}",
|
"Popup.Behavior.Info.Title": "行为详情: {behavior}",
|
||||||
"Popup.Behavior.Info.Confirm": "好的, 我知道了",
|
"Popup.Behavior.Info.Confirm": "好的, 我知道了",
|
||||||
"Build.In.Label.Name.All.Group": "全部群",
|
"Build.In.Label.Name.All.Group": "全部群",
|
||||||
@ -108,6 +111,7 @@ const ZH_CN = {
|
|||||||
"Common.Attr.Key.Generation.Error.Invalid.Label": "指定的标签已失效",
|
"Common.Attr.Key.Generation.Error.Invalid.Label": "指定的标签已失效",
|
||||||
"Common.Attr.Key.Kill.Random": "随机消除",
|
"Common.Attr.Key.Kill.Random": "随机消除",
|
||||||
"Common.Attr.Key.Kill.Count": "消除数量",
|
"Common.Attr.Key.Kill.Count": "消除数量",
|
||||||
|
"Common.Attr.Key.Behavior.Restore": "还原默认参数",
|
||||||
"Common.Render.Attr.Key.Display.Shape": "显示形状",
|
"Common.Render.Attr.Key.Display.Shape": "显示形状",
|
||||||
"Common.Render.Attr.Key.Display.Shape.Square": "方形",
|
"Common.Render.Attr.Key.Display.Shape.Square": "方形",
|
||||||
"Common.Render.Attr.Key.Display.Shape.Hollow.Square": "空心方形",
|
"Common.Render.Attr.Key.Display.Shape.Hollow.Square": "空心方形",
|
||||||
|
@ -115,6 +115,11 @@ interface IParameterOptionItem<T extends IParamType = IParamType> {
|
|||||||
*/
|
*/
|
||||||
colorNormal?: boolean;
|
colorNormal?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示条件
|
||||||
|
*/
|
||||||
|
condition?: {key: string, value: any};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 全部选项
|
* 全部选项
|
||||||
*/
|
*/
|
||||||
|
@ -111,10 +111,10 @@ class SimulatorWeb extends Component {
|
|||||||
let template = this.status.model.addBehavior(getBehaviorById("Template"));
|
let template = this.status.model.addBehavior(getBehaviorById("Template"));
|
||||||
template.name = "Template"; template.color = [150, 20, 220];
|
template.name = "Template"; template.color = [150, 20, 220];
|
||||||
|
|
||||||
let dynamicFish = this.status.model.addBehavior(getBehaviorById("Dynamics"));
|
let dynamicFish = this.status.model.addBehavior(getBehaviorById("PhysicsDynamics"));
|
||||||
dynamicFish.name = "Dynamic Fish"; dynamicFish.color = [250, 200, 80];
|
dynamicFish.name = "Dynamic Fish"; dynamicFish.color = [250, 200, 80];
|
||||||
|
|
||||||
let dynamicShark = this.status.model.addBehavior(getBehaviorById("Dynamics"));
|
let dynamicShark = this.status.model.addBehavior(getBehaviorById("PhysicsDynamics"));
|
||||||
dynamicShark.name = "Dynamic Shark"; dynamicShark.color = [250, 200, 80];
|
dynamicShark.name = "Dynamic Shark"; dynamicShark.color = [250, 200, 80];
|
||||||
|
|
||||||
let brownian = this.status.model.addBehavior(getBehaviorById("Brownian"));
|
let brownian = this.status.model.addBehavior(getBehaviorById("Brownian"));
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { Component, ReactNode} from "react";
|
import { Component, ReactNode} from "react";
|
||||||
import { useSettingWithEvent, IMixinSettingProps } from "@Context/Setting";
|
import { useSettingWithEvent, IMixinSettingProps } from "@Context/Setting";
|
||||||
import { useStatusWithEvent, IMixinStatusProps } from "@Context/Status";
|
import { useStatusWithEvent, IMixinStatusProps } from "@Context/Status";
|
||||||
|
import { getDefaultValue } from "@Model/Parameter";
|
||||||
import { IAnyBehavior } from "@Model/Behavior";
|
import { IAnyBehavior } from "@Model/Behavior";
|
||||||
import { Message } from "@Input/Message/Message";
|
import { Message } from "@Input/Message/Message";
|
||||||
import { AttrInput } from "@Input/AttrInput/AttrInput";
|
import { AttrInput } from "@Input/AttrInput/AttrInput";
|
||||||
@ -12,9 +13,17 @@ import "./BehaviorDetails.scss";
|
|||||||
|
|
||||||
interface IBehaviorDetailsProps {}
|
interface IBehaviorDetailsProps {}
|
||||||
|
|
||||||
|
interface IBehaviorDetailsState {
|
||||||
|
updateId: number;
|
||||||
|
}
|
||||||
|
|
||||||
@useSettingWithEvent("language")
|
@useSettingWithEvent("language")
|
||||||
@useStatusWithEvent("focusBehaviorChange", "behaviorAttrChange")
|
@useStatusWithEvent("focusBehaviorChange", "behaviorAttrChange")
|
||||||
class BehaviorDetails extends Component<IBehaviorDetailsProps & IMixinStatusProps & IMixinSettingProps> {
|
class BehaviorDetails extends Component<IBehaviorDetailsProps & IMixinStatusProps & IMixinSettingProps, IBehaviorDetailsState> {
|
||||||
|
|
||||||
|
public state: Readonly<IBehaviorDetailsState> = {
|
||||||
|
updateId: 1
|
||||||
|
};
|
||||||
|
|
||||||
private handelDeleteBehavior = (behavior: IAnyBehavior) => {
|
private handelDeleteBehavior = (behavior: IAnyBehavior) => {
|
||||||
if (this.props.status) {
|
if (this.props.status) {
|
||||||
@ -32,6 +41,28 @@ class BehaviorDetails extends Component<IBehaviorDetailsProps & IMixinStatusProp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private handelRestoreBehavior = (behavior: IAnyBehavior) => {
|
||||||
|
if (this.props.status) {
|
||||||
|
const status = this.props.status;
|
||||||
|
status.popup.showPopup(ConfirmPopup, {
|
||||||
|
infoI18n: "Popup.Restore.Behavior.Confirm",
|
||||||
|
titleI18N: "Popup.Action.Objects.Confirm.Restore.Title",
|
||||||
|
yesI18n: "Popup.Action.Objects.Confirm.Restore",
|
||||||
|
red: "yes",
|
||||||
|
yes: () => {
|
||||||
|
status.changeBehaviorAttrib(
|
||||||
|
behavior.id, "parameter",
|
||||||
|
getDefaultValue(behavior.parameterOption) as any,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
this.setState({
|
||||||
|
updateId: this.state.updateId + 1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private renderFrom(behavior: IAnyBehavior): ReactNode {
|
private renderFrom(behavior: IAnyBehavior): ReactNode {
|
||||||
|
|
||||||
return <>
|
return <>
|
||||||
@ -61,8 +92,16 @@ class BehaviorDetails extends Component<IBehaviorDetailsProps & IMixinStatusProp
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<TogglesInput
|
||||||
|
keyI18n="Common.Attr.Key.Behavior.Restore" red
|
||||||
|
onIconName="ReplyAll" offIconName="ReplyAll"
|
||||||
|
valueChange={() => {
|
||||||
|
this.handelRestoreBehavior(behavior)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
<Parameter
|
<Parameter
|
||||||
key={behavior.id}
|
key={`${behavior.id}-${this.state.updateId}`}
|
||||||
option={behavior.parameterOption}
|
option={behavior.parameterOption}
|
||||||
value={behavior.parameter}
|
value={behavior.parameter}
|
||||||
i18n={(name, language) => behavior.getTerms(name, language)}
|
i18n={(name, language) => behavior.getTerms(name, language)}
|
||||||
|
Loading…
Reference in New Issue
Block a user