diff --git a/source/Component/LabelPicker/LabelPicker.scss b/source/Component/LabelPicker/LabelPicker.scss index a8a7220..6071264 100644 --- a/source/Component/LabelPicker/LabelPicker.scss +++ b/source/Component/LabelPicker/LabelPicker.scss @@ -2,31 +2,6 @@ $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%; - min-height: $line-min-height; - 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; - } +div.label-picker { + min-height: $line-min-height; } \ No newline at end of file diff --git a/source/Component/LabelPicker/LabelPicker.tsx b/source/Component/LabelPicker/LabelPicker.tsx index 94e2d82..8b238ec 100644 --- a/source/Component/LabelPicker/LabelPicker.tsx +++ b/source/Component/LabelPicker/LabelPicker.tsx @@ -1,14 +1,12 @@ -import { AllI18nKeys, Localization } from "@Component/Localization/Localization"; import { PickerList } from "../PickerList/PickerList"; import { Label } from "@Model/Label"; +import { TextField, ITextFieldProps } from "../TextField/TextField"; import { useStatusWithEvent, IMixinStatusProps } from "@Context/Status"; import { Component, ReactNode, createRef } from "react"; import { LabelList } from "../LabelList/LabelList"; import "./LabelPicker.scss" -interface ILabelPickerProps { - keyI18n: AllI18nKeys; - infoI18n?: AllI18nKeys; +interface ILabelPickerProps extends ITextFieldProps { labels: Label[]; labelAdd?: (label: Label) => any; labelDelete?: (label: Label) => any; @@ -47,47 +45,50 @@ class LabelPicker extends Component { + this.setState({ + isPickerVisible: false + }); + }} + clickObjectItems={(label) => { + if (label instanceof Label && this.props.labelAdd) { + this.props.labelAdd(label) + } + this.setState({ + isPickerVisible: false + }); + }} + target={this.addButtonRef} + />; + } + public render(): ReactNode { - return
-
- -
-
- { - this.props.labelDelete ? this.props.labelDelete(label) : 0; - }} - addLabel={() => { - this.setState({ - isPickerVisible: true - }); - }} - /> - {this.state.isPickerVisible ? { - this.setState({ - isPickerVisible: false - }); - }} - clickObjectItems={(label) => { - if (label instanceof Label && this.props.labelAdd) { - this.props.labelAdd(label) - } - this.setState({ - isPickerVisible: false - }); - }} - target={this.addButtonRef} - /> : null} -
-
+ return + { + this.props.labelDelete ? this.props.labelDelete(label) : 0; + }} + addLabel={() => { + this.setState({ + isPickerVisible: true + }); + }} + /> + {this.state.isPickerVisible ? this.renderPicker(): null} + ; } } diff --git a/source/Component/ObjectPicker/ObjectPicker.scss b/source/Component/ObjectPicker/ObjectPicker.scss index 757f005..e0dc06f 100644 --- a/source/Component/ObjectPicker/ObjectPicker.scss +++ b/source/Component/ObjectPicker/ObjectPicker.scss @@ -1,86 +1,31 @@ @import "../Theme/Theme.scss"; -$line-min-height: 26px; +$line-min-height: 24px; -div.object-picker-root { - width: 100%; - display: flex; - min-height: $line-min-height; - padding: 5px 0; +div.object-picker { - div.input-intro { - width: 50%; - height: 100%; - max-width: 220px; - min-height: $line-min-height; - display: flex; - align-items: center; - padding-right: 5px; - box-sizing: border-box; - } - - div.root-content { - width: 50%; + div.value-view { + width: 100%; height: 100%; - max-width: 180px; min-height: $line-min-height; - border-radius: 3px; - overflow: hidden; display: flex; - cursor: pointer; + align-items: center; + white-space: nowrap; + word-break: keep-all; + text-overflow: ellipsis; + overflow: hidden; - div.value-view { - width: 100%; - height: 100%; - min-height: $line-min-height; - display: flex; - align-items: center; - white-space: nowrap; - word-break: keep-all; - text-overflow: ellipsis; - overflow: hidden; - - span { - display: block; - } - } - - div.list-button { - width: $line-min-height; - height: $line-min-height; - flex-shrink: 0; - display: flex; - justify-content: center; - align-items: center; + span { + display: block; } } -} -div.dark.object-picker-root { - - div.root-content { - background-color: $lt-bg-color-lvl3-dark; - color: $lt-font-color-normal-dark; - } - - div.root-content:hover { - background-color: $lt-bg-color-lvl2-dark; - } -} - -div.light.object-picker-root { - - div.root-content { - background-color: $lt-bg-color-lvl3-light; - color: $lt-font-color-normal-light; - } - - div.root-content:hover { - background-color: $lt-bg-color-lvl2-light; - } -} - -div.combo-picker-root { - width: 300px; - height: 340px; + div.list-button { + width: $line-min-height; + height: $line-min-height; + flex-shrink: 0; + display: flex; + justify-content: center; + align-items: center; + } } \ No newline at end of file diff --git a/source/Component/ObjectPicker/ObjectPicker.tsx b/source/Component/ObjectPicker/ObjectPicker.tsx index 6423bb0..f78a2e1 100644 --- a/source/Component/ObjectPicker/ObjectPicker.tsx +++ b/source/Component/ObjectPicker/ObjectPicker.tsx @@ -2,19 +2,17 @@ import { Component, createRef, ReactNode } from "react"; import { Label } from "@Model/Label"; import { Group } from "@Model/Group"; import { Range } from "@Model/Range"; +import { TextField, ITextFieldProps } from "../TextField/TextField"; import { useStatusWithEvent, IMixinStatusProps } from "@Context/Status"; -import { FontLevel, Theme } from "@Component/Theme/Theme"; import { PickerList, IDisplayItem } from "../PickerList/PickerList"; -import { AllI18nKeys, Localization } from "@Component/Localization/Localization"; +import { Localization } from "@Component/Localization/Localization"; import { Icon } from "@fluentui/react"; import CtrlObject from "@Model/CtrlObject"; import "./ObjectPicker.scss"; type IObjectType = Label | Group | Range | CtrlObject; -interface IObjectPickerProps { - keyI18n: AllI18nKeys; - infoI18n?: AllI18nKeys; +interface IObjectPickerProps extends ITextFieldProps { type: Array<"L" | "G" | "R">; value?: IObjectType; valueChange?: (value: IObjectType) => any; @@ -109,31 +107,28 @@ class ObjectPicker extends Component - -
- + { + this.setState({ + isPickerVisible: true + }) + }} + > +
+
-
{ - this.setState({ - isPickerVisible: true - }) - }} - > -
- -
-
- { - name ? - {name} : - - } -
+
+ { + name ? + {name} : + + }
- + {this.state.isPickerVisible ? this.renderPicker(): null} diff --git a/source/Component/TogglesInput/TogglesInput.scss b/source/Component/TogglesInput/TogglesInput.scss index 3a1c789..b89fa89 100644 --- a/source/Component/TogglesInput/TogglesInput.scss +++ b/source/Component/TogglesInput/TogglesInput.scss @@ -3,62 +3,40 @@ $line-min-height: 26px; div.toggles-input { - width: 100%; - display: flex; - min-height: $line-min-height; - padding: 5px 0; - div.toggles-intro { - width: 50%; - height: 100%; - max-width: 220px; - min-height: $line-min-height; - display: flex; - align-items: center; - padding-right: 5px; - box-sizing: border-box; - } - - div.toggles-content { - width: 50%; - height: 100%; - max-width: 180px; - min-height: $line-min-height; - - div.checkbox { - width: $line-min-height; - height: $line-min-height; - overflow: hidden; - border-radius: 3px; - display: flex; - align-items: center; - justify-content: center; - cursor: pointer; - user-select: none; - } + div.checkbox { + width: $line-min-height; + height: $line-min-height; + overflow: hidden; + border-radius: 3px; + display: flex; + align-items: center; + justify-content: center; + cursor: pointer; + user-select: none; } } -div.dark.toggles-input { +div.dark.text-field-root { - div.toggles-content div.checkbox { + div.toggles-input div.checkbox { background-color: $lt-bg-color-lvl3-dark; color: $lt-font-color-normal-dark; } - div.toggles-content div.checkbox:hover { + div.toggles-input div.checkbox:hover { background-color: $lt-bg-color-lvl2-dark; } } -div.light.toggles-input { +div.light.text-field-root { - div.toggles-content div.checkbox { + div.toggles-input div.checkbox { background-color: $lt-bg-color-lvl3-light; color: $lt-font-color-normal-light; } - div.toggles-content div.checkbox:hover { + div.toggles-input div.checkbox:hover { background-color: $lt-bg-color-lvl2-light; } } \ No newline at end of file diff --git a/source/Component/TogglesInput/TogglesInput.tsx b/source/Component/TogglesInput/TogglesInput.tsx index 01a5b5a..a355ddb 100644 --- a/source/Component/TogglesInput/TogglesInput.tsx +++ b/source/Component/TogglesInput/TogglesInput.tsx @@ -1,14 +1,10 @@ -import { AllI18nKeys, Localization } from "@Component/Localization/Localization"; -import { Theme } from "@Component/Theme/Theme"; import { Icon } from "@fluentui/react"; import { Component, ReactNode } from "react"; +import { TextField, ITextFieldProps } from "../TextField/TextField"; import "./TogglesInput.scss"; -interface ITogglesInputProps { - keyI18n: AllI18nKeys; - infoI18n?: AllI18nKeys; +interface ITogglesInputProps extends ITextFieldProps { value?: boolean; - disable?: boolean; onIconName?: string; offIconName?: string; valueChange?: (value: boolean) => any; @@ -16,39 +12,40 @@ interface ITogglesInputProps { class TogglesInput extends Component { public render(): ReactNode { - return -
- -
-
-
+
{ + if (this.props.disableI18n) { + return; + } + if (this.props.valueChange) { + this.props.valueChange(!this.props.value); + } + })} + > + { - if (this.props.disable) { - return; - } - if (this.props.valueChange) { - this.props.valueChange(!this.props.value); - } - })} - > - -
-
- + /> +
+ ; } }