diff --git a/source/Component/ErrorMessage/ErrorMessage.tsx b/source/Component/ErrorMessage/ErrorMessage.tsx index d82ef9c..375dc24 100644 --- a/source/Component/ErrorMessage/ErrorMessage.tsx +++ b/source/Component/ErrorMessage/ErrorMessage.tsx @@ -5,10 +5,11 @@ import "./ErrorMessage.scss"; interface IErrorMessageProps { i18nKey: AllI18nKeys; options?: Record; + className?: string; } const ErrorMessage: FunctionComponent = (props) => { - return
+ return
!!c).join(" ")}>
} diff --git a/source/Component/LabelList/LabelList.scss b/source/Component/LabelList/LabelList.scss index 3a046a7..b0af602 100644 --- a/source/Component/LabelList/LabelList.scss +++ b/source/Component/LabelList/LabelList.scss @@ -1,5 +1,9 @@ @import "../Theme/Theme.scss"; +div.label-list-root { + margin: -5px; +} + div.label { width: auto; height: auto; diff --git a/source/Component/LabelList/LabelList.tsx b/source/Component/LabelList/LabelList.tsx index db90129..7250fa8 100644 --- a/source/Component/LabelList/LabelList.tsx +++ b/source/Component/LabelList/LabelList.tsx @@ -1,4 +1,4 @@ -import { Component } from "react"; +import { Component, RefObject } from "react"; import { Label } from "@Model/Label"; import { Icon } from "@fluentui/react"; import { useSetting, IMixinSettingProps, Themes } from "@Context/Setting"; @@ -10,6 +10,7 @@ interface ILabelListProps { maxWidth?: number; width?: number; labels: Label[]; + addRef?: RefObject; focusLabel?: Label; clickLabel?: (label: Label) => any; deleteLabel?: (label: Label) => any; @@ -79,17 +80,17 @@ class LabelList extends Component { }); } - private renderAddButton(isNoMargin: boolean = false) { + private renderAddButton() { const theme = this.props.setting?.themes ?? Themes.dark; const classList: string[] = ["label", "add-button"]; classList.push( theme === Themes.dark ? "dark" : "light" ); return
{ this.props.addLabel ? this.props.addLabel() : null @@ -100,17 +101,10 @@ class LabelList extends Component { } public render() { - if (this.props.labels.length > 0) { - return <> - {this.renderAllLabels()} - {this.props.addLabel ? this.renderAddButton() : null} - ; - } else { - return <> - - {this.props.addLabel ? this.renderAddButton(true) : null} - ; - } + return
+ {this.renderAllLabels()} + {this.props.addLabel ? this.renderAddButton() : null} +
; } } diff --git a/source/Component/LabelPicker/LabelPicker.scss b/source/Component/LabelPicker/LabelPicker.scss new file mode 100644 index 0000000..b3a74f3 --- /dev/null +++ b/source/Component/LabelPicker/LabelPicker.scss @@ -0,0 +1,31 @@ +@import "../Theme/Theme.scss"; + +$line-min-height: 26px; + +div.label-picker-root { + width: 100%; + display: flex; + flex-wrap: wrap; + min-height: $line-min-height; + padding: 5px 0; + + div.input-intro { + width: 50%; + height: 100%; + max-width: 220px; + display: flex; + align-items: center; + padding-right: 5px; + box-sizing: border-box; + } + + div.root-content { + width: 50%; + height: 100%; + max-width: 180px; + min-height: $line-min-height; + border-radius: 3px; + overflow: hidden; + display: flex; + } +} \ No newline at end of file diff --git a/source/Component/LabelPicker/LabelPicker.tsx b/source/Component/LabelPicker/LabelPicker.tsx new file mode 100644 index 0000000..6abe2ac --- /dev/null +++ b/source/Component/LabelPicker/LabelPicker.tsx @@ -0,0 +1,38 @@ +import { AllI18nKeys, Localization } from "@Component/Localization/Localization"; +import { Label } from "@Model/Label"; +import { Component, ReactNode } from "react"; +import { LabelList } from "../LabelList/LabelList"; +import "./LabelPicker.scss" + +interface ILabelPickerProps { + keyI18n: AllI18nKeys; + infoI18n?: AllI18nKeys; + labels: Label[]; +} + +class LabelPicker extends Component { + + public render(): ReactNode { + return
+
+ +
+
+ { + + }} + addLabel={() => { + + }} + /> +
+
+ } +} + +export { LabelPicker } \ No newline at end of file diff --git a/source/Component/ObjectPicker/ObjectPicker.tsx b/source/Component/ObjectPicker/ObjectPicker.tsx new file mode 100644 index 0000000..63f649f --- /dev/null +++ b/source/Component/ObjectPicker/ObjectPicker.tsx @@ -0,0 +1,12 @@ +import { Component, ReactNode } from "react"; + +interface IObjectPickerProps {} + +class ObjectPicker extends Component { + + public render(): ReactNode { + return
+ } +} + +export { ObjectPicker } \ No newline at end of file diff --git a/source/Component/PickerList/PickerList.tsx b/source/Component/PickerList/PickerList.tsx new file mode 100644 index 0000000..108a62d --- /dev/null +++ b/source/Component/PickerList/PickerList.tsx @@ -0,0 +1,12 @@ +import { Component, ReactNode } from "react"; + +interface IPickerListProps {} + +class PickerList extends Component { + + public render(): ReactNode { + return
+ } +} + +export { PickerList } \ No newline at end of file diff --git a/source/Localization/EN-US.ts b/source/Localization/EN-US.ts index 6f7d75f..6712c93 100644 --- a/source/Localization/EN-US.ts +++ b/source/Localization/EN-US.ts @@ -51,6 +51,7 @@ const EN_US = { "Common.Attr.Key.Display": "Display", "Common.Attr.Key.Update": "Update", "Common.Attr.Key.Delete": "Delete", + "Common.Attr.Key.Label": "Label", "Common.Attr.Key.Error.Multiple": "Multiple values", "Panel.Info.Range.Details.Attr.Error.Not.Range": "Object is not a Range", "Panel.Info.Range.Details.Attr.Error.Unspecified": "Unspecified range object", diff --git a/source/Localization/ZH-CN.ts b/source/Localization/ZH-CN.ts index b6731a9..8e4bce6 100644 --- a/source/Localization/ZH-CN.ts +++ b/source/Localization/ZH-CN.ts @@ -51,6 +51,7 @@ const ZH_CN = { "Common.Attr.Key.Display": "显示", "Common.Attr.Key.Update": "更新", "Common.Attr.Key.Delete": "删除", + "Common.Attr.Key.Label": "标签", "Common.Attr.Key.Error.Multiple": "多重数值", "Panel.Info.Range.Details.Attr.Error.Not.Range": "对象不是一个范围", "Panel.Info.Range.Details.Attr.Error.Unspecified": "未指定范围对象", diff --git a/source/Panel/LabelList/LabelList.scss b/source/Panel/LabelList/LabelList.scss index b2233e1..7643f5c 100644 --- a/source/Panel/LabelList/LabelList.scss +++ b/source/Panel/LabelList/LabelList.scss @@ -5,4 +5,8 @@ div.label-list-panel-root { min-height: 100%; padding: 10px; box-sizing: border-box; +} + +div.label-list-pabel-err-msg { + padding-bottom: 5px; } \ No newline at end of file diff --git a/source/Panel/LabelList/LabelList.tsx b/source/Panel/LabelList/LabelList.tsx index 13c15b8..fce98be 100644 --- a/source/Panel/LabelList/LabelList.tsx +++ b/source/Panel/LabelList/LabelList.tsx @@ -3,6 +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 "./LabelList.scss"; interface ILabelListProps { @@ -29,6 +30,12 @@ class LabelList extends Component + {labels.length <=0 ? + : null + } { public readonly AttrI18nKey: AllI18nKeys[] = [ "Common.Attr.Key.Display.Name", + "Common.Attr.Key.Label", "Common.Attr.Key.Display", "Common.Attr.Key.Update", "Common.Attr.Key.Color", @@ -58,6 +60,11 @@ class RangeDetails extends Component { {this.renderAttrInput(range.id, keyIndex ++, range.displayName, (val, status) => { status.changeRangeAttrib(range.id, "displayName", val); })} + + { if (this.props.status) {