Rename message fix layout color

This commit is contained in:
2022-03-13 12:45:02 +08:00
parent b2eff20b6e
commit ff27bddf27
17 changed files with 97 additions and 48 deletions
+4 -3
View File
@@ -1,8 +1,7 @@
import { Component, ReactNode } from "react";
import { AttrInput } from "@Component/AttrInput/AttrInput";
import { useStatusWithEvent, IMixinStatusProps } from "@Context/Status";
import { AllI18nKeys } from "@Component/Localization/Localization";
import { ErrorMessage } from "@Component/ErrorMessage/ErrorMessage";
import { Message } from "@Component/Message/Message";
import { ColorInput } from "@Component/ColorInput/ColorInput";
import { Label } from "@Model/Label";
import { TogglesInput } from "@Component/TogglesInput/TogglesInput";
@@ -13,6 +12,8 @@ class LabelDetails extends Component<IMixinStatusProps> {
private renderFrom(label: Label) {
return <>
<Message i18nKey="Common.Attr.Title.Basic" isTitle first/>
<AttrInput keyI18n="Common.Attr.Key.Display.Name" maxLength={15} value={label.name} valueChange={(value) => {
if (this.props.status) {
@@ -42,7 +43,7 @@ class LabelDetails extends Component<IMixinStatusProps> {
return this.renderFrom(this.props.status.focusLabel);
}
}
return <ErrorMessage i18nKey="Panel.Info.Label.Details.Error.Unspecified"/>;
return <Message i18nKey="Panel.Info.Label.Details.Error.Unspecified"/>;
}
}
-4
View File
@@ -5,8 +5,4 @@ div.label-list-panel-root {
min-height: 100%;
padding: 10px;
box-sizing: border-box;
}
div.label-list-pabel-err-msg {
padding-bottom: 5px;
}
+2 -5
View File
@@ -3,7 +3,7 @@ import { Component } from "react";
import { useStatusWithEvent, IMixinStatusProps } from "@Context/Status";
import { useSetting, IMixinSettingProps } from "@Context/Setting";
import { Label } from "@Model/Label";
import { ErrorMessage } from "@Component/ErrorMessage/ErrorMessage";
import { Message } from "@Component/Message/Message";
import "./LabelList.scss";
interface ILabelListProps {
@@ -31,10 +31,7 @@ class LabelList extends Component<ILabelListProps & IMixinStatusProps & IMixinSe
}}
>
{labels.length <=0 ?
<ErrorMessage
className="label-list-pabel-err-msg"
i18nKey="Panel.Info.Label.List.Error.Nodata"
/> : null
<Message i18nKey="Panel.Info.Label.List.Error.Nodata"/> : null
}
<LabelListComponent
labels={labels}
+2 -2
View File
@@ -1,6 +1,6 @@
import { ReactNode, Component, FunctionComponent } from "react";
import { Theme } from "@Component/Theme/Theme";
import { ErrorMessage } from "@Component/ErrorMessage/ErrorMessage";
import { Message } from "@Component/Message/Message";
import { RenderView } from "./RenderView/RenderView";
import { ObjectList } from "./ObjectList/ObjectList";
import { ObjectCommand } from "./ObjectList/ObjectCommand";
@@ -57,7 +57,7 @@ function getPanelById(panelId: PanelId): ReactNode {
const C = info.class;
return <C></C>
} else return <Theme>
<ErrorMessage i18nKey={"Panel.Info.Notfound"} options={{ id: panelId }}/>
<Message i18nKey={"Panel.Info.Notfound"} options={{ id: panelId }}/>
</Theme>
}
}
+16 -11
View File
@@ -2,7 +2,7 @@ import { Component, ReactNode } from "react";
import { AttrInput } from "@Component/AttrInput/AttrInput";
import { useStatusWithEvent, IMixinStatusProps, Status } from "@Context/Status";
import { AllI18nKeys, Localization } from "@Component/Localization/Localization";
import { ErrorMessage } from "@Component/ErrorMessage/ErrorMessage";
import { Message } from "@Component/Message/Message";
import { Range } from "@Model/Range";
import { ObjectID } from "@Model/Renderer";
import { ColorInput } from "@Component/ColorInput/ColorInput";
@@ -15,10 +15,10 @@ class RangeDetails extends Component<IMixinStatusProps> {
public readonly AttrI18nKey: AllI18nKeys[] = [
"Common.Attr.Key.Display.Name",
"Common.Attr.Key.Color",
"Common.Attr.Key.Label",
"Common.Attr.Key.Display",
"Common.Attr.Key.Update",
"Common.Attr.Key.Color",
"Common.Attr.Key.Position.X",
"Common.Attr.Key.Position.Y",
"Common.Attr.Key.Position.Z",
@@ -57,10 +57,19 @@ class RangeDetails extends Component<IMixinStatusProps> {
let keyIndex = 0;
return <>
<Message i18nKey="Common.Attr.Title.Basic" isTitle first/>
{this.renderAttrInput(range.id, keyIndex ++, range.displayName, (val, status) => {
status.changeRangeAttrib(range.id, "displayName", val);
})}
<ColorInput keyI18n={this.AttrI18nKey[keyIndex ++]} value={range.color} normal valueChange={(color) => {
if (this.props.status) {
this.props.status.changeRangeAttrib(range.id, "color", color);
}
}}/>
<LabelPicker keyI18n={this.AttrI18nKey[keyIndex ++]}
labels={range.allLabels()}
labelAdd={(label) => {
@@ -87,11 +96,7 @@ class RangeDetails extends Component<IMixinStatusProps> {
}
}}/>
<ColorInput keyI18n={this.AttrI18nKey[keyIndex ++]} value={range.color} normal valueChange={(color) => {
if (this.props.status) {
this.props.status.changeRangeAttrib(range.id, "color", color);
}
}}/>
<Message i18nKey="Common.Attr.Title.Spatial" isTitle/>
{this.renderAttrInput(range.id, keyIndex ++, range.position[0], (val, status) => {
range.position[0] = (val as any) / 1;
@@ -124,10 +129,10 @@ class RangeDetails extends Component<IMixinStatusProps> {
public render(): ReactNode {
if (this.props.status) {
if (this.props.status.focusObject.size <= 0) {
return <ErrorMessage i18nKey="Panel.Info.Range.Details.Attr.Error.Unspecified"/>;
return <Message i18nKey="Panel.Info.Range.Details.Attr.Error.Unspecified"/>;
}
if (this.props.status.focusObject.size > 1) {
return <ErrorMessage i18nKey="Common.Attr.Key.Error.Multiple"/>;
return <Message i18nKey="Common.Attr.Key.Error.Multiple"/>;
}
let id: ObjectID = "";
this.props.status.focusObject.forEach((cid => id = cid));
@@ -137,10 +142,10 @@ class RangeDetails extends Component<IMixinStatusProps> {
if (range instanceof Range) {
return this.renderFrom(range);
} else {
return <ErrorMessage i18nKey="Panel.Info.Range.Details.Attr.Error.Not.Range"/>;
return <Message i18nKey="Panel.Info.Range.Details.Attr.Error.Not.Range"/>;
}
}
return <ErrorMessage i18nKey="Panel.Info.Range.Details.Attr.Error.Unspecified"/>;
return <Message i18nKey="Panel.Info.Range.Details.Attr.Error.Unspecified"/>;
}
}